X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=pkg%2Fsrc%2Fsources%2FEMGLLF.c;h=d9f92c049745c1304b1852df9f509c18a841a308;hb=23b9fb13bc6e82d7ca43bfb83aa85b6cd69c52c0;hp=a57a37962ca2000f09117d2a362f1b9e1d9582b5;hpb=2e813ad23c796bbed3d5ba685b8fa002bdc6689d;p=valse.git diff --git a/pkg/src/sources/EMGLLF.c b/pkg/src/sources/EMGLLF.c index a57a379..d9f92c0 100644 --- a/pkg/src/sources/EMGLLF.c +++ b/pkg/src/sources/EMGLLF.c @@ -39,6 +39,7 @@ void EMGLLF_core( //Other local variables: same as in R Real* gam = (Real*)malloc(n*k*sizeof(Real)); + Real* logGam = (Real*)malloc(k*sizeof(Real)); copyArray(gamInit, gam, n*k); Real* Gram2 = (Real*)malloc(p*p*k*sizeof(Real)); Real* ps2 = (Real*)malloc(p*m*k*sizeof(Real)); @@ -47,7 +48,6 @@ void EMGLLF_core( Real* Y2 = (Real*)malloc(n*m*k*sizeof(Real)); *llh = -INFINITY; Real* pi2 = (Real*)malloc(k*sizeof(Real)); - const Real EPS = 1e-15; // Additional (not at this place, in R file) Real* gam2 = (Real*)malloc(k*sizeof(Real)); Real* sqNorm2 = (Real*)malloc(k*sizeof(Real)); @@ -61,7 +61,7 @@ void EMGLLF_core( Real* Rho = (Real*)malloc(m*m*k*sizeof(Real)); Real* Pi = (Real*)malloc(k*sizeof(Real)); - for (int ite=0; ite EPS) //else: gam[i,] is already ~=0 + Real norm_fact = 0.; + for (int r=0; r