Testsuite: remove useless debug mode from several .m tests
The output is always useful (and even needed in case of test failure).remove-priordens
parent
742a3101b1
commit
56ed5bff43
|
@ -1,5 +1,3 @@
|
||||||
debug = false;
|
|
||||||
|
|
||||||
source_dir = getenv('source_root');
|
source_dir = getenv('source_root');
|
||||||
addpath([source_dir filesep 'matlab']);
|
addpath([source_dir filesep 'matlab']);
|
||||||
|
|
||||||
|
@ -7,10 +5,8 @@ dynare_config;
|
||||||
|
|
||||||
testFailed = 0;
|
testFailed = 0;
|
||||||
|
|
||||||
if ~debug
|
skipline()
|
||||||
skipline()
|
disp('*** TESTING: cyclereduction.m ***');
|
||||||
disp('*** TESTING: cyclereduction.m ***');
|
|
||||||
end
|
|
||||||
|
|
||||||
matlab_cr_path = [source_dir filesep 'matlab' filesep 'missing' filesep 'mex' filesep 'cycle_reduction'];
|
matlab_cr_path = [source_dir filesep 'matlab' filesep 'missing' filesep 'mex' filesep 'cycle_reduction'];
|
||||||
addpath(matlab_cr_path);
|
addpath(matlab_cr_path);
|
||||||
|
@ -37,15 +33,11 @@ try
|
||||||
R = norm(C+B*X1+A*X1*X1,1);
|
R = norm(C+B*X1+A*X1*X1,1);
|
||||||
if (R > cvg_tol)
|
if (R > cvg_tol)
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Matlab cycle_reduction solution is wrong')
|
||||||
dprintf('Matlab cycle_reduction solution is wrong')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Matlab cycle_reduction failed')
|
||||||
dprintf('Matlab cycle_reduction failed')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% 2. Solve the equation with the Fortran cycle reduction algorithm
|
% 2. Solve the equation with the Fortran cycle reduction algorithm
|
||||||
|
@ -56,36 +48,28 @@ try
|
||||||
R = norm(C+B*X2+A*X2*X2,1);
|
R = norm(C+B*X2+A*X2*X2,1);
|
||||||
if (R > cvg_tol)
|
if (R > cvg_tol)
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Fortran cycle_reduction solution is wrong')
|
||||||
dprintf('Fortran cycle_reduction solution is wrong')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Fortran cycle_reduction failed')
|
||||||
dprintf('Fortran cycle_reduction failed')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% 3. Compare solutions of the Fortran and Matlab routines
|
% 3. Compare solutions of the Fortran and Matlab routines
|
||||||
if (norm(X1 - X2, 1) > cvg_tol)
|
if (norm(X1 - X2, 1) > cvg_tol)
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Fortran and Matlab cycle reduction solutions differ');
|
||||||
dprintf('Fortran and Matlab cycle reduction solutions differ');
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% Compare the Fortran and Matlab execution time
|
% Compare the Fortran and Matlab execution time
|
||||||
if debug
|
if tElapsed1<tElapsed2
|
||||||
if tElapsed1<tElapsed2
|
skipline()
|
||||||
skipline()
|
dprintf('Matlab cyclic reduction is %5.2f times faster than its Fortran counterpart.', tElapsed2/tElapsed1)
|
||||||
dprintf('Matlab cyclic reduction is %5.2f times faster than its Fortran counterpart.', tElapsed2/tElapsed1)
|
skipline()
|
||||||
skipline()
|
else
|
||||||
else
|
skipline()
|
||||||
skipline()
|
dprintf('Fortran cyclic reduction is %5.2f times faster than its Matlab counterpart.', tElapsed1/tElapsed2)
|
||||||
dprintf('Fortran cyclic reduction is %5.2f times faster than its Matlab counterpart.', tElapsed1/tElapsed2)
|
skipline()
|
||||||
skipline()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
t1 = clock;
|
t1 = clock;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
debug = false;
|
|
||||||
|
|
||||||
source_dir = getenv('source_root');
|
source_dir = getenv('source_root');
|
||||||
addpath([source_dir filesep 'matlab']);
|
addpath([source_dir filesep 'matlab']);
|
||||||
|
|
||||||
|
@ -7,10 +5,8 @@ dynare_config;
|
||||||
|
|
||||||
testFailed = 0;
|
testFailed = 0;
|
||||||
|
|
||||||
if ~debug
|
skipline()
|
||||||
skipline()
|
disp('*** TESTING: logarithmicreduction.m ***');
|
||||||
disp('*** TESTING: logarithmicreduction.m ***');
|
|
||||||
end
|
|
||||||
|
|
||||||
matlab_cr_path = [source_dir filesep 'matlab' filesep 'missing' filesep 'mex' filesep 'logarithmic_reduction'];
|
matlab_cr_path = [source_dir filesep 'matlab' filesep 'missing' filesep 'mex' filesep 'logarithmic_reduction'];
|
||||||
addpath(matlab_cr_path);
|
addpath(matlab_cr_path);
|
||||||
|
@ -37,15 +33,11 @@ try
|
||||||
R = norm(C+B*X1+A*X1*X1,1);
|
R = norm(C+B*X1+A*X1*X1,1);
|
||||||
if (R > cvg_tol)
|
if (R > cvg_tol)
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Matlab logarithmic_reduction solution is wrong')
|
||||||
dprintf('Matlab logarithmic_reduction solution is wrong')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Matlab logarithmic_reduction failed')
|
||||||
dprintf('Matlab logarithmic_reduction failed')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% 2. Solve the equation with the Fortran logarithmic reduction algorithm
|
% 2. Solve the equation with the Fortran logarithmic reduction algorithm
|
||||||
|
@ -56,36 +48,28 @@ try
|
||||||
R = norm(C+B*X2+A*X2*X2,1);
|
R = norm(C+B*X2+A*X2*X2,1);
|
||||||
if (R > cvg_tol)
|
if (R > cvg_tol)
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Fortran logarithmic_reduction solution is wrong')
|
||||||
dprintf('Fortran logarithmic_reduction solution is wrong')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Fortran logarithmic_reduction failed')
|
||||||
dprintf('Fortran logarithmic_reduction failed')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% 3. Compare solutions of the Fortran and Matlab routines
|
% 3. Compare solutions of the Fortran and Matlab routines
|
||||||
if (norm(X1 - X2, 1) > cvg_tol)
|
if (norm(X1 - X2, 1) > cvg_tol)
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Fortran and Matlab logarithmic reduction solutions differ');
|
||||||
dprintf('Fortran and Matlab logarithmic reduction solutions differ');
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% Compare the Fortran and Matlab execution time
|
% Compare the Fortran and Matlab execution time
|
||||||
if debug
|
if tElapsed1<tElapsed2
|
||||||
if tElapsed1<tElapsed2
|
skipline()
|
||||||
skipline()
|
dprintf('Matlab logarithmic reduction is %5.2f times faster than its Fortran counterpart.', tElapsed2/tElapsed1)
|
||||||
dprintf('Matlab logarithmic reduction is %5.2f times faster than its Fortran counterpart.', tElapsed2/tElapsed1)
|
skipline()
|
||||||
skipline()
|
else
|
||||||
else
|
skipline()
|
||||||
skipline()
|
dprintf('Fortran logarithmic reduction is %5.2f times faster than its Matlab counterpart.', tElapsed1/tElapsed2)
|
||||||
dprintf('Fortran logarithmic reduction is %5.2f times faster than its Matlab counterpart.', tElapsed1/tElapsed2)
|
skipline()
|
||||||
skipline()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
t1 = clock;
|
t1 = clock;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
debug = false;
|
|
||||||
|
|
||||||
source_dir = getenv('source_root');
|
source_dir = getenv('source_root');
|
||||||
addpath([source_dir filesep 'matlab']);
|
addpath([source_dir filesep 'matlab']);
|
||||||
|
|
||||||
|
@ -9,10 +7,8 @@ cd solver-test-functions
|
||||||
|
|
||||||
testFailed = 0;
|
testFailed = 0;
|
||||||
|
|
||||||
if ~debug
|
skipline()
|
||||||
skipline()
|
disp('*** TESTING: nonlinearsolvers.m ***');
|
||||||
disp('*** TESTING: nonlinearsolvers.m ***');
|
|
||||||
end
|
|
||||||
|
|
||||||
tolf = 1e-6;
|
tolf = 1e-6;
|
||||||
tolx = 1e-6;
|
tolx = 1e-6;
|
||||||
|
@ -62,31 +58,23 @@ for i=1:length(objfun)
|
||||||
if isequal(func2str(objfun{i}), 'powell2')
|
if isequal(func2str(objfun{i}), 'powell2')
|
||||||
if ~errorflag
|
if ~errorflag
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Nonlinear solver is expected to fail on %s function but did not return an error.', func2str(objfun{i}))
|
||||||
dprintf('Nonlinear solver is expected to fail on %s function but did not return an error.', func2str(objfun{i}))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
elseif isequal(func2str(objfun{i}), 'trigonometric')
|
elseif isequal(func2str(objfun{i}), 'trigonometric')
|
||||||
% FIXME block_trust_region (mex) fails, with exit code equal to 4, but not trust_region (matlab). Would be nice to undertsand the difference.
|
% FIXME block_trust_region (mex) fails, with exit code equal to 4, but not trust_region (matlab). Would be nice to undertsand the difference.
|
||||||
if ~errorflag
|
if ~errorflag
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Nonlinear solver is expected to fail on %s function but did not return an error.', func2str(objfun{i}))
|
||||||
dprintf('Nonlinear solver is expected to fail on %s function but did not return an error.', func2str(objfun{i}))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if errorflag || norm(objfun{i}(x))>tolf
|
if errorflag || norm(objfun{i}(x))>tolf
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Nonlinear solver (mex) failed on %s function (norm(f(x))=%s).', func2str(objfun{i}), num2str(norm(objfun{i}(x))))
|
||||||
dprintf('Nonlinear solver (mex) failed on %s function (norm(f(x))=%s).', func2str(objfun{i}), num2str(norm(objfun{i}(x))))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Nonlinear solver (mex) failed on %s function.', func2str(objfun{i}))
|
||||||
dprintf('Nonlinear solver (mex) failed on %s function.', func2str(objfun{i}))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -111,29 +99,21 @@ for i=1:length(objfun)
|
||||||
if isequal(func2str(objfun{i}), 'powell2')
|
if isequal(func2str(objfun{i}), 'powell2')
|
||||||
if ~errorflag
|
if ~errorflag
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Nonlinear solver is expected to fail on %s function but did not return an error.', func2str(objfun{i}))
|
||||||
dprintf('Nonlinear solver is expected to fail on %s function but did not return an error.', func2str(objfun{i}))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if info~=3
|
if info~=3
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Nonlinear solver is expected to fail on %s function with info==3 but did not the correct value of info.', func2str(objfun{i}))
|
||||||
dprintf('Nonlinear solver is expected to fail on %s function with info==3 but did not the correct value of info.', func2str(objfun{i}))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if errorflag
|
if errorflag
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Nonlinear solver failed on %s function (info=%s).', func2str(objfun{i}), int2str(info))
|
||||||
dprintf('Nonlinear solver failed on %s function (info=%s).', func2str(objfun{i}), int2str(info))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Nonlinear solver failed on %s function.', func2str(objfun{i}))
|
||||||
dprintf('Nonlinear solver failed on %s function.', func2str(objfun{i}))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
debug = true;
|
|
||||||
|
|
||||||
source_dir = getenv('source_root');
|
source_dir = getenv('source_root');
|
||||||
addpath([source_dir filesep 'matlab']);
|
addpath([source_dir filesep 'matlab']);
|
||||||
|
|
||||||
|
@ -7,10 +5,8 @@ dynare_config;
|
||||||
|
|
||||||
testFailed = 0;
|
testFailed = 0;
|
||||||
|
|
||||||
if ~debug
|
skipline()
|
||||||
skipline()
|
disp('*** TESTING: riccatiupdate.m ***');
|
||||||
disp('*** TESTING: riccatiupdate.m ***');
|
|
||||||
end
|
|
||||||
|
|
||||||
t0 = clock;
|
t0 = clock;
|
||||||
|
|
||||||
|
@ -57,28 +53,22 @@ try
|
||||||
R = norm(Ptmp_fortran-Ptmp_matlab,1);
|
R = norm(Ptmp_fortran-Ptmp_matlab,1);
|
||||||
if (R > tol)
|
if (R > tol)
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('The Fortran Riccati update is wrong')
|
||||||
dprintf('The Fortran Riccati update is wrong')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
dprintf('Fortran Riccati update failed')
|
||||||
dprintf('Fortran Riccati update failed')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% Compare the Fortran and Matlab execution time
|
% Compare the Fortran and Matlab execution time
|
||||||
if debug
|
if tElapsed1<tElapsed2
|
||||||
if tElapsed1<tElapsed2
|
skipline()
|
||||||
skipline()
|
dprintf('Matlab Riccati update is %5.2f times faster than its Fortran counterpart.', tElapsed2/tElapsed1)
|
||||||
dprintf('Matlab Riccati update is %5.2f times faster than its Fortran counterpart.', tElapsed2/tElapsed1)
|
skipline()
|
||||||
skipline()
|
else
|
||||||
else
|
skipline()
|
||||||
skipline()
|
dprintf('Fortran Riccati update is %5.2f times faster than its Matlab counterpart.', tElapsed1/tElapsed2)
|
||||||
dprintf('Fortran Riccati update is %5.2f times faster than its Matlab counterpart.', tElapsed1/tElapsed2)
|
skipline()
|
||||||
skipline()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% Compare results after multiple calls
|
% Compare results after multiple calls
|
||||||
|
|
Loading…
Reference in New Issue