From: Benjamin Goehry Date: Fri, 13 Jan 2017 17:43:06 +0000 (+0100) Subject: correction testEMGLLF.R X-Git-Url: https://git.auder.net/variants/Chakart/css/doc/html/index.css?a=commitdiff_plain;h=3f073c45246e3d393510a786dbacb8d29dc536bb;p=valse.git correction testEMGLLF.R --- diff --git a/src/test/TEST R/testEMGLLF.R b/src/test/TEST R/testEMGLLF.R index c2f109f..0eb3483 100644 --- a/src/test/TEST R/testEMGLLF.R +++ b/src/test/TEST R/testEMGLLF.R @@ -1,7 +1,27 @@ -testEMGLLF = function(n,p,m,k, phiInit, rhoInit, gamInit, mini, maxi, gamma, lambda, X, Y, tau, ref_phi, ref_rho, ref_pi, ref_LLf, ref_S){ +testEMGLLF = function(){ testFolder = 'data/' - delimiter = '\n' + #get dimensions + dimensions = read.table(strcat(testFolder,'dimensions'), header=FALSE) + n = dimensions[1] + p = dimensions[2] + m = dimensions[3] + k = dimensions[4] + + #get all input arrays + phiInit = read.table(strcat(testFolder,'phiInit'), header=FALSE) + rhoInit = read.table(strcat(testFolder,'rhoInit'), header=FALSE) + piInit = t(read.table(strcat(testFolder,'piInit'), header=FALSE)) + gamInit = read.table(strcat(testFolder,'gamInit'), header=FALSE) + mini = read.table(strcat(testFolder,'mini'), header=FALSE) + maxi = read.table(strcat(testFolder,'maxi'), header=FALSE) + gamma = read.table(strcat(testFolder,'gamma'), header=FALSE) + lambda = read.table(strcat(testFolder,'lambda'), header=FALSE) + X = rread.table(strcat(testFolder,'X'), header=FALSE) + Y = read.table(strcat(testFolder,'Y'), header=FALSE) + tau = read.table(strcat(testFolder,'tau'), header=FALSE) + + #run EMGLLF.c EMG = .Call("EMGLLF_core",phiInit,rhoInit,piInit1,gamInit,mini,maxi,gamma,lambda,X,Y,tau) phi = EMG$phi rho = EMG$rho @@ -9,7 +29,14 @@ testEMGLLF = function(n,p,m,k, phiInit, rhoInit, gamInit, mini, maxi, gamma, lam LLF = EMG$LLF S = EMG$S + #get all stored outputs + ref_phi =read.table(strcat(testFolder,'phi'), header=FALSE) + ref_rho = read.table(strcat(testFolder,'rho'), header=FALSE) + ref_pi = read.table(strcat(testFolder,'pi'), header=FALSE) + ref_LLF = read.table(strcat(testFolder,'LLF'), header=FALSE) + ref_S = read.table(strcat(testFolder,'S'), header=FALSE) + #check that output correspond to stored output tol = 1e-5; checkOutput('phi',phi,ref_phi,tol); checkOutput('rho',rho,ref_rho,tol);