1 #include "selectiontotale.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 dimPhiInit
[] = {p
, m
, k
};
23 float* phiInit
= readArray_real("phiInit",dimPhiInit
,3);
26 const int dimRhoInit
[] = {m
, m
, k
};
27 float* rhoInit
= readArray_real("rhoInit",dimRhoInit
,3);
30 float* piInit
= readArray_real("piInit",&k
,1);
33 const int dimGamInit
[] = {n
, k
};
34 float* gamInit
= readArray_real("gamInit",dimGamInit
, 2);
36 // min number of iterations
37 int* pmini
= readArray_int("mini",&lengthOne
,1);
41 // max number of iterations
42 int* pmaxi
= readArray_int("maxi",&lengthOne
,1);
47 float* pgamma
= readArray_real("gamma",&lengthOne
,1);
48 float gamma
= *pgamma
;
52 float* glambda
= readArray_real("glambda",&L
,1);
55 const int dimX
[] = {n
, p
};
56 float* X
= readArray_real("X",dimX
,2);
59 const int dimY
[] = {n
, m
};
60 float* Y
= readArray_real("Y",dimY
,2);
63 float* pseuil
= readArray_real("seuil",&lengthOne
,1);
64 float seuil
= *pseuil
;
68 float* ptau
= readArray_real("tau",&lengthOne
,1);
77 const int dimA
[] = {p
, m
+1, L
};
78 int* A1
= (int*)malloc(dimA
[0]*dimA
[1]*dimA
[2]*sizeof(int));
81 int* A2
= (int*)malloc(dimA
[0]*dimA
[1]*dimA
[2]*sizeof(int));
84 const int dimRho
[] = {m
, m
, k
, L
};
85 float* Rho
= (float*)malloc(dimRho
[0]*dimRho
[1]*dimRho
[2]*dimRho
[3]*sizeof(float));
88 const int dimPi
[] = {k
, L
};
89 float* Pi
= (float*)malloc(dimPi
[0]*dimPi
[1]*sizeof(float));
91 //////////////////////////////////////////////
92 // Main call to constructionModelesLassoMLE //
93 //////////////////////////////////////////////
96 phiInit
,rhoInit
,piInit
,gamInit
,mini
,maxi
,gamma
,glambda
,X
,Y
,seuil
,tau
,
100 // free input pointers
109 // Compare to reference outputs
110 int* ref_A1
= readArray_int("A1",dimA
, 3);
111 compareArray_int("A1", A1
, ref_A1
, dimA
[0]*dimA
[1]*dimA
[2]);
116 int* ref_A2
= readArray_int("A2",dimA
, 3);
117 compareArray_int("A2", A2
, ref_A2
, dimA
[0]*dimA
[1]*dimA
[2]);
122 float* ref_Rho
= readArray_real("Rho",dimRho
, 4);
123 compareArray_real("Rho", Rho
, ref_Rho
, dimRho
[0]*dimRho
[1]*dimRho
[2]*dimRho
[3]);
128 float* ref_Pi
= readArray_real("Pi",dimPi
, 2);
129 compareArray_real("Pi", Pi
, ref_Pi
, dimPi
[0]*dimPi
[1]);