correction testEMGLLF.R
[valse.git] / src / test / OLD_TEST_MATLAB / generateRunSaveTest_selectiontotale.m
... / ...
CommitLineData
1function[] = generateRunSaveTest_selectiontotale(n, p, m, k, mini, maxi, gamma, glambda, varargin)
2
3 %set defaults for optional inputs
4 optargs = {200 15 10 3 5 10 1.0 [0.0,0.01,0.02,0.03,0.05,0.1,0.2,0.3,0.5,0.7,0.85,0.99]};
5 %replace defaults by user parameters
6 optargs(1:length(varargin)) = varargin;
7 [n, p, m, k, mini, maxi, gamma, glambda] = optargs{:};
8 tau = 1e-6;
9 seuil = 1e-15;
10 mini = int64(mini);
11 maxi = int64(maxi);
12 L = length(glambda);
13
14 %Generate phiInit,piInit,...
15 [phiInit,rhoInit,piInit,gamInit] = basicInitParameters(n, p, m, k);
16
17 %Generate X and Y
18 [X, Y, ~] = generateIOdefault(n, p, m, k);
19
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
22 testFolder = 'data/';
23 mkdir(testFolder);
24 delimiter = '\n';
25
26 %save inputs
27 dlmwrite(strcat(testFolder,'phiInit'), reshape(phiInit,1,[]), delimiter);
28 dlmwrite(strcat(testFolder,'rhoInit'), reshape(rhoInit,1,[]), delimiter);
29 dlmwrite(strcat(testFolder,'piInit'), piInit, delimiter);
30 dlmwrite(strcat(testFolder,'gamInit'), reshape(gamInit,1,[]), delimiter);
31 dlmwrite(strcat(testFolder,'mini'), mini, delimiter);
32 dlmwrite(strcat(testFolder,'maxi'), maxi, delimiter);
33 dlmwrite(strcat(testFolder,'gamma'), gamma, delimiter);
34 dlmwrite(strcat(testFolder,'glambda'), glambda, delimiter);
35 dlmwrite(strcat(testFolder,'X'), reshape(X,1,[]), delimiter);
36 dlmwrite(strcat(testFolder,'Y'), reshape(Y,1,[]), delimiter);
37 dlmwrite(strcat(testFolder,'seuil'), seuil, delimiter);
38 dlmwrite(strcat(testFolder,'tau'), tau, delimiter);
39 dlmwrite(strcat(testFolder,'dimensions'), [n,p,m,k,L], delimiter);
40
41 [A1,A2,Rho,Pi] = selectiontotale(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,glambda,X,Y,seuil,tau);
42
43 %save output
44 dlmwrite(strcat(testFolder,'A1'), reshape(A1,1,[]), delimiter);
45 dlmwrite(strcat(testFolder,'A2'), reshape(A2,1,[]), delimiter);
46 dlmwrite(strcat(testFolder,'Rho'), reshape(Rho,1,[]), delimiter);
47 dlmwrite(strcat(testFolder,'Pi'), reshape(Pi,1,[]), delimiter);
48
49end