Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120510927
cppLasso.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jul 4, 22:00
Size
615 B
Mime Type
text/x-c
Expires
Sun, Jul 6, 22:00 (2 d)
Engine
blob
Format
Raw Data
Handle
27199722
Attached To
R1908 Research Scripts (Thomas Bolton)
cppLasso.cpp
View Options
#include "linalg.h"
int main(int argc, char** argv) {
int m = 10;
int p = 20;
/// external allocation for the matrix
double* prD = new double[m*p];
Matrix<double> D(prD,m,p);
D.setAleat();
D.normalize();
/// Allocate a matrix of size m x p
Matrix<double> D2(m,p);
D2.setAleat();
D2.normalize();
int n = 100;
Matrix<double> X(m,n);
X.setAleat();
/// create empty sparse matrix
SpMatrix<double> spa;
lasso2(X,D,spa,10,0.15); // first simple example
/// extern allocation for the matrix D requires
/// manually unallocating prD
delete[](prD);
}
Event Timeline
Log In to Comment