%profile clear
 %% Initialize
clearvars
%profile on

densityS = 0.01;   % density for S(sampled) in Z=L+S for generating the data
numProbs = 20;    % number of problems
%filenamealm = 'table_noiseless26alm.tex';
%%%% do we have all these variables?????
opts.verbose = 0;
opts.maxsize = 10*(r+1)+20;
opts.itergrow = 5;
opts.orig = 0; % set to 1 to use the original low rank for testing 
opts.tolrankp = 1e-8;
opts.tolrankq = 1e-8; % tolerance for rank to get exposing vectors.
opts.randseed = 1;
opts.fr = 1;
opts.alm = 1;
%opts.seed = randi(1000); % seed for random data
%opts.muu = 3; % muu for the L + muu*S  ???????? need as function of m,n???
opts.redrank = 0; % 1 then reduce the rank of exposing vector by 1
opts.densityS = densityS;
opts.tolpalm = 1e-8;   
opts.palmlimit = 500;
opts.palmretol = 1e-3;
opts.model = 1; % model 0 means only low rank model 
opts.spn = 1; % 1 means nullspace for sparse matrix
opts.apv = 0; 
%PP = [];% density for sammpling
rng shuffle
rng(63);
%%% Small problems, increasing size
filename = 'table_noiseless631.tex';
r = 2; % target rank for generating the data
minclique = [r+3;r+3];
nn = [2100;3000;]; % size of each problem not change
mm = [2100;3000;];%1200;1500;1800;2100]; % size of each problem not change
PP = [0.2;0.2];%0.2;0.2;0.2;0.2]; % density for the sampled data
%muu = [1./(0.2.*sqrt(nn));]%10;15;15;15;];
muu = 0.2./(PP.*sqrt(nn));
Rrun_testnoiseless(r, densityS, nn, mm,minclique,  PP, muu,numProbs, filename, opts);


filename = 'table_noiseless632.tex';
r = 3;
minclique = [r+2;r+2;r+3;r+3;r+3;r+3];
nn = [600;1000;1000;1000;2000;2000]; % size of each problem not change
mm = [600;1000;1000;1000;2000;2000];%1200;1500;1800;2100]; % size of each problem not change
PP = [0.25;0.25;0.4;0.6;0.3;0.45];%0.2;0.2;0.2;0.2]; % density for the sampled data
%muu = [1./(0.2.*sqrt(nn));]%10;15;15;15;];
muu = 0.2./(PP.*sqrt(nn));
Rrun_testnoiseless(r, densityS, nn, mm,minclique,  PP, muu,numProbs, filename, opts);


filename = 'table_noiseless633.tex';
r = 4;
minclique = [r+2;r+2;r+2;r+2;];
nn = [500;500;500;500]; % size of each problem not change
mm = [500;500;500;500];%1200;1500;1800;2100]; % size of each problem not change
PP = [0.4;0.45;0.6;0.7];
muu = 0.2./(PP.*sqrt(nn));
Rrun_testnoiseless(r, densityS, nn, mm,minclique,  PP, muu,numProbs, filename, opts);


filename = 'table_noiseless634.tex';
r = 5;
minclique = [r+2;r+2;r+2;r+2;];
nn = [1000;1000;2000;2000]; % size of each problem not change
mm = [1000;1000;2000;2000];%1200;1500;1800;2100]; % size of each problem not change
PP = [0.45;0.5;0.35;0.4];
muu = 0.2./(PP.*sqrt(nn));
Rrun_testnoiseless(r, densityS, nn, mm,minclique,  PP, muu,numProbs, filename, opts);

%% Run tests

%%%%%%%%%%%%%%%Data generating for ALM comparison


%profile report
 %%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%
 
%profile on


 


