From: Benjamin Auder Date: Sat, 18 Mar 2017 01:51:02 +0000 (+0100) Subject: Rename EMGLLF and EMGrank with suffix _R in generate_tests/. X-Git-Url: https://git.auder.net/doc/html/R.css?a=commitdiff_plain;h=f72448157e2ca194959adcffced29448fbb1bb74;p=valse.git Rename EMGLLF and EMGrank with suffix _R in generate_tests/. Reason: these files will be run in an environment with valse loaded, so there might (will) be conflicts with pkg EMGLLF/EMGrank --- diff --git a/test/generate_test_data/EMGLLF.R b/test/generate_test_data/EMGLLF.R index 374b843..41eb7cf 100644 --- a/test/generate_test_data/EMGLLF.R +++ b/test/generate_test_data/EMGLLF.R @@ -1,4 +1,4 @@ -EMGLLF = function(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,lambda,X,Y,tau) +EMGLLF_R = function(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,lambda,X,Y,tau) { #matrix dimensions n = dim(X)[1] @@ -30,7 +30,7 @@ EMGLLF = function(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,lambda,X,Y,tau) Gam = matrix(0, n,k) EPS = 1E-15 - while(ite <= mini || (ite<= maxi && (dist>= tau || dist2 >= sqrt(tau)))) + while(ite <= mini || (ite <= maxi && (dist >= tau || dist2 >= sqrt(tau)))) { Phi = phi Rho = rho diff --git a/test/generate_test_data/EMGrank.R b/test/generate_test_data/EMGrank.R index 346916b..c4576e4 100644 --- a/test/generate_test_data/EMGrank.R +++ b/test/generate_test_data/EMGrank.R @@ -1,4 +1,5 @@ #helper to always have matrices as arg (TODO: put this elsewhere? improve?) +# --> Yes, we should use by-columns storage everywhere... [later!] matricize <- function(X) { if (!is.matrix(X)) @@ -7,7 +8,7 @@ matricize <- function(X) } require(MASS) -EMGrank = function(Pi, Rho, mini, maxi, X, Y, tau, rank) +EMGrank_R = function(Pi, Rho, mini, maxi, X, Y, tau, rank) { #matrix dimensions n = dim(X)[1] diff --git a/test/generate_test_data/generateRunSaveTest_EMGLLF.R b/test/generate_test_data/generateRunSaveTest_EMGLLF.R index fe8f847..77c0e71 100644 --- a/test/generate_test_data/generateRunSaveTest_EMGLLF.R +++ b/test/generate_test_data/generateRunSaveTest_EMGLLF.R @@ -36,7 +36,7 @@ generateRunSaveTest_EMGLLF = function(n=200, p=15, m=10, k=3, mini=5, maxi=10, write.table(as.integer(c(n,p,m,k)), paste(testFolder,"dimensions",sep=""), row.names=F, col.names=F) - res = EMGLLF(params$phiInit,params$rhoInit,params$piInit,params$gamInit,mini,maxi, + res = EMGLLF_R(params$phiInit,params$rhoInit,params$piInit,params$gamInit,mini,maxi, gamma,lambda,xy$X,xy$Y,tau) #save outputs diff --git a/test/generate_test_data/generateRunSaveTest_EMGrank.R b/test/generate_test_data/generateRunSaveTest_EMGrank.R index 99da9bc..f75c8d1 100644 --- a/test/generate_test_data/generateRunSaveTest_EMGrank.R +++ b/test/generate_test_data/generateRunSaveTest_EMGrank.R @@ -33,7 +33,7 @@ generateRunSaveTest_EMGrank = function(n=200, p=15, m=10, k=3, mini=5, maxi=10, write.table(as.integer(c(n,p,m,k)), paste(testFolder,"dimensions",sep=""), row.names=F, col.names=F) - res = EMGrank(pi,rho,mini,maxi,xy$X,xy$Y,tau,rank) + res = EMGrank_R(pi,rho,mini,maxi,xy$X,xy$Y,tau,rank) #save output write.table(as.double(res$phi), paste(testFolder,"phi",sep=""), row.names=F,col.names=F)