- Added trap to avoid infinite loops when type is not 'prior';

- Recover value of nosaddle from _core routine (bug fix when type is 'prior');
time-shift
Marco Ratto 2012-07-02 10:55:02 +02:00
parent 4cba20f231
commit 99c35e22f1
2 changed files with 14 additions and 5 deletions

View File

@ -162,7 +162,6 @@ end
% function.
b = 0;
nosaddle = 0;
localVars=[];
@ -171,7 +170,6 @@ localVars=[];
localVars.IRUN = IRUN;
localVars.irun = irun;
localVars.irun2=irun2;
localVars.nosaddle=nosaddle;
localVars.npar = npar;
localVars.type=type;
@ -208,6 +206,7 @@ localVars.MhDirectoryName=MhDirectoryName;
% Like sequential execution!
if isnumeric(options_.parallel),
[fout] = PosteriorIRF_core1(localVars,1,B,0);
nosaddle = fout.nosaddle;
else
% Parallel execution!
[nCPU, totCPU, nBlockPerCPU] = distributeJobs(options_.parallel, 1, B);
@ -241,6 +240,10 @@ else
NamFileInput(length(NamFileInput)+1,:)={'',[M_.fname '_steadystate.m']};
end
[fout] = masterParallel(options_.parallel, 1, B,NamFileInput,'PosteriorIRF_core1', localVars, globalVars, options_.parallel_info);
nosaddle=0;
for j=1:length(fout),
nosaddle = nosaddle + fout(j).nosaddle;
end
end

View File

@ -52,7 +52,6 @@ end
IRUN = myinputs.IRUN;
irun =myinputs.irun;
irun2=myinputs.irun2;
nosaddle=myinputs.nosaddle;
npar=myinputs.npar;
type=myinputs.type;
if ~strcmpi(type,'prior'),
@ -124,6 +123,7 @@ OutputFileName_param = {};
fpar = fpar-1;
fpar0=fpar;
nosaddle=0;
if whoiam
ifil2=ifil2(whoiam);
@ -163,8 +163,12 @@ while fpar<B
elseif info(1) == 5
errordef = 'Rank condition is not satisfied';
end
disp(['PosteriorIRF :: Dynare is unable to solve the model (' errordef ')'])
continue
if strcmpi(type,'prior'),
disp(['PosteriorIRF :: Dynare is unable to solve the model (' errordef ')'])
continue
else
error(['PosteriorIRF :: Dynare is unable to solve the model (' errordef ') with sample ' type])
end
end
SS(M_.exo_names_orig_ord,M_.exo_names_orig_ord) = M_.Sigma_e+1e-14*eye(M_.exo_nbr);
SS = transpose(chol(SS));
@ -305,6 +309,8 @@ end
myoutput.OutputFileName = [OutputFileName_dsge;
OutputFileName_param;
OutputFileName_bvardsge];
myoutput.nosaddle = nosaddle;