Added new info value (22) for cases where the steady state given by the steadystate file has NaNs.

time-shift
Stéphane Adjemian (Gpm) 2011-04-28 17:53:03 +02:00
parent b15cac0047
commit 14d7ab433f
2 changed files with 15 additions and 2 deletions

View File

@ -46,6 +46,7 @@ count_steadystate_file_exit = 0;
count_dll_problem = 0;
count_complex_jacobian = 0;
count_complex_steadystate = 0;
count_nan_steadystate = 0;
count_unknown_problem = 0;
NumberOfSimulations = options_.prior_mc;
NumberOfParameters = length(bayestopt_.p1);
@ -78,7 +79,7 @@ while iteration < NumberOfSimulations
params = prior_draw();
set_all_parameters(params);
[dr,INFO] = resol(oo_.steady_state,work);
switch INFO(1)
switch INFO(1)
case 0
file_line_number = file_line_number + 1 ;
iteration = iteration + 1;
@ -106,6 +107,8 @@ while iteration < NumberOfSimulations
count_complex_jacobian = count_complex_jacobian + 1 ;
case 21
count_complex_steadystate = count_complex_steadystate + 1 ;
case 22
count_nan_steadystate = count_nan_steadystate + 1 ;
otherwise
count_unknown_problem = count_unknown_problem + 1 ;
end

View File

@ -17,9 +17,10 @@ function [dr,info]=resol(steady_state_0,check_flag)
% info=6: The jacobian evaluated at the steady state is complex.
% info=19: The steadystate file did not compute the steady state (inconsistent deep parameters).
% info=20: can't find steady state info(2) contains sum of sqare residuals
% info=21: steady state is complex
% info=21: steady state is complex valued scalars
% info(2) contains sum of sqare of
% imaginary part of steady state
% info=22: steady state has NaNs
% info=30: Variance can't be computed
%
% SPECIAL REQUIREMENTS
@ -118,6 +119,7 @@ else
end
end
end
% testing for problem
dr.ys = steady_state;
@ -141,6 +143,14 @@ if ~isreal(steady_state)
return
end
if ~isempty(find(isnan(steady_state)))
info(1) = 22;
info(2) = NaN;
dr.ys = steady_state;
return
end
if options_.block
[dr,info,M_,options_,oo_] = dr_block(dr,check_flag,M_,options_,oo_);
else