1 #include "constructionModelesLassoMLE.h"
4 int main(int argc
, char** argv
)
8 Int
* dimensions
= readArray_int("dimensions",&nbDims
,1);
9 mwSize n
= dimensions
[0];
10 mwSize p
= dimensions
[1];
11 mwSize m
= dimensions
[2];
12 mwSize k
= dimensions
[3];
13 mwSize L
= dimensions
[4];
22 const mwSize dimPhiInit
[] = {p
, m
, k
};
23 Real
* phiInit
= readArray_real("phiInit",dimPhiInit
,3);
26 const mwSize dimRhoInit
[] = {m
, m
, k
};
27 Real
* rhoInit
= readArray_real("rhoInit",dimRhoInit
,3);
30 Real
* piInit
= readArray_real("piInit",&k
,1);
33 const mwSize dimGamInit
[] = {n
, k
};
34 Real
* 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 Real
* pgamma
= readArray_real("gamma",&lengthOne
,1);
52 Real
* glambda
= readArray_real("glambda",&L
,1);
55 const mwSize dimX
[] = {n
, p
};
56 Real
* X
= readArray_real("X",dimX
,2);
59 const mwSize dimY
[] = {n
, m
};
60 Real
* Y
= readArray_real("Y",dimY
,2);
63 Real
* pseuil
= readArray_real("seuil",&lengthOne
,1);
68 Real
* ptau
= readArray_real("tau",&lengthOne
,1);
73 const mwSize dimA
[] = {p
, m
+1, L
};
74 Int
* A1
= readArray_int("A1",dimA
,3);
77 Int
* A2
= readArray_int("A2",dimA
,3);
84 const mwSize dimPhi
[] = {dimPhiInit
[0], dimPhiInit
[1], dimPhiInit
[2], L
};
85 Real
* phi
= (Real
*)malloc(dimPhi
[0]*dimPhi
[1]*dimPhi
[2]*dimPhi
[3]*sizeof(Real
));
88 const mwSize dimRho
[] = {dimRhoInit
[0], dimRhoInit
[1], dimRhoInit
[2], L
};
89 Real
* rho
= (Real
*)malloc(dimRho
[0]*dimRho
[1]*dimRho
[2]*dimRho
[3]*sizeof(Real
));
92 const mwSize dimPi
[] = {k
, L
};
93 Real
* pi
= (Real
*)malloc(dimPi
[0]*dimPi
[1]*sizeof(Real
));
96 const mwSize dimLvraisemblance
[] = {L
, 2};
97 Real
* lvraisemblance
= (Real
*)malloc(dimLvraisemblance
[0]*dimLvraisemblance
[1]*sizeof(Real
));
99 /////////////////////////////////////////
100 // Call to constructionModelesLassoMLE //
101 /////////////////////////////////////////
103 constructionModelesLassoMLE(
104 phiInit
,rhoInit
,piInit
,gamInit
,mini
,maxi
,gamma
,glambda
,X
,Y
,seuil
,tau
,A1
,A2
,
105 phi
,rho
,pi
,lvraisemblance
,
118 // Compare to reference outputs
119 Real
* ref_phi
= readArray_real("phi",dimPhi
,4);
120 compareArray_real("phi", phi
, ref_phi
, dimPhi
[0]*dimPhi
[1]*dimPhi
[2]*dimPhi
[3]);
125 Real
* ref_rho
= readArray_real("rho",dimRho
,4);
126 compareArray_real("rho", rho
, ref_rho
, dimRho
[0]*dimRho
[1]*dimRho
[2]*dimRho
[3]);
131 Real
* ref_pi
= readArray_real("pi",dimPi
,2);
132 compareArray_real("pi", pi
, ref_pi
, dimPi
[0]*dimPi
[1]);
137 Real
* ref_lvraisemblance
= readArray_real("lvraisemblance",dimLvraisemblance
,2);
138 compareArray_real("lvraisemblance", lvraisemblance
, ref_lvraisemblance
, dimLvraisemblance
[0]*dimLvraisemblance
[1]);
139 free(lvraisemblance
);
140 free(ref_lvraisemblance
);