diff --git a/matlab/PosteriorIRF.m b/matlab/PosteriorIRF.m index 13543e3c0523ad4403967c6282ebb762dcadb1b4..c78733e383101727c1ef345a16edc1ca3bdfcaa3 100644 --- a/matlab/PosteriorIRF.m +++ b/matlab/PosteriorIRF.m @@ -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 diff --git a/matlab/PosteriorIRF_core1.m b/matlab/PosteriorIRF_core1.m index fa89722f35528d79f49bd053a44980e665af0aa8..115327fa8afcab8d918e0927df0739b311730f21 100644 --- a/matlab/PosteriorIRF_core1.m +++ b/matlab/PosteriorIRF_core1.m @@ -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;