Commit 55764e66 authored by Marco Ratto's avatar Marco Ratto
Browse files

1) eliminated use of struct2local;

2) changes to header/comments.
parent 1021e43d
......@@ -18,6 +18,10 @@ function prior_posterior_statistics(type,Y,gend,data_index,missing_value)
% SPECIAL REQUIREMENTS
% none
% PARALLEL CONTEXT
% See the comments random_walk_metropolis_hastings.m funtion.
% Copyright (C) 2005-2010 Dynare Team
%
% This file is part of Dynare.
......@@ -142,7 +146,7 @@ end
% Store the variable mandatory for local/remote parallel computing.
localVars.typee=type;
localVars.type=type;
localVars.run_smoother=run_smoother;
localVars.gend=gend;
localVars.Y=Y;
......@@ -158,6 +162,8 @@ localVars.iendo=iendo;
if horizon
localVars.i_last_obs=i_last_obs;
localVars.IdObs=IdObs;
localVars.MAX_nforc1=MAX_nforc1;
localVars.MAX_nforc2=MAX_nforc2;
end
localVars.exo_nbr=exo_nbr;
localVars.maxlag=maxlag;
......@@ -168,10 +174,6 @@ if naK
localVars.MAX_naK=MAX_naK;
end
localVars.MAX_nruns=MAX_nruns;
if horizon
localVars.MAX_nforc1=MAX_nforc1;
localVars.MAX_nforc2=MAX_nforc2;
end
localVars.MAX_momentsno = MAX_momentsno;
localVars.ifil=ifil;
......@@ -191,10 +193,10 @@ end
b=0;
if isnumeric(options_.parallel),% | isunix, % for the moment exclude unix platform from parallel implementation
% Like sequential execution!
if isnumeric(options_.parallel),% | isunix, % For the moment exclude unix platform from parallel implementation!
[fout] = prior_posterior_statistics_core(localVars,1,B,0);
% Parallel execution!
else
[nCPU, totCPU, nBlockPerCPU] = distributeJobs(options_.parallel, 1, B);
for j=1:totCPU-1,
......@@ -252,7 +254,8 @@ save([DirectoryName '/' M_.fname '_data.mat'],'stock_gend','stock_data');
if ~isnumeric(options_.parallel),
leaveSlaveOpen = options_.parallel_info.leaveSlaveOpen;
if options_.parallel_info.leaveSlaveOpen == 0,
options_.parallel_info.leaveSlaveOpen = 1; % force locally to leave open remote matlab sessions (repeated pm3 calls)
% Commenting for testing!
% options_.parallel_info.leaveSlaveOpen = 1; % Force locally to leave open remote matlab sessions (repeated pm3 calls)
end
end
......
function myoutput=prior_posterior_statistics_core(myinputs,fpar,B,whoiam, ThisMatlab)
% PARALLEL CONTEXT
% Core functionality for prior_posterior.m function, which can be parallelized.
% See also the comment in random_walk_metropolis_hastings_core.m funtion.
%
% INPUTS
% See See the comment in random_walk_metropolis_hastings_core.m funtion.
% Copyright (C) 2005-2010 Dynare Team
% OUTPUTS
% o myoutput [struc]
% Contained OutputFileName_smooth;
% _update;
% _inno;
% _error;
% _filter_step_ahead;
% _param;
% _forc_mean;
% _forc_point
%
% ALGORITHM
% Portion of prior_posterior.m function.
% This file is part of Dynare.
%
% SPECIAL REQUIREMENTS.
% None.
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
......@@ -23,7 +42,14 @@ if nargin<4,
whoiam=0;
end
typee=myinputs.typee;
global options_ oo_ M_ bayestopt_ estim_params_
% Reshape 'myinputs' for local computation.
% In order to avoid confusion in the name space, the instruction struct2local(myinputs) is replaced by:
% Da CONTROLLARE con MARCO!
type=myinputs.type;
run_smoother=myinputs.run_smoother;
gend=myinputs.gend;
Y=myinputs.Y;
......@@ -39,27 +65,31 @@ iendo=myinputs.iendo;
if horizon
i_last_obs=myinputs.i_last_obs;
IdObs=myinputs.IdObs;
MAX_nforc1=myinputs.MAX_nforc1;
MAX_nforc2=myinputs.MAX_nforc2;
end
if naK
MAX_naK=myinputs.MAX_naK;
end
exo_nbr=myinputs.exo_nbr;
maxlag=myinputs.maxlag;
MAX_nsmoo=myinputs.MAX_nsmoo;
MAX_ninno=myinputs.MAX_ninno;
MAX_nerro =myinputs. MAX_nerro;
if naK
MAX_naK=myinputs.MAX_naK;
end
MAX_nerro = myinputs.MAX_nerro;
MAX_nruns=myinputs.MAX_nruns;
if horizon
MAX_nforc1=myinputs.MAX_nforc1;
MAX_nforc2=myinputs.MAX_nforc2;
end
MAX_momentsno =myinputs. MAX_momentsno;
MAX_momentsno = myinputs.MAX_momentsno;
ifil=myinputs.ifil;
if ~strcmpi(typee,'prior'),
if ~strcmpi(type,'prior'),
x=myinputs.x;
logpost=myinputs.logpost;
end
if whoiam
Parallel=myinputs.Parallel;
MasterName=myinputs.MasterName;
DyMo=myinputs.DyMo;
end
DirectoryName = CheckPath('metropolis');
......@@ -97,12 +127,12 @@ end
for b=fpar:B
% [deep, logpo] = GetOneDraw(typee);
% [deep, logpo] = GetOneDraw(type);
% set_all_parameters(deep);
% dr = resol(oo_.steady_state,0);
if strcmpi(typee,'prior')
if strcmpi(type,'prior')
[deep, logpo] = GetOneDraw(typee);
[deep, logpo] = GetOneDraw(type);
else
deep = x(b,:);
......@@ -171,12 +201,6 @@ for b=fpar:B
irun = irun + ones(7,1);
%
% TempPath=DirectoryName;
% DirectoryNamePar='C:\dynare_calcs\ModelTest\ls2003\metropolis'
% DirectoryName=DirectoryNamePar;
if irun(1) > MAX_nsmoo || b == B
stock = stock_smooth(:,:,1:irun(1)-1);
......
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