2 #include "test_utils.h"
5 int main(int argc
, char** argv
)
7 int* dimensions
= readArray_int("dimensions");
10 int m
= dimensions
[2];
11 int k
= dimensions
[3];
16 Real
* phiInit
= readArray_real("phiInit");
17 Real
* rhoInit
= readArray_real("rhoInit");
18 Real
* piInit
= readArray_real("piInit");
19 Real
* gamInit
= readArray_real("gamInit");
20 int mini
= read_int("mini");
21 int maxi
= read_int("maxi");
22 Real gamma
= read_real("gamma");
23 Real lambda
= read_real("lambda");
24 Real
* X
= readArray_real("X");
25 Real
* Y
= readArray_real("Y");
26 Real tau
= read_real("tau");
31 Real
* phi
= (Real
*)malloc(p
*m
*k
*sizeof(Real
));
32 Real
* rho
= (Real
*)malloc(m
*m
*k
*sizeof(Real
));
33 Real
* pi
= (Real
*)malloc(k
*sizeof(Real
));
35 Real
* S
= (Real
*)malloc(p
*m
*k
*sizeof(Real
));
36 int* affec
= (int*)malloc(n
*sizeof(int));
41 EMGLLF_core(phiInit
,rhoInit
,piInit
,gamInit
,mini
,maxi
,gamma
,lambda
,X
,Y
,tau
,
42 phi
,rho
,pi
,&llh
,S
,affec
,
53 // Compare to reference outputs
54 Real
* ref_phi
= readArray_real("phi");
55 compareArray_real("phi", phi
, ref_phi
, p
*m
*k
);
59 Real
* ref_rho
= readArray_real("rho");
60 compareArray_real("rho", rho
, ref_rho
, m
*m
*k
);
64 Real
* ref_pi
= readArray_real("pi");
65 compareArray_real("pi", pi
, ref_pi
, k
);
69 Real ref_llh
= read_real("llh");
70 compareArray_real("llh", &llh
, &ref_llh
, 1);
72 Real
* ref_S
= readArray_real("S");
73 compareArray_real("S", S
, ref_S
, p
*m
*k
);
77 int* ref_affec
= readArray_int("affec");
78 compareArray_int("affec", affec
, ref_affec
, n
);