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