1 #include "constructionModelesLassoRank.h"
2 #include "test_utils.h"
4 int main(int argc
, char** argv
)
8 int* dimensions
= readArray_int("dimensions",&nbDims
,1);
10 int p
= dimensions
[1];
11 int m
= dimensions
[2];
12 int k
= dimensions
[3];
13 int L
= dimensions
[4];
22 const int dimPi
[] = {k
, L
};
23 float* Pi
= readArray_real("Pi",dimPi
,2);
26 const int dimRho
[] = {m
, m
, k
, L
};
27 float* Rho
= readArray_real("Rho",dimRho
,4);
29 // min number of iterations
30 int* pmini
= readArray_int("mini",&lengthOne
,1);
34 // max number of iterations
35 int* pmaxi
= readArray_int("maxi",&lengthOne
,1);
40 const int dimX
[] = {n
, p
};
41 float* X
= readArray_real("X",dimX
,2);
44 const int dimY
[] = {n
, m
};
45 float* Y
= readArray_real("Y",dimY
,2);
48 float* ptau
= readArray_real("tau",&lengthOne
,1);
53 const int dimA
[] = {p
, L
};
54 int* A1
= readArray_int("A1",dimA
,2);
57 int* prangmin
= readArray_int("rangmin",&lengthOne
,1);
58 int rangmin
= *prangmin
;
62 int* prangmax
= readArray_int("rangmax",&lengthOne
,1);
63 int rangmax
= *prangmax
;
71 int Size
= (int)pow(rangmax
-rangmin
+1, k
);
72 const int dimPhi
[] = {p
, m
, k
, L
*Size
};
73 float* phi
= (float*)malloc(dimPhi
[0]*dimPhi
[1]*dimPhi
[2]*dimPhi
[3]*sizeof(float));
76 const int dimLvraisemblance
[] = {L
*Size
, 2};
77 float* lvraisemblance
= (float*)malloc(dimLvraisemblance
[0]*dimLvraisemblance
[1]*sizeof(float));
79 //////////////////////////////////////////////
80 // Main call to constructionModelesLassoMLE //
81 //////////////////////////////////////////////
83 constructionModelesLassoRank(
84 Pi
,Rho
,mini
,maxi
,X
,Y
,tau
,A1
,rangmin
,rangmax
,
94 // Compare to reference outputs
95 float* ref_phi
= readArray_real("phi",dimPhi
, 4);
96 compareArray_real("phi", phi
, ref_phi
, dimPhi
[0]*dimPhi
[1]*dimPhi
[2]*dimPhi
[3]);
101 float* ref_lvraisemblance
= readArray_real("lvraisemblance",dimLvraisemblance
,2);
102 compareArray_real("lvraisemblance", lvraisemblance
, ref_lvraisemblance
, dimLvraisemblance
[0]*dimLvraisemblance
[1]);
103 free(lvraisemblance
);
104 free(ref_lvraisemblance
);