Commit | Line | Data |
---|---|---|
7b272073 | 1 | #include "constructionModelesLassoRank.h" |
9ff729fb | 2 | #include "test_utils.h" |
c3bc4705 | 3 | #include <stdlib.h> |
7b272073 BA |
4 | |
5 | int main(int argc, char** argv) | |
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); |
7b272073 BA |
14 | |
15 | //////////// | |
16 | // INPUTS // | |
c3bc4705 BA |
17 | Real* Pi = readArray_real("Pi"); |
18 | Real* Rho = readArray_real("Rho"); | |
19 | int mini = read_int("mini"); | |
20 | int maxi = read_int("maxi"); | |
21 | Real* X = readArray_real("X"); | |
22 | Real* Y = readArray_real("Y"); | |
23 | Real tau = read_real("tau"); | |
24 | int* A1 = readArray_int("A1"); | |
25 | int rangmin = read_int("rangmin"); | |
26 | int rangmax = read_int("rangmax"); | |
7b272073 BA |
27 | //////////// |
28 | ||
7b272073 BA |
29 | ///////////// |
30 | // OUTPUTS // | |
7ea8c1e5 | 31 | int Size = (int)pow(rangmax-rangmin+1, k); |
c3bc4705 BA |
32 | Real* phi = (Real*)malloc(p*m*k*L*Size*sizeof(Real)); |
33 | Real* llh = (Real*)malloc(L*Size*2*sizeof(Real)); | |
34 | ///////////// | |
7b272073 | 35 | |
c3bc4705 BA |
36 | ///////////////////////////////////////// |
37 | // Call to constructionModelesLassoMLE // | |
38 | constructionModelesLassoRank_core( | |
7b272073 | 39 | Pi,Rho,mini,maxi,X,Y,tau,A1,rangmin,rangmax, |
c3bc4705 | 40 | phi,llh, |
7b272073 | 41 | n,p,m,k,L); |
c3bc4705 BA |
42 | ///////////////////////////////////////// |
43 | ||
7b272073 BA |
44 | free(Rho); |
45 | free(Pi); | |
46 | free(X); | |
47 | free(Y); | |
48 | free(A1); | |
c3bc4705 | 49 | |
7b272073 | 50 | // Compare to reference outputs |
c3bc4705 BA |
51 | Real* ref_phi = readArray_real("phi"); |
52 | compareArray_real("phi", phi, ref_phi, p*m*k*L*Size); | |
7b272073 BA |
53 | free(phi); |
54 | free(ref_phi); | |
c3bc4705 BA |
55 | |
56 | Real* ref_llh = readArray_real("llh"); | |
57 | compareArray_real("llh", llh, ref_llh, L*Size*2); | |
58 | free(llh); | |
59 | free(ref_llh); | |
60 | ||
7b272073 BA |
61 | return 0; |
62 | } |