Skip to content
Snippets Groups Projects
Commit cb2526ba authored by Marco Ratto's avatar Marco Ratto
Browse files

Fixed bug introduced in commit a070f5cb.

The name npar was already used for the subsample loop.
To keep notation more in line with dynare options_ the old npar is renamed to B.
parent 23ec38b2
Branches
Tags
No related merge requests found
function myoutput=PosteriorIRF_core1(myinputs,fpar,npar,whoiam, ThisMatlab) function myoutput=PosteriorIRF_core1(myinputs,fpar,B,whoiam, ThisMatlab)
% PARALLEL CONTEXT % PARALLEL CONTEXT
% This function perfom in parallel a portion of PosteriorIRF.m code. % This function perfom in parallel a portion of PosteriorIRF.m code.
% This is a special kind of parallel function. Unlike of other parallel functions, % This is a special kind of parallel function. Unlike of other parallel functions,
...@@ -134,7 +134,7 @@ end ...@@ -134,7 +134,7 @@ end
% Parallel 'while' very good!!! % Parallel 'while' very good!!!
stock_param=zeros(MAX_nruns,npar); stock_param=zeros(MAX_nruns,npar);
stock_irf_dsge=zeros(options_.irf,nvar,M_.exo_nbr,MAX_nirfs_dsge); stock_irf_dsge=zeros(options_.irf,nvar,M_.exo_nbr,MAX_nirfs_dsge);
while fpar<npar while fpar<B
fpar = fpar + 1; fpar = fpar + 1;
irun = irun+1; irun = irun+1;
irun2 = irun2+1; irun2 = irun2+1;
...@@ -240,10 +240,10 @@ while fpar<npar ...@@ -240,10 +240,10 @@ while fpar<npar
stock_irf_dsgevar = zeros(options_.irf,dataset_.info.nvobs,M_.exo_nbr,MAX_nirfs_dsgevar); stock_irf_dsgevar = zeros(options_.irf,dataset_.info.nvobs,M_.exo_nbr,MAX_nirfs_dsgevar);
end end
end end
if irun == MAX_nirfs_dsge || irun == npar || fpar == npar if irun == MAX_nirfs_dsge || irun == B || fpar == B
if fpar == npar if fpar == B
stock_irf_dsge = stock_irf_dsge(:,:,:,1:irun); stock_irf_dsge = stock_irf_dsge(:,:,:,1:irun);
if MAX_nirfs_dsgevar && (fpar == npar || IRUN == npar) if MAX_nirfs_dsgevar && (fpar == B || IRUN == B)
stock_irf_bvardsge = stock_irf_bvardsge(:,:,:,1:IRUN); stock_irf_bvardsge = stock_irf_bvardsge(:,:,:,1:IRUN);
instr = [MhDirectoryName '/' M_.fname '_irf_bvardsge' ... instr = [MhDirectoryName '/' M_.fname '_irf_bvardsge' ...
int2str(NumberOfIRFfiles_dsgevar) '.mat stock_irf_bvardsge;']; int2str(NumberOfIRFfiles_dsgevar) '.mat stock_irf_bvardsge;'];
...@@ -262,8 +262,8 @@ while fpar<npar ...@@ -262,8 +262,8 @@ while fpar<npar
NumberOfIRFfiles_dsge = NumberOfIRFfiles_dsge+1; NumberOfIRFfiles_dsge = NumberOfIRFfiles_dsge+1;
irun = 0; irun = 0;
end end
if irun2 == MAX_nruns || fpar == npar if irun2 == MAX_nruns || fpar == B
if fpar == npar if fpar == B
stock_param = stock_param(1:irun2,:); stock_param = stock_param(1:irun2,:);
end end
stock = stock_param; stock = stock_param;
...@@ -276,26 +276,26 @@ while fpar<npar ...@@ -276,26 +276,26 @@ while fpar<npar
end end
% if exist('OCTAVE_VERSION'), % if exist('OCTAVE_VERSION'),
% if (whoiam==0), % if (whoiam==0),
% printf(['Posterior IRF %3.f%% done\r'],(fpar/npar*100)); % printf(['Posterior IRF %3.f%% done\r'],(fpar/B*100));
% end % end
% elseif ~whoiam, % elseif ~whoiam,
% waitbar(fpar/npar,h); % waitbar(fpar/B,h);
% end % end
% if whoiam, % if whoiam,
% if ~exist('OCTAVE_VERSION') % if ~exist('OCTAVE_VERSION')
% fprintf('Done! \n'); % fprintf('Done! \n');
% end % end
% waitbarString = [ 'Subdraw ' int2str(fpar) '/' int2str(npar) ' done.']; % waitbarString = [ 'Subdraw ' int2str(fpar) '/' int2str(B) ' done.'];
% fMessageStatus((fpar-fpar0)/(npar-fpar0),whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab)); % fMessageStatus((fpar-fpar0)/(B-fpar0),whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab));
% end % end
dyn_waitbar((fpar-fpar0)/(npar-fpar0),h); dyn_waitbar((fpar-fpar0)/(B-fpar0),h);
end end
dyn_waitbar_close(h); dyn_waitbar_close(h);
if whoiam==0 if whoiam==0
if nosaddle if nosaddle
disp(['PosteriorIRF :: Percentage of discarded posterior draws = ' num2str(nosaddle/(npar+nosaddle))]) disp(['PosteriorIRF :: Percentage of discarded posterior draws = ' num2str(nosaddle/(B+nosaddle))])
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment