Commit | Line | Data |
---|---|---|
7b272073 | 1 | #include "EMGrank.h" |
150fa42c | 2 | #include "utils.h" |
7b272073 BA |
3 | |
4 | int main(int argc, char** argv) | |
5 | { | |
150fa42c | 6 | int* dimensions = readArray_int("dimensions"); |
7ea8c1e5 BA |
7 | int n = dimensions[0]; |
8 | int p = dimensions[1]; | |
9 | int m = dimensions[2]; | |
10 | int k = dimensions[3]; | |
7b272073 | 11 | free(dimensions); |
7b272073 BA |
12 | |
13 | //////////// | |
14 | // INPUTS // | |
15 | //////////// | |
16 | ||
150fa42c BA |
17 | float* Rho = readArray_real("Rho"); |
18 | float* Pi = readArray_real("Pi"); | |
19 | int mini = read_int("mini"); | |
20 | int maxi = read_int("maxi"); | |
21 | float* X = readArray_real("X"); | |
22 | float* Y = readArray_real("Y"); | |
23 | float tau = read_real("tau"); | |
24 | int* rank = readArray_int("rank"); | |
7b272073 BA |
25 | |
26 | ///////////// | |
27 | // OUTPUTS // | |
28 | ///////////// | |
29 | ||
150fa42c | 30 | float* phi = (float*)malloc(p*m*k*sizeof(float)); |
7ea8c1e5 | 31 | float* LLF = (float*)malloc(1*sizeof(float)); |
7b272073 BA |
32 | |
33 | ////////////////////////// | |
34 | // Main call to EMGrank // | |
35 | ////////////////////////// | |
36 | ||
37 | EMGrank(Pi,Rho,mini,maxi,X,Y,tau,rank, | |
38 | phi,LLF, | |
39 | n,p,m,k); | |
150fa42c | 40 | |
7b272073 BA |
41 | free(Rho); |
42 | free(Pi); | |
43 | free(X); | |
44 | free(Y); | |
45 | free(rank); | |
150fa42c | 46 | |
7b272073 | 47 | // Compare to reference outputs |
150fa42c BA |
48 | float* ref_phi = readArray_real("phi"); |
49 | compareArray_real("phi", phi, ref_phi, p*m*k); | |
7b272073 BA |
50 | free(phi); |
51 | free(ref_phi); | |
150fa42c | 52 | |
7b272073 | 53 | // LLF |
150fa42c | 54 | float* ref_LLF = readArray_real("LLF"); |
7b272073 BA |
55 | compareArray_real("LLF", LLF, ref_LLF, 1); |
56 | free(LLF); | |
57 | free(ref_LLF); | |
150fa42c | 58 | |
7b272073 BA |
59 | return 0; |
60 | } |