Skip to content
Snippets Groups Projects
Verified Commit 60a8e504 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

write_table_short.m: factorization

Also do not duplicate stack_solve_algo values, rather pass them as an argument.
parent cd2bcad5
No related branches found
No related tags found
1 merge request!1stack_solve_algo={2,3} now work in unstable without block nor bytecode
...@@ -53,7 +53,7 @@ run_simulations(MODEL, stack_solve_algo, static_solve_algo, niter, ccrit); ...@@ -53,7 +53,7 @@ run_simulations(MODEL, stack_solve_algo, static_solve_algo, niter, ccrit);
texname = sprintf('%s-%s', MODEL, lower(regexprep(char(java.net.InetAddress.getLocalHost.getHostName),'.local\>',''))); % TODO: Check if we need a trap for Octave. texname = sprintf('%s-%s', MODEL, lower(regexprep(char(java.net.InetAddress.getLocalHost.getHostName),'.local\>',''))); % TODO: Check if we need a trap for Octave.
write_table_short(sprintf('simulations-%s.mat', MODEL), texname, nopng) write_table_short(sprintf('simulations-%s.mat', MODEL), texname, nopng, stack_solve_algo)
% Delete files and subfolders % Delete files and subfolders
delete(sprintf('%s.log', MODEL)) delete(sprintf('%s.log', MODEL))
......
function write_table_short(datafile, texfilename, nopng) function write_table_short(datafile, texfilename, nopng, stack_solve_algo)
% Produce a table of results with LaTex compiled as a pdf file and converted to a png file. % Produce a table of results with LaTex compiled as a pdf file and converted to a png file.
% %
...@@ -15,12 +15,9 @@ if nargin<3 ...@@ -15,12 +15,9 @@ if nargin<3
nopng = true; nopng = true;
end end
stack_solve_algo = [0, 1, 2, 3, 4, 5];
id = 1:length(stack_solve_algo);
cfolder = pwd; cfolder = pwd;
load(datafile); D = load(datafile); % Must be in a local variable since we have a nested function below
[folder,~, ~] = fileparts(mfilename('fullpath')); [folder,~, ~] = fileparts(mfilename('fullpath'));
idf = strfind(folder, filesep()); idf = strfind(folder, filesep());
...@@ -29,82 +26,48 @@ fid = fopen(sprintf('%stables/template-short.tex', rootfolder),'r'); ...@@ -29,82 +26,48 @@ fid = fopen(sprintf('%stables/template-short.tex', rootfolder),'r');
T = fread(fid, '*char')'; T = fread(fid, '*char')';
fclose(fid); fclose(fid);
function replace_template_field(field_name, value)
if ~isnan(value)
switch value
case -1
T = strrep(T, field_name, 'crash'); % code crash
case -2
T = strrep(T, field_name, 'FAIL'); % algorithm did not converge
case -3
T = strrep(T, field_name, 'CRASH'); % matlab crash
case -10
T = strrep(T, field_name, 'NA'); % not available
otherwise
T = strrep(T, field_name, int2str(value));
end
end
end
% %
% Matlab % Matlab
% %
for algo = stack_solve_algo for algo = stack_solve_algo
if ~isnan(MATLAB_computing(id(stack_solve_algo==algo), 1)) replace_template_field(sprintf('{a%u_mat}', algo), D.MATLAB_computing(find(stack_solve_algo==algo), 1));
switch MATLAB_computing(id(stack_solve_algo==algo), 1)
case -1
T = strrep(T, sprintf('{a%u_mat}', algo), 'crash'); % code crash
case -2
T = strrep(T, sprintf('{a%u_mat}', algo), 'FAIL'); % algorithm did not converge
case -3
T = strrep(T, sprintf('{a%u_mat}', algo), 'CRASH'); % matlab crash
case -10
T = strrep(T, sprintf('{a%u_mat}', algo), 'NA'); % not available
otherwise
T = strrep(T, sprintf('{a%u_mat}', algo), int2str(MATLAB_computing(id(stack_solve_algo==algo), 1)));
end
end
end end
% %
% use_dll % use_dll
% %
for algo = stack_solve_algo for algo = stack_solve_algo
if ~isnan(USE_DLL_computing(id(stack_solve_algo==algo), 1)) replace_template_field(sprintf('{a%u_dll}', algo), D.USE_DLL_computing(find(stack_solve_algo==algo), 1));
switch USE_DLL_computing(id(stack_solve_algo==algo), 1)
case -1
T = strrep(T, sprintf('{a%u_dll}', algo), 'crash');
case -2
T = strrep(T, sprintf('{a%u_dll}', algo), 'FAIL');
case -3
T = strrep(T, sprintf('{a%u_dll}', algo), 'CRASH');
case -10
T = strrep(T, sprintf('{a%u_dll}', algo), 'NA');
otherwise
T = strrep(T, sprintf('{a%u_dll}', algo), int2str(USE_DLL_computing(id(stack_solve_algo==algo), 1)));
end
end
end end
% %
% Bytecode % Bytecode
% %
for algo = stack_solve_algo for algo = stack_solve_algo
if ~isnan(BYTECODE_computing(id(stack_solve_algo==algo), 1)) replace_template_field(sprintf('{a%u_byt}', algo), D.BYTECODE_computing(find(stack_solve_algo==algo), 1));
switch BYTECODE_computing(id(stack_solve_algo==algo), 1)
case -1
T = strrep(T, sprintf('{a%u_byt}', algo), 'crash');
case -2
T = strrep(T, sprintf('{a%u_byt}', algo), 'FAIL');
case -3
T = strrep(T, sprintf('{a%u_byt}', algo), 'CRASH');
case -10
T = strrep(T, sprintf('{a%u_byt}', algo), 'NA');
otherwise
T = strrep(T, sprintf('{a%u_byt}', algo), int2str(BYTECODE_computing(id(stack_solve_algo==algo), 1)));
end
end
end end
% %
% Matlab with blocks % Matlab with blocks
% %
for mfs = 0:3 for mfs = 0:3
for algo = stack_solve_algo for algo = stack_solve_algo
if ~isnan(MATLAB_WITH_BLOCKS_computing(id(stack_solve_algo==algo), mfs+1)) replace_template_field(sprintf('{a%u_mat_blk_%u}', algo, mfs), ...
switch MATLAB_WITH_BLOCKS_computing(id(stack_solve_algo==algo), mfs+1) D.MATLAB_WITH_BLOCKS_computing(find(stack_solve_algo==algo), mfs+1));
case -1
T = strrep(T, sprintf('{a%u_mat_blk_%u}', algo, mfs), 'crash');
case -2
T = strrep(T, sprintf('{a%u_mat_blk_%u}', algo, mfs), 'FAIL');
case -3
T = strrep(T, sprintf('{a%u_mat_blk_%u}', algo, mfs), 'CRASH');
case -10
T = strrep(T, sprintf('{a%u_mat_blk_%u}', algo, mfs), 'NA');
otherwise
T = strrep(T, sprintf('{a%u_mat_blk_%u}', algo, mfs), int2str(MATLAB_WITH_BLOCKS_computing(id(stack_solve_algo==algo), mfs+1)));
end
end
end end
end end
% %
...@@ -112,20 +75,8 @@ end ...@@ -112,20 +75,8 @@ end
% %
for mfs = 0:3 for mfs = 0:3
for algo = stack_solve_algo for algo = stack_solve_algo
if ~isnan(USE_DLL_WITH_BLOCKS_computing(id(stack_solve_algo==algo), mfs+1)) replace_template_field(sprintf('{a%u_dll_blk_%u}', algo, mfs), ...
switch USE_DLL_WITH_BLOCKS_computing(id(stack_solve_algo==algo), mfs+1) D.USE_DLL_WITH_BLOCKS_computing(find(stack_solve_algo==algo), mfs+1));
case -1
T = strrep(T, sprintf('{a%u_dll_blk_%u}', algo, mfs), 'crash');
case -2
T = strrep(T, sprintf('{a%u_dll_blk_%u}', algo, mfs), 'FAIL');
case -3
T = strrep(T, sprintf('{a%u_dll_blk_%u}', algo, mfs), 'CRASH');
case -10
T = strrep(T, sprintf('{a%u_dll_blk_%u}', algo, mfs), 'NA');
otherwise
T = strrep(T, sprintf('{a%u_dll_blk_%u}', algo, mfs), int2str(USE_DLL_WITH_BLOCKS_computing(id(stack_solve_algo==algo), mfs+1)));
end
end
end end
end end
% %
...@@ -133,20 +84,8 @@ end ...@@ -133,20 +84,8 @@ end
% %
for mfs = 0:3 for mfs = 0:3
for algo = stack_solve_algo for algo = stack_solve_algo
if ~isnan(BYTECODE_WITH_BLOCKS_computing(id(stack_solve_algo==algo), mfs+1)) replace_template_field(sprintf('{a%u_byt_blk_%u}', algo, mfs), ...
switch BYTECODE_WITH_BLOCKS_computing(id(stack_solve_algo==algo), mfs+1) D.BYTECODE_WITH_BLOCKS_computing(find(stack_solve_algo==algo), mfs+1));
case -1
T = strrep(T, sprintf('{a%u_byt_blk_%u}', algo, mfs), 'crash');
case -2
T = strrep(T, sprintf('{a%u_byt_blk_%u}', algo, mfs), 'FAIL');
case -3
T = strrep(T, sprintf('{a%u_byt_blk_%u}', algo, mfs), 'CRASH');
case -10
T = strrep(T, sprintf('{a%u_byt_blk_%u}', algo, mfs), 'NA');
otherwise
T = strrep(T, sprintf('{a%u_byt_blk_%u}', algo, mfs), int2str(BYTECODE_WITH_BLOCKS_computing(id(stack_solve_algo==algo), mfs+1)));
end
end
end end
end end
...@@ -178,3 +117,5 @@ cd(sprintf('%stables', rootfolder)); ...@@ -178,3 +117,5 @@ cd(sprintf('%stables', rootfolder));
system(sprintf('rm %s.log', texfilename)); system(sprintf('rm %s.log', texfilename));
system(sprintf('rm %s.aux', texfilename)); system(sprintf('rm %s.aux', texfilename));
cd(cfolder); cd(cfolder);
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment