Commit | Line | Data |
---|---|---|
3f073c45 | 1 | testEMGLLF = function(){ |
f8a1fd7c | 2 | testFolder = 'data/' |
f8a1fd7c | 3 | |
3f073c45 BG |
4 | #get dimensions |
5 | dimensions = read.table(strcat(testFolder,'dimensions'), header=FALSE) | |
6 | n = dimensions[1] | |
7 | p = dimensions[2] | |
8 | m = dimensions[3] | |
9 | k = dimensions[4] | |
10 | ||
11 | #get all input arrays | |
12 | phiInit = read.table(strcat(testFolder,'phiInit'), header=FALSE) | |
13 | rhoInit = read.table(strcat(testFolder,'rhoInit'), header=FALSE) | |
14 | piInit = t(read.table(strcat(testFolder,'piInit'), header=FALSE)) | |
15 | gamInit = read.table(strcat(testFolder,'gamInit'), header=FALSE) | |
16 | mini = read.table(strcat(testFolder,'mini'), header=FALSE) | |
17 | maxi = read.table(strcat(testFolder,'maxi'), header=FALSE) | |
18 | gamma = read.table(strcat(testFolder,'gamma'), header=FALSE) | |
19 | lambda = read.table(strcat(testFolder,'lambda'), header=FALSE) | |
20 | X = rread.table(strcat(testFolder,'X'), header=FALSE) | |
21 | Y = read.table(strcat(testFolder,'Y'), header=FALSE) | |
22 | tau = read.table(strcat(testFolder,'tau'), header=FALSE) | |
23 | ||
24 | #run EMGLLF.c | |
f8a1fd7c BG |
25 | EMG = .Call("EMGLLF_core",phiInit,rhoInit,piInit1,gamInit,mini,maxi,gamma,lambda,X,Y,tau) |
26 | phi = EMG$phi | |
27 | rho = EMG$rho | |
28 | pi = EMG$pi | |
29 | LLF = EMG$LLF | |
30 | S = EMG$S | |
31 | ||
3f073c45 BG |
32 | #get all stored outputs |
33 | ref_phi =read.table(strcat(testFolder,'phi'), header=FALSE) | |
34 | ref_rho = read.table(strcat(testFolder,'rho'), header=FALSE) | |
35 | ref_pi = read.table(strcat(testFolder,'pi'), header=FALSE) | |
36 | ref_LLF = read.table(strcat(testFolder,'LLF'), header=FALSE) | |
37 | ref_S = read.table(strcat(testFolder,'S'), header=FALSE) | |
f8a1fd7c | 38 | |
3f073c45 | 39 | #check that output correspond to stored output |
f8a1fd7c BG |
40 | tol = 1e-5; |
41 | checkOutput('phi',phi,ref_phi,tol); | |
42 | checkOutput('rho',rho,ref_rho,tol); | |
43 | checkOutput('pi',pi,ref_pi,tol); | |
44 | checkOutput('LLF',LLF,ref_LLF,tol); | |
45 | checkOutput('S',S,ref_S,tol); | |
46 | } |