Commit | Line | Data |
---|---|---|
7b272073 | 1 | #include "constructionModelesLassoMLE.h" |
9ff729fb | 2 | #include "test_utils.h" |
46a2e676 BA |
3 | #include <stdlib.h> |
4 | ||
5 | #include <stdio.h> | |
7b272073 BA |
6 | |
7 | int main(int argc, char** argv) | |
8 | { | |
c3bc4705 | 9 | int* dimensions = readArray_int("dimensions"); |
7ea8c1e5 BA |
10 | int n = dimensions[0]; |
11 | int p = dimensions[1]; | |
12 | int m = dimensions[2]; | |
13 | int k = dimensions[3]; | |
14 | int L = dimensions[4]; | |
7b272073 | 15 | free(dimensions); |
7b272073 BA |
16 | |
17 | //////////// | |
18 | // INPUTS // | |
c3bc4705 BA |
19 | Real* phiInit = readArray_real("phiInit"); |
20 | Real* rhoInit = readArray_real("rhoInit"); | |
21 | Real* piInit = readArray_real("piInit"); | |
22 | Real* gamInit = readArray_real("gamInit"); | |
23 | int mini = read_int("mini"); | |
24 | int maxi = read_int("maxi"); | |
25 | Real gamma = read_real("gamma"); | |
26 | Real* glambda = readArray_real("glambda"); | |
27 | Real* X = readArray_real("X"); | |
28 | Real* Y = readArray_real("Y"); | |
29 | Real seuil = read_real("seuil"); | |
30 | Real tau = read_real("tau"); | |
31 | int* A1 = readArray_int("A1"); | |
32 | int* A2 = readArray_int("A2"); | |
7b272073 BA |
33 | //////////// |
34 | ||
7b272073 BA |
35 | ///////////// |
36 | // OUTPUTS // | |
c3bc4705 BA |
37 | Real* phi = (Real*)malloc(p*m*k*L*sizeof(Real)); |
38 | Real* rho = (Real*)malloc(m*m*k*L*sizeof(Real)); | |
39 | Real* pi = (Real*)malloc(k*L*sizeof(Real)); | |
40 | Real* llh = (Real*)malloc(L*2*sizeof(Real)); | |
7b272073 BA |
41 | ///////////// |
42 | ||
7b272073 BA |
43 | ///////////////////////////////////////// |
44 | // Call to constructionModelesLassoMLE // | |
46a2e676 | 45 | constructionModelesLassoMLE_core( |
7b272073 | 46 | phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,glambda,X,Y,seuil,tau,A1,A2, |
c3bc4705 | 47 | phi,rho,pi,llh, |
7b272073 | 48 | n,p,m,k,L); |
c3bc4705 BA |
49 | ///////////////////////////////////////// |
50 | ||
7b272073 BA |
51 | free(phiInit); |
52 | free(rhoInit); | |
53 | free(piInit); | |
54 | free(gamInit); | |
55 | free(X); | |
56 | free(Y); | |
57 | free(A1); | |
58 | free(A2); | |
59 | free(glambda); | |
c3bc4705 | 60 | |
7b272073 | 61 | // Compare to reference outputs |
46a2e676 | 62 | Real* ref_phi = readArray_real("phi"); |
c3bc4705 | 63 | compareArray_real("phi", phi, ref_phi, p*m*k*L); |
7b272073 BA |
64 | free(phi); |
65 | free(ref_phi); | |
c3bc4705 | 66 | |
46a2e676 | 67 | Real* ref_rho = readArray_real("rho"); |
c3bc4705 | 68 | compareArray_real("rho", rho, ref_rho, m*m*k*L); |
7b272073 BA |
69 | free(rho); |
70 | free(ref_rho); | |
c3bc4705 | 71 | |
46a2e676 | 72 | Real* ref_pi = readArray_real("pi"); |
c3bc4705 | 73 | compareArray_real("pi", pi, ref_pi, k*L); |
7b272073 BA |
74 | free(pi); |
75 | free(ref_pi); | |
c3bc4705 | 76 | |
46a2e676 | 77 | Real* ref_llh = readArray_real("llh"); |
c3bc4705 BA |
78 | compareArray_real("llh", llh, ref_llh, L*2); |
79 | free(llh); | |
80 | free(ref_llh); | |
7b272073 BA |
81 | |
82 | return 0; | |
83 | } |