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