Commit 996ff3bf authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

Remove mexErrCheck from k_order_pert to make it obey the noprint-option

Currently, all stochastic solvers put the error code to info(1) and use
print_info to output the error. The only exception was k_order_pert,
which immediately created an error. Thus, the use of k_order_pert did
not allow for continuing after encountering errors, because only
print_info obeys the noprint-option. Replacing mexErrCheck by setting
info should deliver the correct behavior.
parent 7094a45f
function [dr,info] = k_order_pert(dr,M,options,oo)
function [dr,info] = k_order_pert(dr,M,options)
% Compute decision rules using the k-order DLL from Dynare++
% Copyright (C) 2009-2012 Dynare Team
% Copyright (C) 2009-2013 Dynare Team
%
% This file is part of Dynare.
%
......@@ -30,11 +30,17 @@ nspred = M.nspred;
switch(order)
case 1
[err, g_1] = k_order_perturbation(dr,M,options);
mexErrCheck('k_order_perturbation', err);
if err
info(1)=9;
return;
end
dr.g_1 = g_1;
case 2
[err, g_0, g_1, g_2] = k_order_perturbation(dr,M,options);
mexErrCheck('k_order_perturbation', err);
if err
info(1)=9;
return;
end
dr.g_0 = g_0;
dr.g_1 = g_1;
dr.g_2 = g_2;
......@@ -42,6 +48,10 @@ switch(order)
if options.pruning
[err, g_0, g_1, g_2, g_3, derivs] = k_order_perturbation(dr, ...
M,options);
if err
info(1)=9;
return;
end
dr.ghx = derivs.gy;
dr.ghu = derivs.gu;
dr.ghxx = unfold2(derivs.gyy,nspred);
......@@ -57,8 +67,11 @@ switch(order)
else
[err, g_0, g_1, g_2, g_3] = k_order_perturbation(dr, ...
M,options);
if err
info(1)=9;
return;
end
end
mexErrCheck('k_order_perturbation', err);
dr.g_0 = g_0;
dr.g_1 = g_1;
dr.g_2 = g_2;
......
......@@ -63,7 +63,8 @@ if ~noprint
else
error(['The Jacobian contains NaNs'])
end
case 9
error(['k_order_pert was unable to compute the solution'])
case 19
error('The steadystate file did not compute the steady state')
case 20
......
......@@ -21,7 +21,7 @@ function [dr,info] = stochastic_solvers(dr,task,M_,options_,oo_)
% indeterminacy.
% info=5: BK rank condition not satisfied.
% info=6: The jacobian matrix evaluated at the steady state is complex.
%
% info=9: k_order_pert was unable to compute the solution
% ALGORITHM
% ...
%
......@@ -62,7 +62,7 @@ if options_.k_order_solver;
options_,oo_);
else
dr = set_state_space(dr,M_,options_);
[dr,info] = k_order_pert(dr,M_,options_,oo_);
[dr,info] = k_order_pert(dr,M_,options_);
end
return;
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment