time-shift
Johannes Pfeifer 2013-07-12 11:09:18 +02:00
commit ec0730a3a3
68 changed files with 443 additions and 752 deletions

View File

@ -743,6 +743,13 @@ Activate console mode. In addition to the behavior of
@code{nodisplay}, Dynare will not use graphical waitbars for long @code{nodisplay}, Dynare will not use graphical waitbars for long
computations. computations.
@item nograph
Activate the @code{nograph} option (@xref{nograph}), so that Dynare will not produce any
graph
@item nointeractive
Instructs Dynare to not request user input
@item cygwin @item cygwin
Tells Dynare that your MATLAB is configured for compiling MEX files with Tells Dynare that your MATLAB is configured for compiling MEX files with
Cygwin (@pxref{Software requirements}). This option is only available Cygwin (@pxref{Software requirements}). This option is only available

View File

@ -67,4 +67,4 @@ fprintf('MH: Total number of generated MH files: %d.\n',TotalNumberOfMhFiles);
fprintf('MH: I''ll use mh-files %d to %d.\n',FirstMhFile,TotalNumberOfMhFiles); fprintf('MH: I''ll use mh-files %d to %d.\n',FirstMhFile,TotalNumberOfMhFiles);
fprintf('MH: In MH-file number %d I''ll start at line %d.\n',FirstMhFile,FirstLine); fprintf('MH: In MH-file number %d I''ll start at line %d.\n',FirstMhFile,FirstLine);
fprintf('MH: Finally I keep %d draws.\n',TotalNumberOfMhDraws-FirstDraw); fprintf('MH: Finally I keep %d draws.\n',TotalNumberOfMhDraws-FirstDraw);
disp(' '); skipline()

View File

@ -62,7 +62,10 @@ header_width = row_header_width(M_,estim_params_,bayestopt_);
tit2 = sprintf('%-*s %10s %10s %16s %6s %10s\n',header_width+2,' ','prior mean','post. mean','conf. interval','prior','pstdev'); tit2 = sprintf('%-*s %10s %10s %16s %6s %10s\n',header_width+2,' ','prior mean','post. mean','conf. interval','prior','pstdev');
pformat = '%-*s %10.3f %10.4f %10.4f %8.4f %6s %10.4f'; pformat = '%-*s %10.3f %10.4f %10.4f %8.4f %6s %10.4f';
disp(' ');disp(' ');disp('ESTIMATION RESULTS');disp(' '); skipline(2)
disp('ESTIMATION RESULTS')
skipline()
try try
disp(sprintf('Log data density is %f.',oo_.MarginalDensity.ModifiedHarmonicMean)) disp(sprintf('Log data density is %f.',oo_.MarginalDensity.ModifiedHarmonicMean))
catch catch
@ -74,7 +77,7 @@ if np
if TeX if TeX
fid = TeXBegin(OutputDirectoryName,M_.fname,1,type); fid = TeXBegin(OutputDirectoryName,M_.fname,1,type);
end end
disp(' ') skipline()
disp(type) disp(type)
disp(tit2) disp(tit2)
ip = nvx+nvn+ncx+ncn+1; ip = nvx+nvn+ncx+ncn+1;
@ -120,7 +123,7 @@ if nvx
fid = TeXBegin(OutputDirectoryName,M_.fname,2,'standard deviation of structural shocks'); fid = TeXBegin(OutputDirectoryName,M_.fname,2,'standard deviation of structural shocks');
end end
ip = 1; ip = 1;
disp(' ') skipline()
disp('standard deviation of shocks') disp('standard deviation of shocks')
disp(tit2) disp(tit2)
for i=1:nvx for i=1:nvx
@ -165,7 +168,7 @@ if nvn
if TeX if TeX
fid = TeXBegin(OutputDirectoryName,M_.fname,3,'standard deviation of measurement errors'); fid = TeXBegin(OutputDirectoryName,M_.fname,3,'standard deviation of measurement errors');
end end
disp(' ') skipline()
disp('standard deviation of measurement errors') disp('standard deviation of measurement errors')
disp(tit2) disp(tit2)
ip = nvx+1; ip = nvx+1;
@ -207,7 +210,7 @@ if ncx
if TeX if TeX
fid = TeXBegin(OutputDirectoryName,M_.fname,4,'correlation of structural shocks'); fid = TeXBegin(OutputDirectoryName,M_.fname,4,'correlation of structural shocks');
end end
disp(' ') skipline()
disp('correlation of shocks') disp('correlation of shocks')
disp(tit2) disp(tit2)
ip = nvx+nvn+1; ip = nvx+nvn+1;
@ -261,7 +264,7 @@ if ncn
if TeX if TeX
fid = TeXBegin(OutputDirectoryName,M_.fname,5,'correlation of measurement errors'); fid = TeXBegin(OutputDirectoryName,M_.fname,5,'correlation of measurement errors');
end end
disp(' ') skipline()
disp('correlation of measurement errors') disp('correlation of measurement errors')
disp(tit2) disp(tit2)
ip = nvx+nvn+ncx+1; ip = nvx+nvn+ncx+1;

View File

@ -131,7 +131,7 @@ else
end end
UDIAG(:,[2 4 6],:) = UDIAG(:,[2 4 6],:)/nblck; UDIAG(:,[2 4 6],:) = UDIAG(:,[2 4 6],:)/nblck;
disp(' ') skipline()
clear pmet temp moyenne CSUP CINF csup cinf n linea iter tmp; clear pmet temp moyenne CSUP CINF csup cinf n linea iter tmp;
pages = floor(npar/3); pages = floor(npar/3);
k = 0; k = 0;

View File

@ -39,10 +39,10 @@ for nlags = 1:maxnlags
log_dnsty = posterior_int - prior_int - 0.5*ny*lik_nobs*log(2*pi); log_dnsty = posterior_int - prior_int - 0.5*ny*lik_nobs*log(2*pi);
disp(' ') skipline()
fprintf('The marginal log density of the BVAR(%g) model is equal to %10.4f\n', ... fprintf('The marginal log density of the BVAR(%g) model is equal to %10.4f\n', ...
nlags, log_dnsty); nlags, log_dnsty);
disp(' ') skipline()
end end

View File

@ -94,10 +94,10 @@ while d <= options_.bvar_replic
end end
if p > 0 if p > 0
disp(' ') skipline()
disp(['Some of the VAR models sampled from the posterior distribution']) disp(['Some of the VAR models sampled from the posterior distribution'])
disp(['were found to be explosive (' num2str(p/options_.bvar_replic) ' percent).']) disp(['were found to be explosive (' num2str(p/options_.bvar_replic) ' percent).'])
disp(' ') skipline()
end end
% Plot graphs % Plot graphs

View File

@ -92,10 +92,10 @@ for draw=1:options_.bvar_replic
end end
if p > 0 if p > 0
disp(' ') skipline()
disp(['Some of the VAR models sampled from the posterior distribution']) disp(['Some of the VAR models sampled from the posterior distribution'])
disp(['were found to be explosive (' int2str(p) ' samples).']) disp(['were found to be explosive (' int2str(p) ' samples).'])
disp(' ') skipline()
end end
posterior_mean_irfs = mean(sampled_irfs,4); posterior_mean_irfs = mean(sampled_irfs,4);

View File

@ -96,18 +96,18 @@ if (nyf == n_explod) && (dr.full_rank)
end end
if options.noprint == 0 if options.noprint == 0
disp(' ') skipline()
disp('EIGENVALUES:') disp('EIGENVALUES:')
disp(sprintf('%16s %16s %16s\n','Modulus','Real','Imaginary')) disp(sprintf('%16s %16s %16s\n','Modulus','Real','Imaginary'))
z=[m_lambda real(eigenvalues_(i)) imag(eigenvalues_(i))]'; z=[m_lambda real(eigenvalues_(i)) imag(eigenvalues_(i))]';
disp(sprintf('%16.4g %16.4g %16.4g\n',z)) disp(sprintf('%16.4g %16.4g %16.4g\n',z))
disp(sprintf('\nThere are %d eigenvalue(s) larger than 1 in modulus ', n_explod)); disp(sprintf('\nThere are %d eigenvalue(s) larger than 1 in modulus ', n_explod));
disp(sprintf('for %d forward-looking variable(s)',nyf)); disp(sprintf('for %d forward-looking variable(s)',nyf));
disp(' ') skipline()
if result if result
disp('The rank condition is verified.') disp('The rank condition is verified.')
else else
disp('The rank conditions ISN''T verified!') disp('The rank conditions ISN''T verified!')
end end
disp(' ') skipline()
end end

View File

@ -45,9 +45,9 @@ if options_.dsge_var && options_.bayesian_irf
msg = 1; msg = 1;
end end
if msg if msg
disp(' ') skipline()
disp('Posterior IRFs will be computed for all observed variables.') disp('Posterior IRFs will be computed for all observed variables.')
disp(' ') skipline()
end end
end end
varlist = options_.varobs; varlist = options_.varobs;
@ -55,7 +55,7 @@ if options_.dsge_var && options_.bayesian_irf
end end
if isempty(varlist) if isempty(varlist)
disp(' ') skipline()
disp(['You did not declare endogenous variables after the estimation/calib_smoother command.']) disp(['You did not declare endogenous variables after the estimation/calib_smoother command.'])
cas = []; cas = [];
if options_.bayesian_irf if options_.bayesian_irf
@ -93,37 +93,41 @@ if isempty(varlist)
string = [ cas , ' will be computed for the ' num2str(M_.endo_nbr) ' endogenous variables']; string = [ cas , ' will be computed for the ' num2str(M_.endo_nbr) ' endogenous variables'];
string = [ string ' of your model, this can be very long....']; string = [ string ' of your model, this can be very long....'];
format_text(string, 10) format_text(string, 10)
choice = []; if options_.nointeractive
while isempty(choice) % Default behaviour is to consider all the endogenous variables.
disp(' ') varlist = M_.endo_names(1:M_.orig_endo_nbr, :);
disp(' ') else
disp('Choose one of the following options:') choice = [];
disp(' ') while isempty(choice)
disp(' [1] Consider all the endogenous variables.') skipline(2)
disp(' [2] Consider all the observed endogenous variables.') disp('Choose one of the following options:')
disp(' [3] Stop Dynare and change the mod file.') skipline()
disp(' ') disp(' [1] Consider all the endogenous variables.')
choice = input('options [default is 1] = '); disp(' [2] Consider all the observed endogenous variables.')
if isempty(choice) disp(' [3] Stop Dynare and change the mod file.')
choice=1; skipline()
end choice = input('options [default is 1] = ');
if choice==1 if isempty(choice)
varlist = M_.endo_names(1:M_.orig_endo_nbr, :); choice=1;
elseif choice==2 end
varlist = options_.varobs; if choice==1
elseif choice==3 varlist = M_.endo_names(1:M_.orig_endo_nbr, :);
varlist = NaN; elseif choice==2
else varlist = options_.varobs;
disp('') elseif choice==3
disp('YOU HAVE TO ANSWER 1, 2 or 3!') varlist = NaN;
disp('') else
skipline()
disp('YOU HAVE TO ANSWER 1, 2 or 3!')
skipline()
end
end end
end end
end end
if isnan(varlist) if isnan(varlist)
edit([M_.fname '.mod']) edit([M_.fname '.mod'])
end end
disp('') skipline()
end end

View File

@ -91,7 +91,7 @@ if any(idemodel.ino),
else else
disp(['The rank of H (model) is deficient!' ]), disp(['The rank of H (model) is deficient!' ]),
end end
disp(' ') skipline()
for j=1:npar, for j=1:npar,
if any(idemodel.ind0(:,j)==0), if any(idemodel.ind0(:,j)==0),
pno = 100*length(find(idemodel.ind0(:,j)==0))/SampleSize; pno = 100*length(find(idemodel.ind0(:,j)==0))/SampleSize;
@ -106,7 +106,7 @@ if any(idemodel.ino),
npairs=size(idemodel.jweak_pair,2); npairs=size(idemodel.jweak_pair,2);
jmap_pair=dyn_unvech(1:npairs); jmap_pair=dyn_unvech(1:npairs);
jstore=[]; jstore=[];
disp(' ') skipline()
for j=1:npairs, for j=1:npairs,
iweak = length(find(idemodel.jweak_pair(:,j))); iweak = length(find(idemodel.jweak_pair(:,j)));
if iweak, if iweak,
@ -120,7 +120,7 @@ if any(idemodel.ino),
end end
end end
disp(' ') skipline()
for j=1:npar, for j=1:npar,
iweak = length(find(idemodel.jweak(:,j))); iweak = length(find(idemodel.jweak(:,j)));
if iweak && ~ismember(j,jstore), if iweak && ~ismember(j,jstore),
@ -154,11 +154,11 @@ end
if ~any(idemodel.ino) && ~any(any(idemodel.ind0==0)) if ~any(idemodel.ino) && ~any(any(idemodel.ind0==0))
disp(['All parameters are identified in the model (rank of H).' ]), disp(['All parameters are identified in the model (rank of H).' ]),
disp(' ') skipline()
end end
if any(idemoments.ino), if any(idemoments.ino),
disp(' ') skipline()
disp('WARNING !!!') disp('WARNING !!!')
if SampleSize > 1, if SampleSize > 1,
disp(['The rank of J (moments) is deficient for ', num2str(length(find(idemoments.ino))),' out of ',int2str(SampleSize),' MC runs!' ]), disp(['The rank of J (moments) is deficient for ', num2str(length(find(idemoments.ino))),' out of ',int2str(SampleSize),' MC runs!' ]),
@ -172,7 +172,7 @@ if any(idemoments.ino),
% freqno = mean(indno)*100; % freqno = mean(indno)*100;
% ifreq=find(freqno); % ifreq=find(freqno);
% disp('MOMENT RANK FAILURE DUE TO COLLINEARITY OF PARAMETERS:'); % disp('MOMENT RANK FAILURE DUE TO COLLINEARITY OF PARAMETERS:');
disp(' ') skipline()
for j=1:npar, for j=1:npar,
if any(idemoments.ind0(:,j)==0), if any(idemoments.ind0(:,j)==0),
pno = 100*length(find(idemoments.ind0(:,j)==0))/SampleSize; pno = 100*length(find(idemoments.ind0(:,j)==0))/SampleSize;
@ -184,7 +184,7 @@ if any(idemoments.ino),
disp([' [dJ/d(',name{j},')=0 for all J moments!]' ]) disp([' [dJ/d(',name{j},')=0 for all J moments!]' ])
end end
end end
disp(' ') skipline()
npairs=size(idemoments.jweak_pair,2); npairs=size(idemoments.jweak_pair,2);
jmap_pair=dyn_unvech(1:npairs); jmap_pair=dyn_unvech(1:npairs);
jstore=[]; jstore=[];
@ -201,7 +201,7 @@ if any(idemoments.ino),
end end
end end
disp(' ') skipline()
for j=1:npar, for j=1:npar,
iweak = length(find(idemoments.jweak(:,j))); iweak = length(find(idemoments.jweak(:,j)));
if iweak && ~ismember(j,jstore), if iweak && ~ismember(j,jstore),
@ -235,9 +235,9 @@ if any(idemoments.ino),
% end % end
end end
if ~any(idemoments.ino) && ~any(any(idemoments.ind0==0)) if ~any(idemoments.ino) && ~any(any(idemoments.ind0==0))
disp(' ') skipline()
disp(['All parameters are identified by J moments (rank of J)' ]), disp(['All parameters are identified by J moments (rank of J)' ]),
disp(' ') skipline()
end end
% if ~ options_.noprint && advanced, % if ~ options_.noprint && advanced,
@ -267,7 +267,7 @@ end
% identificaton patterns % identificaton patterns
if SampleSize==1 && advanced, if SampleSize==1 && advanced,
disp(' ') skipline()
disp('Press ENTER to print advanced diagnostics'), pause(5), disp('Press ENTER to print advanced diagnostics'), pause(5),
for j=1:size(idemoments.cosnJ,2), for j=1:size(idemoments.cosnJ,2),
pax=NaN(npar,npar); pax=NaN(npar,npar);

View File

@ -24,9 +24,9 @@ function disp_model_summary(M,dr)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
disp(' ') skipline()
disp('MODEL SUMMARY') disp('MODEL SUMMARY')
disp(' ') skipline()
disp([' Number of variables: ' int2str(M.endo_nbr)]) disp([' Number of variables: ' int2str(M.endo_nbr)])
disp([' Number of stochastic shocks: ' int2str(M.exo_nbr)]) disp([' Number of stochastic shocks: ' int2str(M.exo_nbr)])
disp([' Number of state variables: ' ... disp([' Number of state variables: ' ...

View File

@ -29,9 +29,9 @@ function disp_steady_state(M,oo)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
disp(' ') skipline()
disp('STEADY-STATE RESULTS:') disp('STEADY-STATE RESULTS:')
disp(' ') skipline()
endo_names = M.endo_names; endo_names = M.endo_names;
steady_state = oo.steady_state; steady_state = oo.steady_state;
for i=1:M.orig_endo_nbr for i=1:M.orig_endo_nbr

View File

@ -64,7 +64,7 @@ if ~options_.noprint %options_.nomoments == 0
lh = size(labels,2)+2; lh = size(labels,2)+2;
dyntable(title,headers,labels,z,lh,11,4); dyntable(title,headers,labels,z,lh,11,4);
if M_.exo_nbr > 1 && size(stationary_vars, 1) > 0 if M_.exo_nbr > 1 && size(stationary_vars, 1) > 0
disp(' ') skipline()
if options_.order == 2 if options_.order == 2
title='APPROXIMATED VARIANCE DECOMPOSITION (in percent)'; title='APPROXIMATED VARIANCE DECOMPOSITION (in percent)';
else else
@ -91,16 +91,16 @@ if ~options_.noprint %options_.nomoments == 0
end end
if length(i1) == 0 if length(i1) == 0
disp(' ') skipline()
disp('All endogenous are constant or non stationary, not displaying correlations and auto-correlations') disp('All endogenous are constant or non stationary, not displaying correlations and auto-correlations')
disp(' ') skipline()
return; return
end end
if options_.nocorr == 0 && size(stationary_vars, 1) > 0 if options_.nocorr == 0 && size(stationary_vars, 1) > 0
corr = oo_.gamma_y{1}(i1,i1)./(sd(i1)*sd(i1)'); corr = oo_.gamma_y{1}(i1,i1)./(sd(i1)*sd(i1)');
if ~options_.noprint, if ~options_.noprint,
disp(' ') skipline()
if options_.order == 2 if options_.order == 2
title='APPROXIMATED MATRIX OF CORRELATIONS'; title='APPROXIMATED MATRIX OF CORRELATIONS';
else else
@ -122,7 +122,7 @@ if options_.ar > 0 && size(stationary_vars, 1) > 0
z(:,i) = diag(oo_.gamma_y{i+1}(i1,i1)); z(:,i) = diag(oo_.gamma_y{i+1}(i1,i1));
end end
if ~options_.noprint, if ~options_.noprint,
disp(' ') skipline()
if options_.order == 2 if options_.order == 2
title='APPROXIMATED COEFFICIENTS OF AUTOCORRELATION'; title='APPROXIMATED COEFFICIENTS OF AUTOCORRELATION';
else else

View File

@ -50,10 +50,10 @@ conditional_decomposition_array = conditional_variance_decomposition(StateSpaceM
if options_.noprint == 0 if options_.noprint == 0
if options_.order == 2 if options_.order == 2
disp(' ') skipline()
disp('APPROXIMATED CONDITIONAL VARIANCE DECOMPOSITION (in percent)') disp('APPROXIMATED CONDITIONAL VARIANCE DECOMPOSITION (in percent)')
else else
disp(' ') skipline()
disp('CONDITIONAL VARIANCE DECOMPOSITION (in percent)') disp('CONDITIONAL VARIANCE DECOMPOSITION (in percent)')
end end
end end

View File

@ -44,7 +44,7 @@ ncn = estim_params_.ncn; % Covariance of the measurement innovations (number of
np = estim_params_.np ; % Number of deep parameters. np = estim_params_.np ; % Number of deep parameters.
nx = nvx+nvn+ncx+ncn+np; % Total number of parameters to be estimated. nx = nvx+nvn+ncx+ncn+np; % Total number of parameters to be estimated.
disp(' ') skipline()
disp(['RESULTS FROM ' upper(table_title) ' ESTIMATION']) disp(['RESULTS FROM ' upper(table_title) ' ESTIMATION'])
LaTeXtitle=strrep(table_title,' ','_'); LaTeXtitle=strrep(table_title,' ','_');
tstath = abs(xparam1)./stdh; tstath = abs(xparam1)./stdh;
@ -76,7 +76,7 @@ if np
eval(['oo_.' field_name '_std.parameters.' name ' = stdh(ip);']); eval(['oo_.' field_name '_std.parameters.' name ' = stdh(ip);']);
ip = ip+1; ip = ip+1;
end end
disp(' ') skipline()
end end
if nvx if nvx
ip = 1; ip = 1;
@ -98,7 +98,7 @@ if nvx
eval(['oo_.' field_name '_std.shocks_std.' name ' = stdh(ip);']); eval(['oo_.' field_name '_std.shocks_std.' name ' = stdh(ip);']);
ip = ip+1; ip = ip+1;
end end
disp(' ') skipline()
end end
if nvn if nvn
disp('standard deviation of measurement errors') disp('standard deviation of measurement errors')
@ -119,7 +119,7 @@ if nvx
eval(['oo_.' field_name '_std.measurement_errors_std.' name ' = stdh(ip);']); eval(['oo_.' field_name '_std.measurement_errors_std.' name ' = stdh(ip);']);
ip = ip+1; ip = ip+1;
end end
disp(' ') skipline()
end end
if ncx if ncx
@ -144,7 +144,7 @@ if ncx
eval(['oo_.' field_name '_std.shocks_corr.' NAME ' = stdh(ip);']); eval(['oo_.' field_name '_std.shocks_corr.' NAME ' = stdh(ip);']);
ip = ip+1; ip = ip+1;
end end
disp(' ') skipline()
end end
if ncn if ncn
@ -167,7 +167,7 @@ if ncn
eval(['oo_.' field_name '_std.measurement_errors_corr.' NAME ' = stdh(ip);']); eval(['oo_.' field_name '_std.measurement_errors_corr.' NAME ' = stdh(ip);']);
ip = ip+1; ip = ip+1;
end end
disp(' ') skipline()
end end
OutputDirectoryName = CheckPath('Output',M_.dname); OutputDirectoryName = CheckPath('Output',M_.dname);

View File

@ -182,7 +182,7 @@ function [resid,dr] = risky_residuals(ys,pm,M,dr,options,oo)
pm = model_structure(M,options); pm = model_structure(M,options);
[dr,info] = dyn_first_order_solver(d1,M,dr,options,0); [dr,info] = dyn_first_order_solver(d1,M,dr,options,0);
if info if info
print_info(); print_info(info,options.noprint,options);
end end
dr = dyn_second_order_solver(d1,d2,dr,M,... dr = dyn_second_order_solver(d1,d2,dr,M,...
options.threads.kronecker.A_times_B_kronecker_C,... options.threads.kronecker.A_times_B_kronecker_C,...

View File

@ -34,11 +34,11 @@ function dynare(fname, varargin)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if strcmpi(fname,'help') if strcmpi(fname,'help')
disp(' ') skipline()
disp(['This is dynare version ' dynare_version() '.']) disp(['This is dynare version ' dynare_version() '.'])
disp(' ') skipline()
disp('USAGE: dynare FILENAME[.mod,.dyn] [OPTIONS]') disp('USAGE: dynare FILENAME[.mod,.dyn] [OPTIONS]')
disp(' ') skipline()
disp('dynare executes instruction included in FILENAME.mod.') disp('dynare executes instruction included in FILENAME.mod.')
disp('See the reference manual for the available options.') disp('See the reference manual for the available options.')
return return

View File

@ -220,7 +220,7 @@ end
%% Test if valid mex files are available, if a mex file is not available %% Test if valid mex files are available, if a mex file is not available
%% a matlab version of the routine is included in the path. %% a matlab version of the routine is included in the path.
if verbose if verbose
disp(' ') skipline()
disp('Configuring Dynare ...') disp('Configuring Dynare ...')
end end
@ -285,7 +285,7 @@ else
end end
if verbose if verbose
disp([ message 'Markov Switching SBVAR.' ]) disp([ message 'Markov Switching SBVAR.' ])
disp(' ') skipline()
end end
cd(origin); cd(origin);

View File

@ -34,9 +34,31 @@ global M_ options_ oo_ estim_params_ bayestopt_ dataset_
% Set particle filter flag. % Set particle filter flag.
if options_.order > 1 if options_.order > 1
if options_.particle.status && options_.order==2 if options_.particle.status && options_.order==2
disp(' ') skipline()
disp('Estimation using a non linear filter!') disp('Estimation using a non linear filter!')
disp(' ') skipline()
if ~options_.nointeractive && ismember(options_.mode_compute,[1,3,4]) % Known gradient-based optimizers
disp('You are using a gradient-based mode-finder. Particle filtering introduces discontinuities in the')
disp('objective function w.r.t the parameters. Thus, should use a non-gradient based optimizer.')
fprintf('\nPlease choose a mode-finder:\n')
fprintf('\t 0 - Continue using gradient-based method (it is most likely that you will no get any sensible result).\n')
fprintf('\t 6 - Monte Carlo based algorithm\n')
fprintf('\t 7 - Nelder-Mead simplex based optimization routine (Matlab optimization toolbox required)\n')
fprintf('\t 8 - Nelder-Mead simplex based optimization routine (Dynare''s implementation)\n')
fprintf('\t 9 - CMA-ES (Covariance Matrix Adaptation Evolution Strategy) algorithm\n')
choice = [];
while isempty(choice)
choice = input('Please enter your choice: ');
if isnumeric(choice) && isint(choice) && ismember(choice,[0 6 7 8 9])
if choice
options_.mode_compute = choice;
end
else
fprintf('\nThis is an invalid choice (you have to choose between 0, 6, 7, 8 and 9).\n')
choice = [];
end
end
end
elseif options_.particle.status && options_.order>2 elseif options_.particle.status && options_.order>2
error(['Non linear filter are not implemented with order ' int2str(options_.order) ' approximation of the model!']) error(['Non linear filter are not implemented with order ' int2str(options_.order) ' approximation of the model!'])
elseif ~options_.particle.status && options_.order==2 elseif ~options_.particle.status && options_.order==2
@ -335,7 +357,7 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation
fval = feval(objective_function,xparam1,dataset_,options_,M_,estim_params_,bayestopt_,oo_); fval = feval(objective_function,xparam1,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
options_.mh_jscale = Scale; options_.mh_jscale = Scale;
mouvement = max(max(abs(PostVar-OldPostVar))); mouvement = max(max(abs(PostVar-OldPostVar)));
disp(' ') skipline()
disp('========================================================== ') disp('========================================================== ')
disp([' Change in the covariance matrix = ' num2str(mouvement) '.']) disp([' Change in the covariance matrix = ' num2str(mouvement) '.'])
disp([' Mode improvement = ' num2str(abs(OldMode-fval))]) disp([' Mode improvement = ' num2str(abs(OldMode-fval))])
@ -356,7 +378,7 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation
options_.mh_jscale = Scale; options_.mh_jscale = Scale;
mouvement = max(max(abs(PostVar-OldPostVar))); mouvement = max(max(abs(PostVar-OldPostVar)));
fval = feval(objective_function,xparam1,dataset_,options_,M_,estim_params_,bayestopt_,oo_); fval = feval(objective_function,xparam1,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
disp(' ') skipline()
disp('========================================================== ') disp('========================================================== ')
disp([' Change in the covariance matrix = ' num2str(mouvement) '.']) disp([' Change in the covariance matrix = ' num2str(mouvement) '.'])
disp([' Mode improvement = ' num2str(abs(OldMode-fval))]) disp([' Mode improvement = ' num2str(abs(OldMode-fval))])
@ -369,11 +391,11 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation
save([M_.fname '_optimal_mh_scale_parameter.mat'],'Scale'); save([M_.fname '_optimal_mh_scale_parameter.mat'],'Scale');
bayestopt_.jscale = ones(length(xparam1),1)*Scale; bayestopt_.jscale = ones(length(xparam1),1)*Scale;
end end
disp(' ') skipline()
disp(['Optimal value of the scale parameter = ' num2str(Scale)]) disp(['Optimal value of the scale parameter = ' num2str(Scale)])
disp(' ') skipline()
disp(['Final value of the log posterior (or likelihood): ' num2str(fval)]) disp(['Final value of the log posterior (or likelihood): ' num2str(fval)])
disp(' ') skipline()
parameter_names = bayestopt_.name; parameter_names = bayestopt_.name;
save([M_.fname '_mode.mat'],'xparam1','hh','parameter_names'); save([M_.fname '_mode.mat'],'xparam1','hh','parameter_names');
case 7 case 7
@ -485,7 +507,7 @@ if ~options_.mh_posterior_mode_estimation && options_.cova_compute
try try
chol(hh); chol(hh);
catch catch
disp(' ') skipline()
disp('POSTERIOR KERNEL OPTIMIZATION PROBLEM!') disp('POSTERIOR KERNEL OPTIMIZATION PROBLEM!')
disp(' (minus) the hessian matrix at the "mode" is not positive definite!') disp(' (minus) the hessian matrix at the "mode" is not positive definite!')
disp('=> posterior variance of the estimated parameters are not positive.') disp('=> posterior variance of the estimated parameters are not positive.')
@ -534,9 +556,9 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
log_det_invhess = -estim_params_nbr*log(scale_factor)+log(det(scale_factor*invhess)); log_det_invhess = -estim_params_nbr*log(scale_factor)+log(det(scale_factor*invhess));
likelihood = feval(objective_function,xparam1,dataset_,options_,M_,estim_params_,bayestopt_,oo_); likelihood = feval(objective_function,xparam1,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
oo_.MarginalDensity.LaplaceApproximation = .5*estim_params_nbr*log(2*pi) + .5*log_det_invhess - likelihood; oo_.MarginalDensity.LaplaceApproximation = .5*estim_params_nbr*log(2*pi) + .5*log_det_invhess - likelihood;
disp(' ') skipline()
disp(sprintf('Log data density [Laplace approximation] is %f.',oo_.MarginalDensity.LaplaceApproximation)) disp(sprintf('Log data density [Laplace approximation] is %f.',oo_.MarginalDensity.LaplaceApproximation))
disp(' ') skipline()
end end
elseif ~any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation elseif ~any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
oo_=display_estimation_results_table(xparam1,stdh,M_,options_,estim_params_,bayestopt_,oo_,pnames,'Maximum Likelihood','mle'); oo_=display_estimation_results_table(xparam1,stdh,M_,options_,estim_params_,bayestopt_,oo_,pnames,'Maximum Likelihood','mle');

View File

@ -53,7 +53,7 @@ for i = 1:size(M_.endo_names,1)
tmp = strmatch(deblank(M_.endo_names(i,:)),options_.varobs,'exact'); tmp = strmatch(deblank(M_.endo_names(i,:)),options_.varobs,'exact');
if ~isempty(tmp) if ~isempty(tmp)
if length(tmp)>1 if length(tmp)>1
disp(' ') skipline()
error(['Multiple declarations of ' deblank(M_.endo_names(i,:)) ' as an observed variable is not allowed!']) error(['Multiple declarations of ' deblank(M_.endo_names(i,:)) ' as an observed variable is not allowed!'])
end end
options_.lgyidx2varobs(i) = tmp; options_.lgyidx2varobs(i) = tmp;

View File

@ -213,9 +213,9 @@ options_ident.max_dim_cova_group = min([options_ident.max_dim_cova_group,nparam-
MaxNumberOfBytes=options_.MaxNumberOfBytes; MaxNumberOfBytes=options_.MaxNumberOfBytes;
store_options_ident = options_ident; store_options_ident = options_ident;
disp(' ') skipline()
disp(['==== Identification analysis ====' ]), disp(['==== Identification analysis ====' ]),
disp(' ') skipline()
if iload <=0, if iload <=0,
@ -272,11 +272,11 @@ if iload <=0,
[idehess_point, idemoments_point, idemodel_point, idelre_point, derivatives_info_point, info] = ... [idehess_point, idemoments_point, idemodel_point, idelre_point, derivatives_info_point, info] = ...
identification_analysis(params,indx,indexo,options_ident,dataset_, prior_exist, name_tex,1); identification_analysis(params,indx,indexo,options_ident,dataset_, prior_exist, name_tex,1);
if info(1)~=0, if info(1)~=0,
disp(' ') skipline()
disp('----------- ') disp('----------- ')
disp('Parameter error:') disp('Parameter error:')
disp(['The model does not solve for ', parameters, ' with error code info = ', int2str(info(1))]), disp(['The model does not solve for ', parameters, ' with error code info = ', int2str(info(1))]),
disp(' ') skipline()
if info(1)==1, if info(1)==1,
disp('info==1 %! The model doesn''t determine the current variables uniquely.') disp('info==1 %! The model doesn''t determine the current variables uniquely.')
elseif info(1)==2, elseif info(1)==2,
@ -305,7 +305,7 @@ if iload <=0,
disp('info==30 %! Ergodic variance can''t be computed. ') disp('info==30 %! Ergodic variance can''t be computed. ')
end end
disp('----------- ') disp('----------- ')
disp(' ') skipline()
if any(bayestopt_.pshape) if any(bayestopt_.pshape)
disp('Try sampling up to 50 parameter sets from the prior.') disp('Try sampling up to 50 parameter sets from the prior.')
kk=0; kk=0;
@ -317,15 +317,15 @@ if iload <=0,
end end
end end
if info(1) if info(1)
disp(' ') skipline()
disp('----------- ') disp('----------- ')
disp('Identification stopped:') disp('Identification stopped:')
if any(bayestopt_.pshape) if any(bayestopt_.pshape)
disp('The model did not solve for any of 50 attempts of random samples from the prior') disp('The model did not solve for any of 50 attempts of random samples from the prior')
end end
disp('----------- ') disp('----------- ')
disp(' ') skipline()
return, return
end end
else else
idehess_point.params=params; idehess_point.params=params;
@ -343,7 +343,7 @@ if iload <=0,
end end
if SampleSize > 1, if SampleSize > 1,
disp(' ') skipline()
disp('Monte Carlo Testing') disp('Monte Carlo Testing')
h = dyn_waitbar(0,'Monte Carlo identification checks ...'); h = dyn_waitbar(0,'Monte Carlo identification checks ...');
iteration = 0; iteration = 0;
@ -587,7 +587,6 @@ else
warning on, warning on,
end end
disp(' ') skipline()
disp(['==== Identification analysis completed ====' ]), disp(['==== Identification analysis completed ====' ]),
disp(' ') skipline(2)
disp(' ')

View File

@ -215,7 +215,7 @@ if (options_gsa.load_stab || options_gsa.load_rmse || options_gsa.load_redform)
any(bayestopt_.p4(~isnan(bayestopt_.p4))~=bkpprior.p4(~isnan(bkpprior.p4))), any(bayestopt_.p4(~isnan(bayestopt_.p4))~=bkpprior.p4(~isnan(bkpprior.p4))),
disp('WARNING!') disp('WARNING!')
disp('The saved sample has different priors w.r.t. to current ones!!') disp('The saved sample has different priors w.r.t. to current ones!!')
disp('') skipline()
disp('Press ENTER to continue') disp('Press ENTER to continue')
pause; pause;
end end
@ -226,7 +226,7 @@ end
if options_gsa.stab && ~options_gsa.ppost, if options_gsa.stab && ~options_gsa.ppost,
x0 = stab_map_(OutputDirectoryName,options_gsa); x0 = stab_map_(OutputDirectoryName,options_gsa);
if isempty(x0), if isempty(x0),
disp(' ') skipline()
disp('Sensitivity computations stopped: no parameter set provided a unique solution') disp('Sensitivity computations stopped: no parameter set provided a unique solution')
return return
end end

View File

@ -137,11 +137,11 @@ if options.ramsey_policy
end end
if ~options.noprint if ~options.noprint
disp(' ') skipline()
disp('Approximated value of planner objective function') disp('Approximated value of planner objective function')
disp([' - with initial Lagrange multipliers set to 0: ' ... disp([' - with initial Lagrange multipliers set to 0: ' ...
num2str(planner_objective_value(2)) ]) num2str(planner_objective_value(2)) ])
disp([' - with initial Lagrange multipliers set to steady state: ' ... disp([' - with initial Lagrange multipliers set to steady state: ' ...
num2str(planner_objective_value(1)) ]) num2str(planner_objective_value(1)) ])
disp(' ') skipline()
end end

View File

@ -91,13 +91,11 @@ end
oo_.forecast.accept_rate = (replic-m1)/replic; oo_.forecast.accept_rate = (replic-m1)/replic;
if options_.noprint == 0 && m1 < replic if options_.noprint == 0 && m1 < replic
disp(' ') skipline(2)
disp(' ')
disp('FORECASTING WITH PARAMETER UNCERTAINTY:') disp('FORECASTING WITH PARAMETER UNCERTAINTY:')
disp(sprintf(['The model couldn''t be solved for %f%% of the parameter' ... disp(sprintf(['The model couldn''t be solved for %f%% of the parameter' ...
' values'],100*oo_.forecast.accept_rate)) ' values'],100*oo_.forecast.accept_rate))
disp(' ') skipline(2)
disp(' ')
end end
% compute moments % compute moments

View File

@ -167,18 +167,17 @@ if info==2% Prior optimization.
bayestopt_.p3, ... bayestopt_.p3, ...
bayestopt_.p4,options_,M_,estim_params_,oo_); bayestopt_.p4,options_,M_,estim_params_,oo_);
% Display the results. % Display the results.
disp(' ') skipline(2)
disp(' ')
disp('------------------') disp('------------------')
disp('PRIOR OPTIMIZATION') disp('PRIOR OPTIMIZATION')
disp('------------------') disp('------------------')
disp(' ') skipline()
for i = 1:length(xparams) for i = 1:length(xparams)
disp(['deep parameter ' int2str(i) ': ' get_the_name(i,0,M_,estim_params_,options_) '.']) disp(['deep parameter ' int2str(i) ': ' get_the_name(i,0,M_,estim_params_,options_) '.'])
disp([' Initial condition ....... ' num2str(xinit(i)) '.']) disp([' Initial condition ....... ' num2str(xinit(i)) '.'])
disp([' Prior mode .............. ' num2str(bayestopt_.p5(i)) '.']) disp([' Prior mode .............. ' num2str(bayestopt_.p5(i)) '.'])
disp([' Optimized prior mode .... ' num2str(xparams(i)) '.']) disp([' Optimized prior mode .... ' num2str(xparams(i)) '.'])
disp(' ') skipline()
end end
end end

View File

@ -107,6 +107,9 @@ gmhmaxlik.nclimb = 200000;
gmhmaxlik.nscale = 200000; gmhmaxlik.nscale = 200000;
options_.gmhmaxlik = gmhmaxlik; options_.gmhmaxlik = gmhmaxlik;
% Request user input.
options_.nointeractive = 0;
% Graphics % Graphics
options_.graphics.nrows = 3; options_.graphics.nrows = 3;
options_.graphics.ncols = 3; options_.graphics.ncols = 3;

View File

@ -40,7 +40,7 @@ function [SAmeas, OutMatrix] = Morris_Measure_Groups(NumFact, Sample, Output, p,
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if nargin==0, if nargin==0,
disp(' ') skipline()
disp('[SAmeas, OutMatrix] = Morris_Measure_Groups(NumFact, Sample, Output, p, Group);') disp('[SAmeas, OutMatrix] = Morris_Measure_Groups(NumFact, Sample, Output, p, Group);')
return return
end end

View File

@ -50,11 +50,10 @@ fname_ = M_.fname;
lgy_ = M_.endo_names; lgy_ = M_.endo_names;
dr_ = oo_.dr; dr_ = oo_.dr;
disp(' ') skipline(2)
disp(' ')
disp('Starting sensitivity analysis') disp('Starting sensitivity analysis')
disp('for the fit of EACH observed series ...') disp('for the fit of EACH observed series ...')
disp(' ') skipline()
disp('Deleting old SA figures...') disp('Deleting old SA figures...')
a=dir([OutDir,filesep,'*.*']); a=dir([OutDir,filesep,'*.*']);
tmp1='0'; tmp1='0';
@ -149,7 +148,7 @@ if ~loadSA,
nruns=size(x,1); nruns=size(x,1);
nfilt=floor(pfilt*nruns); nfilt=floor(pfilt*nruns);
if options_.opt_gsa.ppost || (options_.opt_gsa.ppost==0 && options_.opt_gsa.lik_only==0) if options_.opt_gsa.ppost || (options_.opt_gsa.ppost==0 && options_.opt_gsa.lik_only==0)
disp(' ') skipline()
disp('Computing RMSE''s...') disp('Computing RMSE''s...')
fobs = options_.first_obs; fobs = options_.first_obs;
nobs=options_.nobs; nobs=options_.nobs;
@ -408,7 +407,7 @@ else
end end
param_names=param_names(2:end,:); param_names=param_names(2:end,:);
disp(' ') skipline()
disp('RMSE over the MC sample:') disp('RMSE over the MC sample:')
disp(' min yr RMSE max yr RMSE') disp(' min yr RMSE max yr RMSE')
for j=1:size(vvarvecm,1), for j=1:size(vvarvecm,1),
@ -416,8 +415,7 @@ else
end end
invar = find( std(rmse_MC)./mean(rmse_MC)<=0.0001 ); invar = find( std(rmse_MC)./mean(rmse_MC)<=0.0001 );
if ~isempty(invar) if ~isempty(invar)
disp(' ') skipline(2)
disp(' ')
disp('RMSE is not varying significantly over the MC sample for the following variables:') disp('RMSE is not varying significantly over the MC sample for the following variables:')
disp(vvarvecm(invar,:)) disp(vvarvecm(invar,:))
disp('These variables are excluded from SA') disp('These variables are excluded from SA')
@ -427,7 +425,7 @@ else
vvarvecm=vvarvecm(ivar,:); vvarvecm=vvarvecm(ivar,:);
rmse_MC=rmse_MC(:,ivar); rmse_MC=rmse_MC(:,ivar);
disp(' ') skipline()
% if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior, % if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior,
disp(['Sample filtered the ',num2str(pfilt*100),'% best RMSE''s for each observed series ...' ]) disp(['Sample filtered the ',num2str(pfilt*100),'% best RMSE''s for each observed series ...' ])
% else % else
@ -437,8 +435,7 @@ else
% set(gca,'xticklabel',vvarvecm) % set(gca,'xticklabel',vvarvecm)
% saveas(gcf,[fname_,'_SA_RMSE']) % saveas(gcf,[fname_,'_SA_RMSE'])
disp(' ') skipline(2)
disp(' ')
disp('RMSE ranges after filtering:') disp('RMSE ranges after filtering:')
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior, if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior,
disp([' best ',num2str(pfilt*100),'% filtered remaining 90%']) disp([' best ',num2str(pfilt*100),'% filtered remaining 90%'])
@ -461,7 +458,7 @@ else
%%%%% R2 table %%%%% R2 table
disp(' ') skipline()
disp('R2 over the MC sample:') disp('R2 over the MC sample:')
disp(' min yr R2 max yr R2') disp(' min yr R2 max yr R2')
for j=1:size(vvarvecm,1), for j=1:size(vvarvecm,1),
@ -469,11 +466,10 @@ else
end end
r2_MC=r2_MC(:,ivar); r2_MC=r2_MC(:,ivar);
disp(' ') skipline()
disp(['Sample filtered the ',num2str(pfilt*100),'% best R2''s for each observed series ...' ]) disp(['Sample filtered the ',num2str(pfilt*100),'% best R2''s for each observed series ...' ])
disp(' ') skipline()
disp(' ')
disp('R2 ranges after filtering:') disp('R2 ranges after filtering:')
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior, if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior,
disp([' best ',num2str(pfilt*100),'% filtered remaining 90%']) disp([' best ',num2str(pfilt*100),'% filtered remaining 90%'])
@ -511,14 +507,13 @@ else
% snam=bayestopt_.name(find(nsp>0)); % snam=bayestopt_.name(find(nsp>0));
nsnam=(find(nsp>1)); nsnam=(find(nsp>1));
disp(' ') skipline(2
disp(' ')
disp('These parameters do not affect significantly the fit of ANY observed series:') disp('These parameters do not affect significantly the fit of ANY observed series:')
disp(snam0) disp(snam0)
disp(' ') skipline()
disp('These parameters affect ONE single observed series:') disp('These parameters affect ONE single observed series:')
disp(snam1) disp(snam1)
disp(' ') skipline()
disp('These parameters affect MORE THAN ONE observed series: trade off exists!') disp('These parameters affect MORE THAN ONE observed series: trade off exists!')
disp(snam2) disp(snam2)
@ -594,8 +589,7 @@ else
nsx(j)=length(find(SP(:,j))); nsx(j)=length(find(SP(:,j)));
end end
disp(' ') skipline(2
disp(' ')
disp('Sensitivity table (significance and direction):') disp('Sensitivity table (significance and direction):')
vav=char(zeros(1, size(param_names,2)+3 )); vav=char(zeros(1, size(param_names,2)+3 ));
ibl = 12-size(vvarvecm,2); ibl = 12-size(vvarvecm,2);
@ -610,8 +604,7 @@ else
end end
disp(' ') skipline()
disp(' ')
disp('Starting bivariate analysis:') disp('Starting bivariate analysis:')
for i=1:size(vvarvecm,1) for i=1:size(vvarvecm,1)

View File

@ -56,6 +56,6 @@ for i=1:nrun,
end end
dyn_waitbar(i/nrun,h) dyn_waitbar(i/nrun,h)
end end
disp(' ') skipline()
disp('.. done !') disp('.. done !')
dyn_waitbar_close(h) dyn_waitbar_close(h)

View File

@ -39,5 +39,5 @@ global options_ M_
dyn_waitbar(j/nsam,h) dyn_waitbar(j/nsam,h)
end end
dyn_waitbar_close(h) dyn_waitbar_close(h)
disp(' ') skipline()
disp('... done !') disp('... done !')

View File

@ -116,7 +116,7 @@ for j=1:size(anamendo,1)
for jx=1:size(anamexo,1) for jx=1:size(anamexo,1)
namexo=deblank(anamexo(jx,:)); namexo=deblank(anamexo(jx,:));
iexo=strmatch(namexo,M_.exo_names,'exact'); iexo=strmatch(namexo,M_.exo_names,'exact');
disp(' ') skipline()
disp(['[', namendo,' vs. ',namexo,']']) disp(['[', namendo,' vs. ',namexo,']'])
@ -162,7 +162,7 @@ for j=1:size(anamendo,1)
for jp=1:length(indsmirnov), for jp=1:length(indsmirnov),
disp([M_.param_names(estim_params_.param_vals(indsmirnov(jp),1),:),' d-stat = ', num2str(dproba(indsmirnov(jp)),'%1.3f'),' p-value = ', num2str(proba(indsmirnov(jp)),'%1.3f')]) disp([M_.param_names(estim_params_.param_vals(indsmirnov(jp),1),:),' d-stat = ', num2str(dproba(indsmirnov(jp)),'%1.3f'),' p-value = ', num2str(proba(indsmirnov(jp)),'%1.3f')])
end end
disp(' '); skipline()
stab_map_1(x0, iy, iyc, 'threshold',pvalue_ks,indsmirnov,xdir,[],['Reduced Form Mapping (Threshold) for ', namendo,' vs. lagged ', namexo]); stab_map_1(x0, iy, iyc, 'threshold',pvalue_ks,indsmirnov,xdir,[],['Reduced Form Mapping (Threshold) for ', namendo,' vs. lagged ', namexo]);
stab_map_2(x0(iy,:),alpha2,pvalue_corr,'inside_threshold',xdir,[],['Reduced Form Mapping (Inside Threshold)for ', namendo,' vs. lagged ', namexo]) stab_map_2(x0(iy,:),alpha2,pvalue_corr,'inside_threshold',xdir,[],['Reduced Form Mapping (Inside Threshold)for ', namendo,' vs. lagged ', namexo])
stab_map_2(x0(iyc,:),alpha2,pvalue_corr,'outside_threshold',xdir,[],['Reduced Form Mapping (Outside Threshold) for ', namendo,' vs. lagged ', namexo]) stab_map_2(x0(iyc,:),alpha2,pvalue_corr,'outside_threshold',xdir,[],['Reduced Form Mapping (Outside Threshold) for ', namendo,' vs. lagged ', namexo])
@ -218,7 +218,7 @@ for j=1:size(anamendo,1)
for je=1:size(anamlagendo,1) for je=1:size(anamlagendo,1)
namlagendo=deblank(anamlagendo(je,:)); namlagendo=deblank(anamlagendo(je,:));
ilagendo=strmatch(namlagendo,M_.endo_names(oo_.dr.order_var(M_.nstatic+1:M_.nstatic+nsok),:),'exact'); ilagendo=strmatch(namlagendo,M_.endo_names(oo_.dr.order_var(M_.nstatic+1:M_.nstatic+nsok),:),'exact');
disp(' ') skipline()
disp(['[', namendo,' vs. lagged ',namlagendo,']']) disp(['[', namendo,' vs. lagged ',namlagendo,']'])
if ~isempty(ilagendo), if ~isempty(ilagendo),
@ -261,7 +261,7 @@ for j=1:size(anamendo,1)
for jp=1:length(indsmirnov), for jp=1:length(indsmirnov),
disp([M_.param_names(estim_params_.param_vals(indsmirnov(jp),1),:),' d-stat = ', num2str(dproba(indsmirnov(jp)),'%1.3f'),' p-value = ', num2str(proba(indsmirnov(jp)),'%1.3f')]) disp([M_.param_names(estim_params_.param_vals(indsmirnov(jp),1),:),' d-stat = ', num2str(dproba(indsmirnov(jp)),'%1.3f'),' p-value = ', num2str(proba(indsmirnov(jp)),'%1.3f')])
end end
disp(' '); skipline()
stab_map_1(x0, iy, iyc, 'threshold',pvalue_ks,indsmirnov,xdir,[],['Reduced Form Mapping (Threshold) for ', namendo,' vs. lagged ', namlagendo]); stab_map_1(x0, iy, iyc, 'threshold',pvalue_ks,indsmirnov,xdir,[],['Reduced Form Mapping (Threshold) for ', namendo,' vs. lagged ', namlagendo]);
stab_map_2(x0(iy,:),alpha2,pvalue_corr,'inside_threshold',xdir,[],['Reduced Form Mapping (Inside Threshold) for ', namendo,' vs. lagged ', namlagendo]) stab_map_2(x0(iy,:),alpha2,pvalue_corr,'inside_threshold',xdir,[],['Reduced Form Mapping (Inside Threshold) for ', namendo,' vs. lagged ', namlagendo])
stab_map_2(x0(iyc,:),alpha2,pvalue_corr,'outside_threshold',xdir,[],['Reduced Form Mapping (Outside Threshold) for ', namendo,' vs. lagged ', namlagendo]) stab_map_2(x0(iyc,:),alpha2,pvalue_corr,'outside_threshold',xdir,[],['Reduced Form Mapping (Outside Threshold) for ', namendo,' vs. lagged ', namlagendo])

View File

@ -499,9 +499,9 @@ if length(iunstable)>0 && length(iunstable)<Nsam,
fprintf(['%4.1f%% of the prior support gives indeterminacy.'],length(iindeterm)/Nsam*100) fprintf(['%4.1f%% of the prior support gives indeterminacy.'],length(iindeterm)/Nsam*100)
end end
if ~isempty(iwrong), if ~isempty(iwrong),
disp(' '); skipline()
disp(['For ',num2str(length(iwrong)/Nsam*100,'%1.3f'),'\% of the prior support dynare could not find a solution.']) disp(['For ',num2str(length(iwrong)/Nsam*100,'%1.3f'),'\% of the prior support dynare could not find a solution.'])
disp(' '); skipline()
if any(infox==1), if any(infox==1),
disp([' For ',num2str(length(find(infox==1))/Nsam*100,'%1.3f'),'\% The model doesn''t determine the current variables uniquely.']) disp([' For ',num2str(length(find(infox==1))/Nsam*100,'%1.3f'),'\% The model doesn''t determine the current variables uniquely.'])
end end
@ -534,7 +534,7 @@ if length(iunstable)>0 && length(iunstable)<Nsam,
end end
end end
disp(' '); skipline()
% Blanchard Kahn % Blanchard Kahn
[proba, dproba] = stab_map_1(lpmat, istable, iunstable, aname,0); [proba, dproba] = stab_map_1(lpmat, istable, iunstable, aname,0);
% indstab=find(dproba>ksstat); % indstab=find(dproba>ksstat);
@ -543,7 +543,7 @@ if length(iunstable)>0 && length(iunstable)<Nsam,
for j=1:length(indstab), for j=1:length(indstab),
disp([M_.param_names(estim_params_.param_vals(indstab(j),1),:),' d-stat = ', num2str(dproba(indstab(j)),'%1.3f'),' p-value = ', num2str(proba(indstab(j)),'%1.3f')]) disp([M_.param_names(estim_params_.param_vals(indstab(j),1),:),' d-stat = ', num2str(dproba(indstab(j)),'%1.3f'),' p-value = ', num2str(proba(indstab(j)),'%1.3f')])
end end
disp(' '); skipline()
if ~isempty(indstab) if ~isempty(indstab)
stab_map_1(lpmat, istable, iunstable, aname, 1, indstab, OutputDirectoryName,[],atitle); stab_map_1(lpmat, istable, iunstable, aname, 1, indstab, OutputDirectoryName,[],atitle);
end end
@ -556,7 +556,7 @@ if length(iunstable)>0 && length(iunstable)<Nsam,
for j=1:length(indindet), for j=1:length(indindet),
disp([M_.param_names(estim_params_.param_vals(indindet(j),1),:),' d-stat = ', num2str(dproba(indindet(j)),'%1.3f'),' p-value = ', num2str(proba(indindet(j)),'%1.3f')]) disp([M_.param_names(estim_params_.param_vals(indindet(j),1),:),' d-stat = ', num2str(dproba(indindet(j)),'%1.3f'),' p-value = ', num2str(proba(indindet(j)),'%1.3f')])
end end
disp(' '); skipline()
if ~isempty(indindet) if ~isempty(indindet)
stab_map_1(lpmat, [1:Nsam], iindeterm, aindetname, 1, indindet, OutputDirectoryName,[],aindettitle); stab_map_1(lpmat, [1:Nsam], iindeterm, aindetname, 1, indindet, OutputDirectoryName,[],aindettitle);
end end
@ -570,7 +570,7 @@ if length(iunstable)>0 && length(iunstable)<Nsam,
for j=1:length(indunst), for j=1:length(indunst),
disp([M_.param_names(estim_params_.param_vals(indunst(j),1),:),' d-stat = ', num2str(dproba(indunst(j)),'%1.3f'),' p-value = ', num2str(proba(indunst(j)),'%1.3f')]) disp([M_.param_names(estim_params_.param_vals(indunst(j),1),:),' d-stat = ', num2str(dproba(indunst(j)),'%1.3f'),' p-value = ', num2str(proba(indunst(j)),'%1.3f')])
end end
disp(' '); skipline()
if ~isempty(indunst) if ~isempty(indunst)
stab_map_1(lpmat, [1:Nsam], ixun, aunstablename, 1, indunst, OutputDirectoryName,[],aunstabletitle); stab_map_1(lpmat, [1:Nsam], ixun, aunstablename, 1, indunst, OutputDirectoryName,[],aunstabletitle);
end end
@ -584,13 +584,13 @@ if length(iunstable)>0 && length(iunstable)<Nsam,
for j=1:length(indwrong), for j=1:length(indwrong),
disp([M_.param_names(estim_params_.param_vals(indwrong(j),1),:),' d-stat = ', num2str(dproba(indwrong(j)),'%1.3f'),' p-value = ', num2str(proba(indwrong(j)),'%1.3f')]) disp([M_.param_names(estim_params_.param_vals(indwrong(j),1),:),' d-stat = ', num2str(dproba(indwrong(j)),'%1.3f'),' p-value = ', num2str(proba(indwrong(j)),'%1.3f')])
end end
disp(' '); skipline()
if ~isempty(indwrong) if ~isempty(indwrong)
stab_map_1(lpmat, [1:Nsam], iwrong, awronguniname, 1, indwrong, OutputDirectoryName,[],awrongunititle); stab_map_1(lpmat, [1:Nsam], iwrong, awronguniname, 1, indwrong, OutputDirectoryName,[],awrongunititle);
end end
end end
disp(' ') skipline()
disp('Starting bivariate analysis:') disp('Starting bivariate analysis:')
c0=corrcoef(lpmat(istable,:)); c0=corrcoef(lpmat(istable,:));

View File

@ -122,4 +122,4 @@ disp(['MH: Total number of generated files : ' int2str(NewFile(1)*nblck) '.
disp(['MH: Total number of iterations : ' int2str((NewFile(1)-1)*MAX_nruns+irun-1) '.']) disp(['MH: Total number of iterations : ' int2str((NewFile(1)-1)*MAX_nruns+irun-1) '.'])
disp('MH: average acceptation rate per chain : ') disp('MH: average acceptation rate per chain : ')
disp(record.AcceptationRates); disp(record.AcceptationRates);
disp(' ') skipline()

View File

@ -130,7 +130,7 @@ for b = fblck:nblck,
end end
if exist('OCTAVE_VERSION') || options_.console_mode if exist('OCTAVE_VERSION') || options_.console_mode
diary off diary off
disp(' ') skipline()
elseif whoiam elseif whoiam
% keyboard; % keyboard;
waitbarString = ['Please wait... Metropolis-Hastings (' int2str(b) '/' int2str(options_.mh_nblck) ')...']; waitbarString = ['Please wait... Metropolis-Hastings (' int2str(b) '/' int2str(options_.mh_nblck) ')...'];

View File

@ -60,8 +60,7 @@ fprintf(' Done!\n');
%% (usefull if the user wants to perform some computations using %% (usefull if the user wants to perform some computations using
%% the posterior mean instead of the posterior mode ==> ). %% the posterior mean instead of the posterior mode ==> ).
save([M_.fname '_mean.mat'],'xparam1','hh','SIGMA'); save([M_.fname '_mean.mat'],'xparam1','hh','SIGMA');
skipline()
disp(' ');
disp('MH: I''m computing the posterior log marginal density (modified harmonic mean)... '); disp('MH: I''m computing the posterior log marginal density (modified harmonic mean)... ');
detSIGMA = det(SIGMA); detSIGMA = det(SIGMA);
invSIGMA = inv(SIGMA); invSIGMA = inv(SIGMA);

View File

@ -127,9 +127,15 @@ if ~options_.load_mh_file && ~options_.mh_recover
init_iter = init_iter + 1; init_iter = init_iter + 1;
if init_iter > 100 && validate == 0 if init_iter > 100 && validate == 0
disp(['MH: I couldn''t get a valid initial value in 100 trials.']) disp(['MH: I couldn''t get a valid initial value in 100 trials.'])
disp(['MH: You should Reduce mh_init_scale...']) if options_.nointeractive
disp(sprintf('MH: Parameter mh_init_scale is equal to %f.',options_.mh_init_scale)) disp(['MH: I reduce mh_init_scale by ten percent:'])
options_.mh_init_scale = input('MH: Enter a new value... '); options_.mh_init_scale = .9*options_.mh_init_scale;
disp(sprintf('MH: Parameter mh_init_scale is now equal to %f.',options_.mh_init_scale))
else
disp(['MH: You should Reduce mh_init_scale...'])
disp(sprintf('MH: Parameter mh_init_scale is equal to %f.',options_.mh_init_scale))
options_.mh_init_scale = input('MH: Enter a new value... ');
end
trial = trial+1; trial = trial+1;
end end
end end
@ -140,7 +146,7 @@ if ~options_.load_mh_file && ~options_.mh_recover
end end
fprintf(fidlog,' \n'); fprintf(fidlog,' \n');
disp('MH: Initial values found!') disp('MH: Initial values found!')
disp(' ') skipline()
else% Case 2: one chain (we start from the posterior mode) else% Case 2: one chain (we start from the posterior mode)
fprintf(fidlog,[' Initial values of the parameters:\n']); fprintf(fidlog,[' Initial values of the parameters:\n']);
candidate = transpose(xparam1(:));% candidate = transpose(xparam1(:));%
@ -148,7 +154,7 @@ if ~options_.load_mh_file && ~options_.mh_recover
ix2 = candidate; ix2 = candidate;
ilogpo2 = - feval(TargetFun,ix2',dataset_,options_,M_,estim_params_,bayestopt_,oo_); ilogpo2 = - feval(TargetFun,ix2',dataset_,options_,M_,estim_params_,bayestopt_,oo_);
disp('MH: Initialization at the posterior mode.') disp('MH: Initialization at the posterior mode.')
disp(' ') skipline()
fprintf(fidlog,[' Blck ' int2str(1) 'params:\n']); fprintf(fidlog,[' Blck ' int2str(1) 'params:\n']);
for i=1:length(ix2(1,:)) for i=1:length(ix2(1,:))
fprintf(fidlog,[' ' int2str(i) ':' num2str(ix2(1,i)) '\n']); fprintf(fidlog,[' ' int2str(i) ':' num2str(ix2(1,i)) '\n']);
@ -270,13 +276,13 @@ elseif options_.load_mh_file && ~options_.mh_recover
record.MhDraws(end,3) = AnticipatedNumberOfLinesInTheLastFile; record.MhDraws(end,3) = AnticipatedNumberOfLinesInTheLastFile;
save([MhDirectoryName '/' ModelName '_mh_history.mat'],'record'); save([MhDirectoryName '/' ModelName '_mh_history.mat'],'record');
disp(['MH: ... It''s done. I''ve loaded ' int2str(NumberOfPreviousSimulations) ' simulations.']) disp(['MH: ... It''s done. I''ve loaded ' int2str(NumberOfPreviousSimulations) ' simulations.'])
disp(' ') skipline()
fclose(fidlog); fclose(fidlog);
elseif options_.mh_recover elseif options_.mh_recover
%% The previous metropolis-hastings crashed before the end! I try to %% The previous metropolis-hastings crashed before the end! I try to
%% recover the saved draws... %% recover the saved draws...
disp('MH: Recover mode!') disp('MH: Recover mode!')
disp(' ') skipline()
file = dir([MhDirectoryName '/' ModelName '_mh_history.mat']); file = dir([MhDirectoryName '/' ModelName '_mh_history.mat']);
if ~length(file) if ~length(file)
error('MH:: FAILURE! there is no MH-history file!') error('MH:: FAILURE! there is no MH-history file!')

View File

@ -65,11 +65,11 @@ end
fval = feval(fun,x,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults); fval = feval(fun,x,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);
if ~isempty(hessian); if ~isempty(hessian);
disp(' ') skipline()
disp('MODE CHECK') disp('MODE CHECK')
disp(' ') skipline()
disp(sprintf('Fval obtained by the minimization routine: %f', fval)) disp(sprintf('Fval obtained by the minimization routine: %f', fval))
disp(' ') skipline()
if s_min<eps if s_min<eps
disp(sprintf('Most negative variance %f for parameter %d (%s = %f)', s_min, k , BayesInfo.name{k}, x(k))) disp(sprintf('Most negative variance %f for parameter %d (%s = %f)', s_min, k , BayesInfo.name{k}, x(k)))
end end

View File

@ -31,8 +31,7 @@ function PosteriorOddsTable = model_comparison(ModelNames,ModelPriors,oo,options
NumberOfModels = size(ModelNames,2); NumberOfModels = size(ModelNames,2);
disp(' ') skipline(2)
disp(' ')
if isempty(ModelPriors) if isempty(ModelPriors)
prior_flag = 0;% empty_prior=0 prior_flag = 0;% empty_prior=0
ModelPriors = ones(NumberOfModels,1)/NumberOfModels; ModelPriors = ones(NumberOfModels,1)/NumberOfModels;

View File

@ -129,7 +129,7 @@ for k=1:nvar
%--------- The 1st set of draws to be tossed away. ------------------ %--------- The 1st set of draws to be tossed away. ------------------
for draws = 1:ndraws1 for draws = 1:ndraws1
if ~mod(draws,nbuffer) if ~mod(draws,nbuffer)
disp(' ') skipline()
disp(sprintf('The %dth column or equation in A0 with %d 1st tossed-away draws in Gibbs',k,draws)) disp(sprintf('The %dth column or equation in A0 with %d 1st tossed-away draws in Gibbs',k,draws))
end end
A0gbs1 = fn_gibbsrvar(A0gbs0,UT,nvar,fss,n0,indx_ks); A0gbs1 = fn_gibbsrvar(A0gbs0,UT,nvar,fss,n0,indx_ks);
@ -140,7 +140,7 @@ for k=1:nvar
%--------- The 2nd set of draws to be used. ------------------ %--------- The 2nd set of draws to be used. ------------------
for draws = 1:ndraws2 for draws = 1:ndraws2
if ~mod(draws,nbuffer) if ~mod(draws,nbuffer)
disp(' ') skipline()
disp(sprintf('The %dth column or equation in A0 with %d usable draws in Gibbs',k,draws)) disp(sprintf('The %dth column or equation in A0 with %d usable draws in Gibbs',k,draws))
end end
[A0gbs1, Wcell] = fn_gibbsrvar(A0gbs0,UT,nvar,fss,n0,indx_ks); [A0gbs1, Wcell] = fn_gibbsrvar(A0gbs0,UT,nvar,fss,n0,indx_ks);
@ -162,7 +162,7 @@ for k=1:nvar
vlog_a0_Yao(k) = vlogxhat; vlog_a0_Yao(k) = vlogxhat;
% The log value of p(a0_k|Y,a_others) where a_others: other a's at some point such as the peak of ONLY some a0's % The log value of p(a0_k|Y,a_others) where a_others: other a's at some point such as the peak of ONLY some a0's
else else
disp(' ') skipline()
disp(sprintf('The last(6th) column or equation in A0 with no Gibbs draws')) disp(sprintf('The last(6th) column or equation in A0 with no Gibbs draws'))
[A0gbs1, Wcell] = fn_gibbsrvar(A0gbs0,UT,nvar,fss,n0,indx_ks) [A0gbs1, Wcell] = fn_gibbsrvar(A0gbs0,UT,nvar,fss,n0,indx_ks)
%------ See p.71, Forecast (II). %------ See p.71, Forecast (II).
@ -191,7 +191,6 @@ disp('Posterior pdf -- log(p(aphat|a0hat, Y)):');
vlog_ap_Ya0 vlog_ap_Ya0
%--------- The value of marginal density p(Y) ---------- %--------- The value of marginal density p(Y) ----------
disp(' '); skipline()
disp(' ');
disp('************ Marginal Likelihood of Y or Marginal Data Density: ************'); disp('************ Marginal Likelihood of Y or Marginal Data Density: ************');
vlogY = vlog_a0p+vlog_Y_a-sum(vlog_a0_Yao)-vlog_ap_Ya0 vlogY = vlog_a0p+vlog_Y_a-sum(vlog_a0_Yao)-vlog_ap_Ya0

View File

@ -154,7 +154,7 @@ if cnum
end end
% %
pause(1) pause(1)
disp(' ') skipline()
disp('For uncondtional forecasts, set nconstr = options_.ms.cms = cnum = 0') disp('For uncondtional forecasts, set nconstr = options_.ms.cms = cnum = 0')
pause(1) pause(1)
% %
@ -296,12 +296,12 @@ if options_.ms.indxestima
%* Obtain linear restrictions %* Obtain linear restrictions
[Uiconst,Viconst,n0,np,ixmC0Pres] = feval(options_.ms.restriction_fname,nvar,nexo,options_.ms ); [Uiconst,Viconst,n0,np,ixmC0Pres] = feval(options_.ms.restriction_fname,nvar,nexo,options_.ms );
if min(n0)==0 if min(n0)==0
disp(' ') skipline()
warning('A0: restrictions in dlrprior.m give no free parameter in one of equations') warning('A0: restrictions in dlrprior.m give no free parameter in one of equations')
disp('Press ctrl-c to abort') disp('Press ctrl-c to abort')
pause pause
elseif min(np)==0 elseif min(np)==0
disp(' ') skipline()
warning('Ap: Restrictions in dlrprior.m give no free parameter in one of equations') warning('Ap: Restrictions in dlrprior.m give no free parameter in one of equations')
disp('Press ctrl-c to abort') disp('Press ctrl-c to abort')
pause pause

View File

@ -61,7 +61,7 @@ nvar = size(options_.varobs,1); % number of endogenous variables
nlogeno = length(options_.ms.log_var); % number of endogenous variables in options_.ms.log_var nlogeno = length(options_.ms.log_var); % number of endogenous variables in options_.ms.log_var
npereno = length(options_.ms.percent_var); % number of endogenous variables in options_.ms.percent_var npereno = length(options_.ms.percent_var); % number of endogenous variables in options_.ms.percent_var
if (nvar~=(nlogeno+npereno)) if (nvar~=(nlogeno+npereno))
disp(' ') skipline()
warning('Check xlab, nlogeno or npereno to make sure of endogenous variables in options_.ms.vlist') warning('Check xlab, nlogeno or npereno to make sure of endogenous variables in options_.ms.vlist')
disp('Press ctrl-c to abort') disp('Press ctrl-c to abort')
return return
@ -70,7 +70,7 @@ elseif (nvar==length(options_.ms.vlist))
elseif (nvar<length(options_.ms.vlist)) elseif (nvar<length(options_.ms.vlist))
nexo=length(options_.ms.vlist)-nvar+1; nexo=length(options_.ms.vlist)-nvar+1;
else else
disp(' ') skipline()
warning('Make sure there are only nvar endogenous variables in options_.ms.vlist') warning('Make sure there are only nvar endogenous variables in options_.ms.vlist')
disp('Press ctrl-c to abort') disp('Press ctrl-c to abort')
return return

View File

@ -129,5 +129,5 @@ if nvar > 0 && options_.noprint == 0
end end
lh = size(labels,2)+2; lh = size(labels,2)+2;
dyntable(my_title,headers,labels,res_table,lh,10,6); dyntable(my_title,headers,labels,res_table,lh,10,6);
disp(' ') skipline()
end end

View File

@ -214,10 +214,10 @@ while norm(gg)>gtol && check==0 && jit<nit
end end
if htol0>htol if htol0>htol
htol=htol0; htol=htol0;
disp(' ') skipline()
disp('Numerical noise in the likelihood') disp('Numerical noise in the likelihood')
disp('Tolerance has to be relaxed') disp('Tolerance has to be relaxed')
disp(' ') skipline()
end end
if ~outer_product_gradient, if ~outer_product_gradient,
H = bfgsi1(H,gg-g(:,icount),xparam1-x(:,icount)); H = bfgsi1(H,gg-g(:,icount),xparam1-x(:,icount));
@ -256,16 +256,16 @@ end
save m1.mat x hh g hhg igg fval0 nig save m1.mat x hh g hhg igg fval0 nig
if ftol>ftol0 if ftol>ftol0
disp(' ') skipline()
disp('Numerical noise in the likelihood') disp('Numerical noise in the likelihood')
disp('Tolerance had to be relaxed') disp('Tolerance had to be relaxed')
disp(' ') skipline()
end end
if jit==nit if jit==nit
disp(' ') skipline()
disp('Maximum number of iterations reached') disp('Maximum number of iterations reached')
disp(' ') skipline()
end end
if norm(gg)<=gtol if norm(gg)<=gtol

View File

@ -34,9 +34,9 @@ for i=1:np
i_params(i) = strmatch(deblank(params(i,:)),M_.param_names,'exact'); i_params(i) = strmatch(deblank(params(i,:)),M_.param_names,'exact');
end end
disp(' ') skipline()
disp('OPTIMAL SIMPLE RULE') disp('OPTIMAL SIMPLE RULE')
disp(' ') skipline()
osr1(i_params,i_var,W); osr1(i_params,i_var,W);
stoch_simul(var_list); stoch_simul(var_list);

View File

@ -63,14 +63,14 @@ oo_.osr.objective_function = f;
disp('') skipline()
disp('OPTIMAL VALUE OF THE PARAMETERS:') disp('OPTIMAL VALUE OF THE PARAMETERS:')
disp('') skipline()
for i=1:np for i=1:np
disp(sprintf('%16s %16.6g\n',M_.param_names(i_params(i),:),p(i))) disp(sprintf('%16s %16.6g\n',M_.param_names(i_params(i),:),p(i)))
end end
disp(sprintf('Objective function : %16.6g\n',f)); disp(sprintf('Objective function : %16.6g\n',f));
disp(' ') skipline()
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); [oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
% 05/10/03 MJ modified to work with osr.m and give full report % 05/10/03 MJ modified to work with osr.m and give full report

View File

@ -123,11 +123,9 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
Environment= (OScallerUnix || OStargetUnix); Environment= (OScallerUnix || OStargetUnix);
disp(' '); skipline(2)
disp(' ');
disp(['Testing computer -> ',DataInput(Node).ComputerName,' <- ...']); disp(['Testing computer -> ',DataInput(Node).ComputerName,' <- ...']);
disp(' '); skipline(2)
disp(' ');
% The function is composed by two main blocks, determined by the 'Local' % The function is composed by two main blocks, determined by the 'Local'
% variable. % variable.
@ -138,18 +136,14 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
if ((DataInput(Node).Local == 0) |(DataInput(Node).Local == 1)) if ((DataInput(Node).Local == 0) |(DataInput(Node).Local == 1))
% Continue it is Ok! % Continue it is Ok!
disp('Check on Local Variable ..... Ok!'); disp('Check on Local Variable ..... Ok!');
disp(' '); skipline()
disp(' ');
else else
disp('The variable "Local" has a bad value!'); disp('The variable "Local" has a bad value!');
disp(' '); skipline()
disp('ErrorCode 1.'); disp('ErrorCode 1.');
disp(' '); skipline()
disp(' ');
ErrorCode=1; ErrorCode=1;
return return
end end
% %%%%%%%%%% Local (No Network) Computing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%% Local (No Network) Computing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -189,17 +183,14 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
end end
if (si1) if (si1)
disp(['It is impossibile to ping to the computer with name "',DataInput(Node).ComputerName,'" using the network!']); disp(['It is impossibile to ping to the computer with name "',DataInput(Node).ComputerName,'" using the network!'])
disp(' '); skipline()
disp('ErrorCode 3.'); disp('ErrorCode 3.')
ErrorCode=3; ErrorCode=3;
disp(' '); skipline(2)
disp(' ');
% return;
else else
disp('Check on ComputerName Variable ..... Ok!'); disp('Check on ComputerName Variable ..... Ok!')
disp(' '); skipline(2)
disp(' ');
end end
@ -212,34 +203,29 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
% strategy. % strategy.
if (isempty(DataInput(Node).UserName)) if (isempty(DataInput(Node).UserName))
disp('The fields UserName is empty!'); disp('The fields UserName is empty!')
disp(' '); skipline()
disp('ErrorCode 4.'); disp('ErrorCode 4.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=4; ErrorCode=4;
return return
end end
disp('Check on UserName Variable ..... Ok!'); disp('Check on UserName Variable ..... Ok!')
disp(' '); skipline(2)
disp(' ');
% This check can be removed ... according to the dynare parser % This check can be removed ... according to the dynare parser
% strategy. % strategy.
if (~isempty(DataInput(Node).Password)) if (~isempty(DataInput(Node).Password))
disp('[WARNING] The field Password should be empty under unix or mac!'); disp('[WARNING] The field Password should be empty under unix or mac!');
disp(' '); skipline()
disp(['Remove the string ',DataInput(Node).Password,' from this field!']); disp(['Remove the string ',DataInput(Node).Password,' from this field!'])
disp(' '); skipline()
disp('ErrorCode 4.'); disp('ErrorCode 4.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=4; ErrorCode=4;
% return
else else
disp('Check on Password Variable ..... Ok!'); disp('Check on Password Variable ..... Ok!')
disp(' '); skipline(2)
disp(' ');
end end
else else
@ -248,20 +234,16 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
if (isempty(DataInput(Node).UserName)) || (isempty(DataInput(Node).Password)) if (isempty(DataInput(Node).UserName)) || (isempty(DataInput(Node).Password))
disp('The fields UserName and/or Password are/is empty!'); disp('The fields UserName and/or Password are/is empty!');
disp(' '); skipline()
disp('ErrorCode 4.'); disp('ErrorCode 4.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=4; ErrorCode=4;
return return
end end
disp('Check on UserName Variable ..... Ok!'); disp('Check on UserName Variable ..... Ok!');
disp(' '); skipline()
disp(' ');
disp('Check on Password Variable ..... Ok!'); disp('Check on Password Variable ..... Ok!');
disp(' '); skipline()
disp(' ');
end end
% Now we very if RemoteDrive and/or RemoteDirectory exist on remote % Now we very if RemoteDrive and/or RemoteDirectory exist on remote
@ -273,11 +255,10 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
% strategy. % strategy.
if isempty(DataInput(Node).RemoteDirectory) if isempty(DataInput(Node).RemoteDirectory)
disp('The field RemoteDirectory is empty!'); disp('The field RemoteDirectory is empty!')
disp(' '); skipline()
disp('ErrorCode 5.'); disp('ErrorCode 5.')
disp(' '); skipline()
disp(' ');
ErrorCode=5; ErrorCode=5;
return return
end end
@ -286,15 +267,13 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
% strategy. % strategy.
if (~isempty(DataInput(Node).RemoteDrive)) if (~isempty(DataInput(Node).RemoteDrive))
disp('[WARNING] The fields RemoteDrive should be empty under unix or mac!'); disp('[WARNING] The fields RemoteDrive should be empty under unix or mac!')
disp(' '); skipline()
disp(['remove the string ',DataInput(Node).RemoteDrive,' from this field!']); disp(['remove the string ',DataInput(Node).RemoteDrive,' from this field!'])
disp(' '); skipline()
disp('ErrorCode 5.'); disp('ErrorCode 5.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=5; ErrorCode=5;
% return
end end
si2=[]; si2=[];
@ -308,32 +287,28 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
[si2 de2]=system(['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' ls ',DataInput(Node).RemoteDirectory,'/',RemoteTmpFolder,'/']); [si2 de2]=system(['ssh ',ssh_token,' ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' ls ',DataInput(Node).RemoteDirectory,'/',RemoteTmpFolder,'/']);
if (si2) if (si2)
disp ('Remote Directory does not exist or is not reachable!'); disp ('Remote Directory does not exist or is not reachable!')
disp(' '); skipline()
disp('ErrorCode 5.'); disp('ErrorCode 5.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=5; ErrorCode=5;
return return
end end
disp('Check on RemoteDirectory Variable ..... Ok!'); disp('Check on RemoteDirectory Variable ..... Ok!')
disp(' '); skipline(2)
disp(' '); disp('Check on RemoteDrive Variable ..... Ok!')
disp('Check on RemoteDrive Variable ..... Ok!'); skipline(2)
disp(' ');
disp(' ');
else else
% This check can be removed ... according to the dynare parser % This check can be removed ... according to the dynare parser
% strategy. % strategy.
if (isempty(DataInput(Node).RemoteDrive)||isempty(DataInput(Node).RemoteDirectory)) if (isempty(DataInput(Node).RemoteDrive)||isempty(DataInput(Node).RemoteDirectory))
disp('Remote RemoteDrive and/or RemoteDirectory is/are empty!'); disp('Remote RemoteDrive and/or RemoteDirectory is/are empty!')
disp(' '); skipline()
disp('ErrorCode 5.'); disp('ErrorCode 5.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=5; ErrorCode=5;
return return
end end
@ -344,21 +319,18 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
[si2 de2]=system(['dir \\',DataInput(Node).ComputerName,'\',DataInput(Node).RemoteDrive,'$\',DataInput(Node).RemoteDirectory,'\',RemoteTmpFolder]); [si2 de2]=system(['dir \\',DataInput(Node).ComputerName,'\',DataInput(Node).RemoteDrive,'$\',DataInput(Node).RemoteDirectory,'\',RemoteTmpFolder]);
if (si2) if (si2)
disp ('Remote Directory does not exist or it is not reachable!'); disp ('Remote Directory does not exist or it is not reachable!')
disp(' '); skipline()
disp('ErrorCode 5.'); disp('ErrorCode 5.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=5; ErrorCode=5;
return return
end end
disp('Check on RemoteDirectory Variable ..... Ok!'); disp('Check on RemoteDirectory Variable ..... Ok!')
disp(' '); skipline(2)
disp(' '); disp('Check on RemoteDrive Variable ..... Ok!')
disp('Check on RemoteDrive Variable ..... Ok!'); skipline(2)
disp(' ');
disp(' ');
end end
@ -407,17 +379,15 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
delete ('Tracing.m'); delete ('Tracing.m');
if (isempty(FindTracing)) if (isempty(FindTracing))
disp ('It is impossible to exchange data with Remote Drive and/or Remote Directory! ErrorCode 6.'); disp('It is impossible to exchange data with Remote Drive and/or Remote Directory! ErrorCode 6.')
disp(' '); skipline()
disp('ErrorCode 6.'); disp('ErrorCode 6.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=6; ErrorCode=6;
return return
else else
disp('Check on Exchange File with Remote Computer ..... Ok!'); disp('Check on Exchange File with Remote Computer ..... Ok!')
disp(' '); skipline(2)
disp(' ');
end end
@ -466,10 +436,10 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
while (1); while (1);
if Flag==0 if Flag==0
disp('Try to run matlab/octave on remote machine ... '); disp('Try to run matlab/octave on remote machine ... ')
disp(' '); skipline()
disp('please wait ... '); disp('please wait ... ')
disp(' '); skipline()
Flag=1; Flag=1;
end end
nt=fix(clock); nt=fix(clock);
@ -486,25 +456,22 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
if (ErrorCode==7) if (ErrorCode==7)
disp ('It is not possible execute a matlab session on remote machine!'); disp ('It is not possible execute a matlab session on remote machine!')
disp(' '); skipline()
disp('ErrorCode 7.'); disp('ErrorCode 7.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=7; ErrorCode=7;
dynareParallelRmDir(RemoteTmpFolder,DataInput(Node)); dynareParallelRmDir(RemoteTmpFolder,DataInput(Node));
return return
else else
disp('Check on MatlabOctave Path and MatlabOctave Program Execution on remote machine ..... Ok!'); disp('Check on MatlabOctave Path and MatlabOctave Program Execution on remote machine ..... Ok!')
disp(' '); skipline(2)
disp(' ');
% Now we verify if the DynarePath is correct ... % Now we verify if the DynarePath is correct ...
disp('Check the Dynare path on remote machine ... '); disp('Check the Dynare path on remote machine ... ')
disp(' '); skipline()
disp('please wait ... '); disp('please wait ... ')
disp(' '); skipline(2)
pause(2) pause(2)
if isempty(dynareParallelDir('DynareIsOk.txt',RemoteTmpFolder,DataInput(Node))) if isempty(dynareParallelDir('DynareIsOk.txt',RemoteTmpFolder,DataInput(Node)))
@ -512,20 +479,16 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
end end
if (ErrorCode==8) if (ErrorCode==8)
disp ('The DynarePath is incorrect!')
disp ('The DynarePath is incorrect!'); skipline()
disp(' '); disp('ErrorCode 8.')
disp('ErrorCode 8.'); skipline(2)
disp(' ');
disp(' ');
ErrorCode=8; ErrorCode=8;
dynareParallelRmDir(RemoteTmpFolder,DataInput(Node)); dynareParallelRmDir(RemoteTmpFolder,DataInput(Node));
return return
else else
disp('Check on Dynare Path remote machine ..... Ok!'); disp('Check on Dynare Path remote machine ..... Ok!')
disp(' '); skipline(2)
disp(' ');
end end
end end
@ -539,15 +502,13 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
si3=dynareParallelDir('Tracing.m', RemoteTmpFolder,DataInput(Node)); si3=dynareParallelDir('Tracing.m', RemoteTmpFolder,DataInput(Node));
if (isempty(si3)) if (isempty(si3))
disp ('Check on Delete Remote Computational Traces ..... Ok!'); disp ('Check on Delete Remote Computational Traces ..... Ok!')
disp(' '); skipline(2)
disp(' ');
else else
disp ('It is impossible to delete temporary files on remote machine!'); disp ('It is impossible to delete temporary files on remote machine!')
disp(' '); skipline()
disp('ErrorCode 9.'); disp('ErrorCode 9.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=9; ErrorCode=9;
return return
end end
@ -563,11 +524,10 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
if yn==1 if yn==1
% The field is empty! % The field is empty!
disp('The field "CPUnbr" is empty!'); disp('The field "CPUnbr" is empty!')
disp(' '); skipline()
disp('ErrorCode 2.'); disp('ErrorCode 2.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=2; ErrorCode=2;
return return
end end
@ -620,16 +580,16 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
if isempty (RealCPUnbr) if isempty (RealCPUnbr)
% An error occurred when we try to know the Cpu/Cores % An error occurred when we try to know the Cpu/Cores
% numbers. % numbers.
disp('It is impossible determine the number of Cpu/Processor avaiable on this machine!'); disp('It is impossible determine the number of Cpu/Processor avaiable on this machine!')
disp(' '); skipline()
disp('ErrorCode 2.'); disp('ErrorCode 2.')
disp(' '); skipline()
if Environment if Environment
disp('Check the command "$less /proc/cpuinfo" ... !'); disp('Check the command "$less /proc/cpuinfo" ... !')
else else
disp('Check if the pstools are installed and are in machine path! And check the command "psinfo \\"'); disp('Check if the pstools are installed and are in machine path! And check the command "psinfo \\"')
end end
disp(' '); skipline()
ErrorCode=2; ErrorCode=2;
return return
end end
@ -642,38 +602,25 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
CPUnbrUser=length(DataInput(Node).CPUnbr); CPUnbrUser=length(DataInput(Node).CPUnbr);
maxCPUnbrUser=max(DataInput(Node).CPUnbr)+1; maxCPUnbrUser=max(DataInput(Node).CPUnbr)+1;
disp(['Hardware has ', num2str(RealCPUnbr),' Cpu/Cores!']); disp(['Hardware has ', num2str(RealCPUnbr),' Cpu/Cores!'])
disp(['User requires ',num2str(CPUnbrUser),' Cpu/Cores!']); disp(['User requires ',num2str(CPUnbrUser),' Cpu/Cores!'])
if CPUnbrUser==RealCPUnbr, if CPUnbrUser==RealCPUnbr,
% It is Ok! % It is Ok!
disp('Check on CPUnbr Variable ..... Ok!'); disp('Check on CPUnbr Variable ..... Ok!')
disp(' '); skipline(3)
disp(' ');
disp(' ');
end end
if CPUnbrUser > RealCPUnbr if CPUnbrUser > RealCPUnbr
disp('Warning! The user asks to use more CPU''s than those available.'); disp('Warning! The user asks to use more CPU''s than those available.')
disp(' '); skipline(2)
disp(' ');
ErrorCode=2.1; ErrorCode=2.1;
% return
end end
if CPUnbrUser < RealCPUnbr if CPUnbrUser < RealCPUnbr
disp('Warning! There are unused CPU''s!'); disp('Warning! There are unused CPU''s!')
disp(' '); skipline(2)
disp(' ');
ErrorCode=2.2; ErrorCode=2.2;
% return
end end
disp(['Test for Cluster computation, computer ',DataInput(Node).ComputerName, ' ..... Passed!']); disp(['Test for Cluster computation, computer ',DataInput(Node).ComputerName, ' ..... Passed!'])
disp(' '); skipline(2)
disp(' '); end
end
return

View File

@ -88,7 +88,7 @@ if SampleSize == 1,
if advanced, if advanced,
if ~options_.nodisplay, if ~options_.nodisplay,
disp(' ') skipline()
disp('Press ENTER to plot advanced diagnostics'), pause(5), disp('Press ENTER to plot advanced diagnostics'), pause(5),
end end
hh = dyn_figure(options_,'Name',[tittxt, ' - Sensitivity plot']); hh = dyn_figure(options_,'Name',[tittxt, ' - Sensitivity plot']);
@ -152,7 +152,7 @@ if SampleSize == 1,
xlabel([tittxt,' - Collinearity patterns with ', int2str(j) ,' parameter(s)'],'interpreter','none') xlabel([tittxt,' - Collinearity patterns with ', int2str(j) ,' parameter(s)'],'interpreter','none')
dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_ident_collinearity_' tittxt1 '_' int2str(j) ],options_); dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_ident_collinearity_' tittxt1 '_' int2str(j) ],options_);
end end
disp('') skipline()
if idehess.flag_score, if idehess.flag_score,
[U,S,V]=svd(idehess.AHess,0); [U,S,V]=svd(idehess.AHess,0);
S=diag(S); S=diag(S);
@ -232,7 +232,7 @@ else
dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_MC_sensitivity' ],options_); dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_MC_sensitivity' ],options_);
if advanced, if advanced,
if ~options_.nodisplay, if ~options_.nodisplay,
disp(' ') skipline()
disp('Press ENTER to display advanced diagnostics'), pause(5), disp('Press ENTER to display advanced diagnostics'), pause(5),
end end
% options_.nograph=1; % options_.nograph=1;

View File

@ -168,4 +168,4 @@ disp(['MH: Total number of generated files : ' int2str(NewFile(1)*nblck) '.
disp(['MH: Total number of iterations : ' int2str((NewFile(1)-1)*MAX_nruns+irun-1) '.']) disp(['MH: Total number of iterations : ' int2str((NewFile(1)-1)*MAX_nruns+irun-1) '.'])
disp('MH: average acceptation rate per chain : ') disp('MH: average acceptation rate per chain : ')
disp(record.AcceptationRates); disp(record.AcceptationRates);
disp(' ') skipline()

View File

@ -83,12 +83,10 @@ M_.Sigma_e = Sigma_e;
% Display the non-zero residuals if no return value % Display the non-zero residuals if no return value
if nargout == 0 if nargout == 0
for i = 1:4 skipline(4)
disp(' ')
end
ind = []; ind = [];
disp('Residuals of the static equations:') disp('Residuals of the static equations:')
disp(' ') skipline()
for i=1:M_.orig_endo_nbr for i=1:M_.orig_endo_nbr
if abs(z(i)) < options_.dynatol.f/100 if abs(z(i)) < options_.dynatol.f/100
tmp = 0; tmp = 0;
@ -107,9 +105,7 @@ if nargout == 0
disp( ['Equation number ', int2str(i) ,' : ', num2str(tmp) ,' : ' s]) disp( ['Equation number ', int2str(i) ,' : ', num2str(tmp) ,' : ' s])
end end
end end
for i = 1:2 skipline(2)
disp(' ')
end
end end
if info(1) if info(1)

View File

@ -73,9 +73,9 @@ if matlab_random_streams% Use new matlab interface.
strcmpi(a,'swb2712') ) strcmpi(a,'swb2712') )
disp('set_dynare_seed:: First argument must be string designing the uniform random number algorithm!') disp('set_dynare_seed:: First argument must be string designing the uniform random number algorithm!')
RandStream.list RandStream.list
disp(' ') skipline()
disp('set_dynare_seed:: Change the first input accordingly...') disp('set_dynare_seed:: Change the first input accordingly...')
disp(' ') skipline()
error(' ') error(' ')
end end
if ~isint(b) if ~isint(b)

View File

@ -77,7 +77,7 @@ fprintf('\n') ;
model_dynamic = str2func([M_.fname,'_dynamic']); model_dynamic = str2func([M_.fname,'_dynamic']);
z = Y(find(lead_lag_incidence')); z = Y(find(lead_lag_incidence'));
[d1,jacobian] = model_dynamic(z,oo_.exo_simul, params, ... [d1,jacobian] = model_dynamic(z,oo_.exo_simul, params, ...
steady_state,2); steady_state,M_.maximum_lag+1);
A = sparse([],[],[],periods*ny,periods*ny,periods*nnz(jacobian)); A = sparse([],[],[],periods*ny,periods*ny,periods*nnz(jacobian));
res = zeros(periods*ny,1); res = zeros(periods*ny,1);
@ -91,15 +91,15 @@ for iter = 1:options_.maxit_
i_cols = find(lead_lag_incidence'); i_cols = find(lead_lag_incidence');
i_cols_A = i_cols; i_cols_A = i_cols;
for it = 2:(periods+1) for it = (M_.maximum_lag+1):(M_.maximum_lag+periods)
[d1,jacobian] = model_dynamic(Y(i_cols),exo_simul, params, ... [d1,jacobian] = model_dynamic(Y(i_cols),exo_simul, params, ...
steady_state,it); steady_state,it);
if it == periods+1 && it == 2 if it == M_.maximum_lag+periods && it == M_.maximum_lag+1
A(i_rows,i_cols_A0) = jacobian(:,i_cols_0); A(i_rows,i_cols_A0) = jacobian(:,i_cols_0);
elseif it == periods+1 elseif it == M_.maximum_lag+periods
A(i_rows,i_cols_A(i_cols_T)) = jacobian(:,i_cols_T); A(i_rows,i_cols_A(i_cols_T)) = jacobian(:,i_cols_T);
elseif it == 2 elseif it == M_.maximum_lag+1
A(i_rows,i_cols_A1) = jacobian(:,i_cols_1); A(i_rows,i_cols_A1) = jacobian(:,i_cols_1);
else else
A(i_rows,i_cols_A) = jacobian(:,i_cols_j); A(i_rows,i_cols_A) = jacobian(:,i_cols_j);
@ -109,7 +109,7 @@ for iter = 1:options_.maxit_
i_rows = i_rows + ny; i_rows = i_rows + ny;
i_cols = i_cols + ny; i_cols = i_cols + ny;
if it > 2 if it > M_.maximum_lag+1
i_cols_A = i_cols_A + ny; i_cols_A = i_cols_A + ny;
end end
end end

View File

@ -1,4 +1,4 @@
Xfunction [x,fval,exitflag] = simplex_optimization_routine(objective_function,x,options,varargin) function [x,fval,exitflag] = simplex_optimization_routine(objective_function,x,options,varargin)
% Nelder-Mead like optimization routine. % Nelder-Mead like optimization routine.
% By default, we use standard values for the reflection, the expansion, the contraction and the shrink coefficients (alpha = 1, chi = 2, psi = 1 / 2 and σ = 1 / 2). % By default, we use standard values for the reflection, the expansion, the contraction and the shrink coefficients (alpha = 1, chi = 2, psi = 1 / 2 and σ = 1 / 2).
% See http://en.wikipedia.org/wiki/Nelder-Mead_method % See http://en.wikipedia.org/wiki/Nelder-Mead_method
@ -9,7 +9,7 @@ Xfunction [x,fval,exitflag] = simplex_optimization_routine(objective_function,x,
% amelioration is possible. % amelioration is possible.
% %
% INPUTS % INPUTS
% objective_function [string] Name of the iobjective function to be minimized. % objective_function [string] Name of the objective function to be minimized.
% x [double] n*1 vector, starting guess of the optimization routine. % x [double] n*1 vector, starting guess of the optimization routine.
% options [structure] % options [structure]
% %
@ -17,7 +17,7 @@ Xfunction [x,fval,exitflag] = simplex_optimization_routine(objective_function,x,
% %
% %
% Copyright (C) 2010-2012 Dynare Team % Copyright (C) 2010-2013 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
@ -167,18 +167,18 @@ trend_vector_2 = 2:(number_of_variables+1);
% Set initial simplex around the initial guess (x). % Set initial simplex around the initial guess (x).
if verbose if verbose
for i=1:3, disp(' '), end skipline(3)
disp('+----------------------+') disp('+----------------------+')
disp(' SIMPLEX INITIALIZATION ') disp(' SIMPLEX INITIALIZATION ')
disp('+----------------------+') disp('+----------------------+')
disp(' ') skipline()
end end
initial_point = x; initial_point = x;
[initial_score,junk1,junk2,nopenalty] = feval(objective_function,x,varargin{:}); [initial_score,junk1,junk2,nopenalty] = feval(objective_function,x,varargin{:});
if ~nopenalty if ~nopenalty
error('simplex_optimization_routine:: Initial condition is wrong!') error('simplex_optimization_routine:: Initial condition is wrong!')
else else
[v,fv,delta] = simplex_initialization(objective_function,initial_point,initial_score,delta,1,varargin{:}); [v,fv,delta] = simplex_initialization(objective_function,initial_point,initial_score,delta,zero_delta,1,varargin{:});
func_count = number_of_variables + 1; func_count = number_of_variables + 1;
iter_count = 1; iter_count = 1;
if verbose if verbose
@ -188,7 +188,7 @@ else
for i=1:number_of_variables for i=1:number_of_variables
fprintf(1,'%s: \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \n',bayestopt_.name{i},v(i,1), v(i,end), mean(v(i,:),2), min(v(i,:),[],2), max(v(i,:),[],2)); fprintf(1,'%s: \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \n',bayestopt_.name{i},v(i,1), v(i,end), mean(v(i,:),2), min(v(i,:),[],2), max(v(i,:),[],2));
end end
disp(' ') skipline()
end end
end end
@ -247,8 +247,7 @@ while (func_count < max_func_calls) && (iter_count < max_iterations) && (simplex
if fxe < fxr% xe is even better than xr. if fxe < fxr% xe is even better than xr.
if optimize_expansion_parameter if optimize_expansion_parameter
if verbose>1 if verbose>1
disp('') skipline(2)
disp('')
disp('Compute optimal expansion...') disp('Compute optimal expansion...')
end end
xee = xbar + rho*chi*1.01*(xbar-v(:,end)); xee = xbar + rho*chi*1.01*(xbar-v(:,end));
@ -316,8 +315,7 @@ while (func_count < max_func_calls) && (iter_count < max_iterations) && (simplex
end end
if verbose>1 if verbose>1
disp('Done!') disp('Done!')
disp(' ') skipline(2)
disp(' ')
end end
end end
v(:,end) = xe; v(:,end) = xe;
@ -384,7 +382,7 @@ while (func_count < max_func_calls) && (iter_count < max_iterations) && (simplex
disp(['Norm of dSimplex: ' num2str(norm(v-vold,'fro'))]) disp(['Norm of dSimplex: ' num2str(norm(v-vold,'fro'))])
disp(['Crit. f: ' num2str(critF)]) disp(['Crit. f: ' num2str(critF)])
disp(['Crit. x: ' num2str(critX)]) disp(['Crit. x: ' num2str(critX)])
disp(' ') skipline()
end end
if verbose && max(abs(best_point-v(:,1)))>x_tolerance; if verbose && max(abs(best_point-v(:,1)))>x_tolerance;
if verbose<2 if verbose<2
@ -395,14 +393,14 @@ while (func_count < max_func_calls) && (iter_count < max_iterations) && (simplex
disp(['Norm of dSimplex: ' num2str(norm(v-vold,'fro'))]) disp(['Norm of dSimplex: ' num2str(norm(v-vold,'fro'))])
disp(['Crit. f: ' num2str(critF)]) disp(['Crit. f: ' num2str(critF)])
disp(['Crit. x: ' num2str(critX)]) disp(['Crit. x: ' num2str(critX)])
disp(' ') skipline()
end end
disp(['Current parameter values: ']) disp(['Current parameter values: '])
fprintf(1,'%s: \t\t\t %s \t\t\t %s \t\t\t %s \t\t\t %s \t\t\t %s \n','Names','Best point', 'Worst point', 'Mean values', 'Min values', 'Max values'); fprintf(1,'%s: \t\t\t %s \t\t\t %s \t\t\t %s \t\t\t %s \t\t\t %s \n','Names','Best point', 'Worst point', 'Mean values', 'Min values', 'Max values');
for i=1:number_of_variables for i=1:number_of_variables
fprintf(1,'%s: \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \n',bayestopt_.name{i}, v(i,1), v(i,end), mean(v(i,:),2), min(v(i,:),[],2), max(v(i,:),[],2)); fprintf(1,'%s: \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \t\t\t %+8.6f \n',bayestopt_.name{i}, v(i,1), v(i,end), mean(v(i,:),2), min(v(i,:),[],2), max(v(i,:),[],2));
end end
disp(' ') skipline()
end end
if abs(best_point_score-fv(1))<f_tolerance if abs(best_point_score-fv(1))<f_tolerance
no_improvements = no_improvements+1; no_improvements = no_improvements+1;
@ -420,7 +418,7 @@ while (func_count < max_func_calls) && (iter_count < max_iterations) && (simplex
% Compute the size of the simplex % Compute the size of the simplex
delta = delta*1.05; delta = delta*1.05;
% Compute the new initial simplex. % Compute the new initial simplex.
[v,fv,delta] = simplex_initialization(objective_function,best_point,best_point_score,delta,1,varargin{:}); [v,fv,delta] = simplex_initialization(objective_function,best_point,best_point_score,delta,zero_delta,1,varargin{:});
if verbose if verbose
disp(['(Re)Start with a lager simplex around the based on the best current ']) disp(['(Re)Start with a lager simplex around the based on the best current '])
disp(['values for the control variables. ']) disp(['values for the control variables. '])
@ -436,12 +434,11 @@ while (func_count < max_func_calls) && (iter_count < max_iterations) && (simplex
iter_no_improvement_break = iter_no_improvement_break + 1; iter_no_improvement_break = iter_no_improvement_break + 1;
simplex_init = simplex_init+1; simplex_init = simplex_init+1;
simplex_iterations = simplex_iterations+1; simplex_iterations = simplex_iterations+1;
disp(' ') skipline(2)
disp(' ')
end end
end end
if ((func_count==max_func_calls) || (iter_count==max_iterations) || (iter_no_improvement_break==max_no_improvement_break) || convergence || tooslow) if ((func_count==max_func_calls) || (iter_count==max_iterations) || (iter_no_improvement_break==max_no_improvement_break) || convergence || tooslow)
[v,fv,delta] = simplex_initialization(objective_function,best_point,best_point_score,DELTA,1,varargin{:}); [v,fv,delta] = simplex_initialization(objective_function,best_point,best_point_score,DELTA,zero_delta,1,varargin{:});
if func_count==max_func_calls if func_count==max_func_calls
if verbose if verbose
disp(['MAXIMUM NUMBER OF OBJECTIVE FUNCTION CALLS EXCEEDED (' int2str(max_func_calls) ')!']) disp(['MAXIMUM NUMBER OF OBJECTIVE FUNCTION CALLS EXCEEDED (' int2str(max_func_calls) ')!'])
@ -468,7 +465,7 @@ while (func_count < max_func_calls) && (iter_count < max_iterations) && (simplex
% Compute the size of the simplex % Compute the size of the simplex
delta = delta*1.05; delta = delta*1.05;
% Compute the new initial simplex. % Compute the new initial simplex.
[v,fv,delta] = simplex_initialization(objective_function,best_point,best_point_score,delta,1,varargin{:}); [v,fv,delta] = simplex_initialization(objective_function,best_point,best_point_score,delta,zero_delta,1,varargin{:});
if verbose if verbose
disp(['(Re)Start with a lager simplex around the based on the best current ']) disp(['(Re)Start with a lager simplex around the based on the best current '])
disp(['values for the control variables. ']) disp(['values for the control variables. '])
@ -486,8 +483,7 @@ while (func_count < max_func_calls) && (iter_count < max_iterations) && (simplex
iter_count = iter_count+1; iter_count = iter_count+1;
simplex_iterations = simplex_iterations+1; simplex_iterations = simplex_iterations+1;
simplex_algo_iterations = simplex_algo_iterations+1; simplex_algo_iterations = simplex_algo_iterations+1;
disp(' ') skipline(2)
disp(' ')
else else
break break
end end
@ -511,7 +507,7 @@ end
function [v,fv,delta] = simplex_initialization(objective_function,point,point_score,delta,check_delta,varargin) function [v,fv,delta] = simplex_initialization(objective_function,point,point_score,delta,zero_delta,check_delta,varargin)
n = length(point); n = length(point);
v = zeros(n,n+1); v = zeros(n,n+1);
v(:,1) = point; v(:,1) = point;

View File

@ -113,13 +113,13 @@ if nargin>2
estimated_parameters_optimization_path = [NaN;xparam]; estimated_parameters_optimization_path = [NaN;xparam];
save('optimization_path.mat','estimated_parameters_optimization_path'); save('optimization_path.mat','estimated_parameters_optimization_path');
end end
disp(' ') skipline()
disp('Master talks to its slaves...') disp('Master talks to its slaves...')
disp(' ') skipline()
% Save the workspace. % Save the workspace.
save('master_variables.mat','options_','M_','oo_'); save('master_variables.mat','options_','M_','oo_');
% Send the workspace to each remote computer. % Send the workspace to each remote computer.
disp('') skipline()
for i = 1:length(parallel) for i = 1:length(parallel)
if ~strcmpi(hostname,parallel(i).machine) if ~strcmpi(hostname,parallel(i).machine)
unix(['scp master_variables.mat ' , parallel(i).login , '@' , parallel(i).machine , ':' parallel(i).folder]); unix(['scp master_variables.mat ' , parallel(i).login , '@' , parallel(i).machine , ':' parallel(i).folder]);
@ -191,9 +191,9 @@ if nargin>2
end end
end end
end end
disp(' ') skipline()
disp('... And slaves do as ordered.') disp('... And slaves do as ordered.')
disp(' ') skipline()
if exist('intermediary_results_from_master_and_slaves','dir') if exist('intermediary_results_from_master_and_slaves','dir')
unix('rm -rf intermediary_results_from_master_and_slaves'); unix('rm -rf intermediary_results_from_master_and_slaves');
end end
@ -201,7 +201,7 @@ if nargin>2
unix('chmod -R u+x intermediary_results_from_master_and_slaves'); unix('chmod -R u+x intermediary_results_from_master_and_slaves');
end end
disp(''); skipline()
if options.optimization_routine==1 if options.optimization_routine==1
% Set options for csminwel. % Set options for csminwel.

34
matlab/skipline.m Normal file
View File

@ -0,0 +1,34 @@
function skipline(n,fid)
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% 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
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if nargin<2
fid = 1;
end
if nargin<1
fid = 1;
end
if ~nargin || isequal(n,1)
fprintf(fid,'\n');
else
for i=1:n
fprintf(fid,'\n');
end
end

View File

@ -136,7 +136,7 @@ for its = 1:maxit
end end
check = 1; check = 1;
disp(' ') skipline()
disp('SOLVE: maxit has been reached') disp('SOLVE: maxit has been reached')
% 01/14/01 MJ lnsearch is now a separate function % 01/14/01 MJ lnsearch is now a separate function

View File

@ -55,7 +55,7 @@ end
if info(1) if info(1)
hv = options_.homotopy_values; hv = options_.homotopy_values;
disp(' ') skipline()
disp('WARNING: homotopy step was not completed') disp('WARNING: homotopy step was not completed')
disp('The last values for which a solution was found are:') disp('The last values for which a solution was found are:')
for i=1:length(ip) for i=1:length(ip)

View File

@ -83,9 +83,9 @@ if info(1)
end end
if ~options_.noprint if ~options_.noprint
disp(' ') skipline()
disp('MODEL SUMMARY') disp('MODEL SUMMARY')
disp(' ') skipline()
disp([' Number of variables: ' int2str(M_.endo_nbr)]) disp([' Number of variables: ' int2str(M_.endo_nbr)])
disp([' Number of stochastic shocks: ' int2str(M_.exo_nbr)]) disp([' Number of stochastic shocks: ' int2str(M_.exo_nbr)])
disp([' Number of state variables: ' int2str(M_.nspred)]) disp([' Number of state variables: ' int2str(M_.nspred)])
@ -97,9 +97,9 @@ if ~options_.noprint
lh = size(labels,2)+2; lh = size(labels,2)+2;
dyntable(my_title,headers,labels,M_.Sigma_e,lh,10,6); dyntable(my_title,headers,labels,M_.Sigma_e,lh,10,6);
if options_.partial_information if options_.partial_information
disp(' ') skipline()
disp('SOLUTION UNDER PARTIAL INFORMATION') disp('SOLUTION UNDER PARTIAL INFORMATION')
disp(' ') skipline()
if isfield(options_,'varobs')&& ~isempty(options_.varobs) if isfield(options_,'varobs')&& ~isempty(options_.varobs)
PCL_varobs=options_.varobs; PCL_varobs=options_.varobs;
@ -113,7 +113,7 @@ if ~options_.noprint
disp([' ' PCL_varobs(i,:)]) disp([' ' PCL_varobs(i,:)])
end end
end end
disp(' ') skipline()
if options_.order <= 2 && ~PI_PCL_solver if options_.order <= 2 && ~PI_PCL_solver
disp_dr(oo_.dr,options_.order,var_list); disp_dr(oo_.dr,options_.order,var_list);
end end

View File

@ -48,10 +48,10 @@ dataset_.info.varobs = varobs;
% Test the number of variables in the database. % Test the number of variables in the database.
if dataset_.info.nvobs-size(rawdata,2) if dataset_.info.nvobs-size(rawdata,2)
disp(' ') skipline()
disp(['Declared number of observed variables = ' int2str(dataset.info.nvobs)]) disp(['Declared number of observed variables = ' int2str(dataset.info.nvobs)])
disp(['Number of variables in the database = ' int2str(size(rawdata,2))]) disp(['Number of variables in the database = ' int2str(size(rawdata,2))])
disp(' ') skipline()
error(['Estimation can''t take place because the declared number of observed' ... error(['Estimation can''t take place because the declared number of observed' ...
'variables doesn''t match the number of variables in the database.']) 'variables doesn''t match the number of variables in the database.'])
end end

View File

@ -68,8 +68,7 @@ if strcmp(ext(2:end),'m')
fprintf(fid,'%s\n',deblank(block(i,:))); fprintf(fid,'%s\n',deblank(block(i,:)));
end end
fclose(fid); fclose(fid);
disp(' ') skipline(2)
disp(' ')
system(['makeinfo --plaintext --no-split --no-validate ' fun '.texi']); system(['makeinfo --plaintext --no-split --no-validate ' fun '.texi']);
delete([fun '.texi']); delete([fun '.texi']);
else else

View File

@ -49,17 +49,17 @@ gitlastcommithash = reportfilecontent.gitlastcommithash;
str = 'Hi,'; str = 'Hi,';
str = char(str,''); str = char(str,'');
str = char(str,'This is a summary report for the unitary tests in Dynare. Full report can be found at'); str = char(str,'This is a summary report for the unitary tests in Dynare. Full report can be found at:');
str = char(str,'');
str = char(str,''); str = char(str,'');
str = char(str,['http://www.dynare.org/stepan/dynare/tests/' reportfile]); str = char(str,['http://www.dynare.org/stepan/dynare/tests/' reportfile]);
str = char(str,'');
str = char(str,['http://www.dynare.org/stepan/dynare/tests/' reportfile(1:end-3) 'log']); str = char(str,['http://www.dynare.org/stepan/dynare/tests/' reportfile(1:end-3) 'log']);
str = char(str,''); str = char(str,'');
str = char(str,gitinfo(1,:)); str = char(str,gitinfo(1,:));
str = char(str,gitinfo(2,:)); str = char(str,gitinfo(2,:));
str = char(str,''); str = char(str,'');
str = char(str,''); str = char(str,'');
str = char(str,['===========================']); str = char(str,['===========================']);
str = char(str,'DYNARE/MATLAB UNITARY TESTS'); str = char(str,'DYNARE/MATLAB UNITARY TESTS');
str = char(str,'==========================='); str = char(str,'===========================');
@ -75,9 +75,9 @@ for i=1:size(reportcell,1)
end end
if printonscreen if printonscreen
fprintf('\n\n') skipline(2);
disp(str) disp(str)
fprintf('\n\n') skipline(2);
end end
if mailreport if mailreport

View File

@ -1640,38 +1640,6 @@ Evaluate::compute_complete_2b(const bool no_derivatives, double *_res1, double *
compute_block_time(Per_u_, false, no_derivatives); compute_block_time(Per_u_, false, no_derivatives);
if (!(isnan(res1) || isinf(res1))) if (!(isnan(res1) || isinf(res1)))
{ {
#ifdef USE_OMP
if (size > 10)
{
double res1_ = 0;
double res2_ = 0;
double max_res_ = 0;
int max_res_idx_ = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) reduction(+:res1_, res2_) shared(max_res_, max_res_idx_)
#endif
for (int i = 0; i < size; i++)
{
double rr = r[i];
res[i+shift] = rr;
if (max_res_ < fabs(rr))
{
max_res_ = fabs(rr);
max_res_idx_ = i;
}
res2_ += rr*rr;
res1_ += fabs(rr);
}
*_res1 += res1_;
*_res2 += res2_;
if (max_res_ > *_max_res)
{
*_max_res = max_res_;
*_max_res_idx = max_res_idx_;
}
}
else
#endif
{ {
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
@ -1704,39 +1672,6 @@ Evaluate::compute_complete(const bool no_derivatives, double &_res1, double &_re
compute_block_time(0, false, no_derivatives); compute_block_time(0, false, no_derivatives);
if (!(isnan(res1) || isinf(res1))) if (!(isnan(res1) || isinf(res1)))
{ {
#ifdef USE_OMP
if (size > 10)
{
double res1_ = 0;
double res2_ = 0;
double max_res_ = 0;
int max_res_idx_ = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) reduction(+:res1_, res2_) shared(max_res_, max_res_idx_)
#endif
for (int i = 0; i < size; i++)
{
double rr = r[i];
if (max_res_ < fabs(rr))
{
#ifdef USE_OMP
#pragma omp critical
#endif
{
max_res_ = fabs(rr);
max_res_idx_ = i;
}
}
res2_ += rr*rr;
res1_ += fabs(rr);
}
_res1 = res1_;
_res2 = res2_;
_max_res = max_res_;
_max_res_idx = max_res_idx_;
}
else
#endif
{ {
_res1 = 0; _res1 = 0;
_res2 = 0; _res2 = 0;
@ -1771,9 +1706,6 @@ Evaluate::compute_complete(double lambda, double *crit)
if (steady_state) if (steady_state)
{ {
it_ = 0; it_ = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];

View File

@ -93,15 +93,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
{ {
compute_block_time(0, true, /*block_num, size, steady_state, */false); compute_block_time(0, true, /*block_num, size, steady_state, */false);
if (block >= 0) if (block >= 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[j] = y[Block_Contain[j].Variable] - ya[Block_Contain[j].Variable]; residual[j] = y[Block_Contain[j].Variable] - ya[Block_Contain[j].Variable];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[Block_Contain[j].Equation] = y[Block_Contain[j].Variable] - ya[Block_Contain[j].Variable]; residual[Block_Contain[j].Equation] = y[Block_Contain[j].Variable] - ya[Block_Contain[j].Variable];
} }
@ -114,15 +108,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
Per_y_ = it_*y_size; Per_y_ = it_*y_size;
compute_block_time(0, true, /*block_num, size, steady_state, */false); compute_block_time(0, true, /*block_num, size, steady_state, */false);
if (block >= 0) if (block >= 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*size+j] = y[it_*y_size+Block_Contain[j].Variable] - ya[it_*y_size+Block_Contain[j].Variable]; residual[it_*size+j] = y[it_*y_size+Block_Contain[j].Variable] - ya[it_*y_size+Block_Contain[j].Variable];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*size+Block_Contain[j].Equation] = y[it_*y_size+Block_Contain[j].Variable] - ya[it_*y_size+Block_Contain[j].Variable]; residual[it_*size+Block_Contain[j].Equation] = y[it_*y_size+Block_Contain[j].Variable] - ya[it_*y_size+Block_Contain[j].Variable];
} }
@ -135,15 +123,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
{ {
compute_block_time(0, true, /*block_num, size, steady_state,*/ false); compute_block_time(0, true, /*block_num, size, steady_state,*/ false);
if (block < 0) if (block < 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[Block_Contain[j].Equation] = r[j]; residual[Block_Contain[j].Equation] = r[j];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[j] = r[j]; residual[j] = r[j];
} }
@ -156,15 +138,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
Per_y_ = it_*y_size; Per_y_ = it_*y_size;
compute_block_time(0, true, /*block_num, size, steady_state,*/ false); compute_block_time(0, true, /*block_num, size, steady_state,*/ false);
if (block < 0) if (block < 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[Per_y_+Block_Contain[j].Equation] = r[j]; residual[Per_y_+Block_Contain[j].Equation] = r[j];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*size+j] = r[j]; residual[it_*size+j] = r[j];
} }
@ -183,15 +159,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
{ {
compute_block_time(0, true, /*block_num, size, steady_state,*/ false); compute_block_time(0, true, /*block_num, size, steady_state,*/ false);
if (block < 0) if (block < 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[Block_Contain[j].Equation] = r[j]; residual[Block_Contain[j].Equation] = r[j];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[j] = r[j]; residual[j] = r[j];
} }
@ -204,15 +174,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
Per_y_ = it_*y_size; Per_y_ = it_*y_size;
compute_block_time(0, true, /*block_num, size, steady_state,*/ false); compute_block_time(0, true, /*block_num, size, steady_state,*/ false);
if (block < 0) if (block < 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*y_size+Block_Contain[j].Equation] = r[j]; residual[it_*y_size+Block_Contain[j].Equation] = r[j];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*size+j] = r[j]; residual[it_*size+j] = r[j];
} }
@ -224,15 +188,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
{ {
compute_block_time(0, true, /*block_num, size, steady_state,*/ false); compute_block_time(0, true, /*block_num, size, steady_state,*/ false);
if (block >= 0) if (block >= 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[j] = y[Block_Contain[j].Variable] - ya[Block_Contain[j].Variable]; residual[j] = y[Block_Contain[j].Variable] - ya[Block_Contain[j].Variable];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[Block_Contain[j].Equation] = y[Block_Contain[j].Variable] - ya[Block_Contain[j].Variable]; residual[Block_Contain[j].Equation] = y[Block_Contain[j].Variable] - ya[Block_Contain[j].Variable];
} }
@ -245,15 +203,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
Per_y_ = it_*y_size; Per_y_ = it_*y_size;
compute_block_time(0, true, /*block_num, size, steady_state,*/ false); compute_block_time(0, true, /*block_num, size, steady_state,*/ false);
if (block >= 0) if (block >= 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*size+j] = y[it_*y_size+Block_Contain[j].Variable] - ya[it_*y_size+Block_Contain[j].Variable]; residual[it_*size+j] = y[it_*y_size+Block_Contain[j].Variable] - ya[it_*y_size+Block_Contain[j].Variable];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*size+Block_Contain[j].Equation] = y[it_*y_size+Block_Contain[j].Variable] - ya[it_*y_size+Block_Contain[j].Variable]; residual[it_*size+Block_Contain[j].Equation] = y[it_*y_size+Block_Contain[j].Variable] - ya[it_*y_size+Block_Contain[j].Variable];
} }
@ -266,15 +218,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
{ {
compute_block_time(0, true, /*block_num, size, steady_state,*/ false); compute_block_time(0, true, /*block_num, size, steady_state,*/ false);
if (block < 0) if (block < 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[Block_Contain[j].Equation] = r[j]; residual[Block_Contain[j].Equation] = r[j];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[j] = r[j]; residual[j] = r[j];
} }
@ -287,15 +233,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
Per_y_ = it_*y_size; Per_y_ = it_*y_size;
compute_block_time(0, true, /*block_num, size, steady_state,*/ false); compute_block_time(0, true, /*block_num, size, steady_state,*/ false);
if (block < 0) if (block < 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[Per_y_+Block_Contain[j].Equation] = r[j]; residual[Per_y_+Block_Contain[j].Equation] = r[j];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*size+j] = r[j]; residual[it_*size+j] = r[j];
} }
@ -311,15 +251,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
{ {
compute_block_time(0, true, /*block_num, size, steady_state,*/ false); compute_block_time(0, true, /*block_num, size, steady_state,*/ false);
if (block < 0) if (block < 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[Block_Contain[j].Equation] = r[j]; residual[Block_Contain[j].Equation] = r[j];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[j] = r[j]; residual[j] = r[j];
} }
@ -332,15 +266,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
Per_y_ = it_*y_size; Per_y_ = it_*y_size;
compute_block_time(0, true, /*block_num, size, steady_state, */false); compute_block_time(0, true, /*block_num, size, steady_state, */false);
if (block < 0) if (block < 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[Per_y_+Block_Contain[j].Equation] = r[j]; residual[Per_y_+Block_Contain[j].Equation] = r[j];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*size+j] = r[j]; residual[it_*size+j] = r[j];
} }
@ -361,15 +289,9 @@ Interpreter::evaluate_a_block(/*const int size, const int type, string bin_basen
it_code = begining; it_code = begining;
compute_block_time(Per_u_, true, /*block_num, size, steady_state,*/ false); compute_block_time(Per_u_, true, /*block_num, size, steady_state,*/ false);
if (block < 0) if (block < 0)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*y_size+Block_Contain[j].Equation] = r[j]; residual[it_*y_size+Block_Contain[j].Equation] = r[j];
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
residual[it_*size+j] = r[j]; residual[it_*size+j] = r[j];
} }

View File

@ -622,9 +622,6 @@ dynSparseMatrix::Read_SparseMatrix(string file_name, const int Size, int periods
if (periods+y_kmin+y_kmax > 1) if (periods+y_kmin+y_kmax > 1)
for (int i = 1; i < periods+y_kmin+y_kmax; i++) for (int i = 1; i < periods+y_kmin+y_kmax; i++)
{ {
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < Size; j++) for (int j = 0; j < Size; j++)
index_vara[j+Size*i] = index_vara[j+Size*(i-1)] + y_size; index_vara[j+Size*i] = index_vara[j+Size*(i-1)] + y_size;
} }
@ -660,9 +657,6 @@ dynSparseMatrix::Simple_Init(int Size, map<pair<pair<int, int>, int>, int> &IM,
NbNZCol = (int *) mxMalloc(i); NbNZCol = (int *) mxMalloc(i);
it4 = IM.begin(); it4 = IM.begin();
eq = -1; eq = -1;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (i = 0; i < Size; i++) for (i = 0; i < Size; i++)
{ {
line_done[i] = 0; line_done[i] = 0;
@ -705,9 +699,6 @@ dynSparseMatrix::Simple_Init(int Size, map<pair<pair<int, int>, int>, int> &IM,
it4++; it4++;
} }
double cum_abs_sum = 0; double cum_abs_sum = 0;
#if USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) reduction(+:cum_abs_sum)
#endif
for (int i = 0; i < Size; i++) for (int i = 0; i < Size; i++)
{ {
b[i] = i; b[i] = i;
@ -763,9 +754,6 @@ dynSparseMatrix::Init_Matlab_Sparse_Simple(int Size, map<pair<pair<int, int>, in
throw FatalExceptionHandling(tmp.str()); throw FatalExceptionHandling(tmp.str());
} }
map<pair<pair<int, int>, int>, int>::iterator it4; map<pair<pair<int, int>, int>, int>::iterator it4;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size*(periods+y_kmin); i++) for (int i = 0; i < y_size*(periods+y_kmin); i++)
ya[i] = y[i]; ya[i] = y[i];
#ifdef DEBUG #ifdef DEBUG
@ -774,9 +762,6 @@ dynSparseMatrix::Init_Matlab_Sparse_Simple(int Size, map<pair<pair<int, int>, in
unsigned int NZE = 0; unsigned int NZE = 0;
int last_var = 0; int last_var = 0;
double cum_abs_sum = 0; double cum_abs_sum = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) reduction(+:cum_abs_sum)
#endif
for (int i = 0; i < Size; i++) for (int i = 0; i < Size; i++)
{ {
b[i] = u[i]; b[i] = u[i];
@ -887,9 +872,6 @@ dynSparseMatrix::Init_UMFPACK_Sparse_Simple(int Size, map<pair<pair<int, int>, i
} }
map<pair<pair<int, int>, int>, int>::iterator it4; map<pair<pair<int, int>, int>, int>::iterator it4;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < Size; i++) for (int i = 0; i < Size; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -901,10 +883,6 @@ dynSparseMatrix::Init_UMFPACK_Sparse_Simple(int Size, map<pair<pair<int, int>, i
unsigned int NZE = 0; unsigned int NZE = 0;
int last_var = 0; int last_var = 0;
double cum_abs_sum = 0; double cum_abs_sum = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) reduction(+:cum_abs_sum)
#endif
for (int i = 0; i < Size; i++) for (int i = 0; i < Size; i++)
{ {
(*b)[i] = u[i]; (*b)[i] = u[i];
@ -1014,9 +992,6 @@ dynSparseMatrix::Init_UMFPACK_Sparse(int periods, int y_kmin, int y_kmax, int Si
throw FatalExceptionHandling(tmp.str()); throw FatalExceptionHandling(tmp.str());
} }
map<pair<pair<int, int>, int>, int>::iterator it4; map<pair<pair<int, int>, int>, int>::iterator it4;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size*(periods+y_kmin); i++) for (int i = 0; i < y_size*(periods+y_kmin); i++)
ya[i] = y[i]; ya[i] = y[i];
#ifdef DEBUG #ifdef DEBUG
@ -1024,10 +999,6 @@ dynSparseMatrix::Init_UMFPACK_Sparse(int periods, int y_kmin, int y_kmax, int Si
#endif #endif
unsigned int NZE = 0; unsigned int NZE = 0;
int last_var = 0; int last_var = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < periods*Size; i++) for (int i = 0; i < periods*Size; i++)
{ {
(*b)[i] = 0; (*b)[i] = 0;
@ -1193,9 +1164,6 @@ dynSparseMatrix::Init_CUDA_Sparse_Simple(int Size, map<pair<pair<int, int>, int>
} }
map<pair<pair<int, int>, int>, int>::iterator it4; map<pair<pair<int, int>, int>, int>::iterator it4;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < Size; i++) for (int i = 0; i < Size; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -1208,10 +1176,6 @@ dynSparseMatrix::Init_CUDA_Sparse_Simple(int Size, map<pair<pair<int, int>, int>
unsigned int NZE = 0; unsigned int NZE = 0;
int last_var = 0; int last_var = 0;
double cum_abs_sum = 0; double cum_abs_sum = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) reduction(+:cum_abs_sum)
#endif
for (int i = 0; i < Size; i++) for (int i = 0; i < Size; i++)
{ {
(*b)[i] = u[i]; (*b)[i] = u[i];
@ -1334,9 +1298,6 @@ dynSparseMatrix::Init_CUDA_Sparse(int periods, int y_kmin, int y_kmax, int Size,
map<pair<pair<int, int>, int>, int>::iterator it4; map<pair<pair<int, int>, int>, int>::iterator it4;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size*(periods+y_kmin); i++) for (int i = 0; i < y_size*(periods+y_kmin); i++)
ya[i] = y[i]; ya[i] = y[i];
#ifdef DEBUG #ifdef DEBUG
@ -1344,9 +1305,6 @@ dynSparseMatrix::Init_CUDA_Sparse(int periods, int y_kmin, int y_kmax, int Size,
#endif #endif
unsigned int NZE = 0, NZE_tild = 0; unsigned int NZE = 0, NZE_tild = 0;
int last_eq = 0; int last_eq = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < periods*Size; i++) for (int i = 0; i < periods*Size; i++)
{ {
Host_b[i] = 0; Host_b[i] = 0;
@ -1630,9 +1588,6 @@ dynSparseMatrix::Init_Matlab_Sparse(int periods, int y_kmin, int y_kmax, int Siz
} }
map<pair<pair<int, int>, int>, int>::iterator it4; map<pair<pair<int, int>, int>, int>::iterator it4;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size*(periods+y_kmin); i++) for (int i = 0; i < y_size*(periods+y_kmin); i++)
ya[i] = y[i]; ya[i] = y[i];
#ifdef DEBUG #ifdef DEBUG
@ -1640,9 +1595,6 @@ dynSparseMatrix::Init_Matlab_Sparse(int periods, int y_kmin, int y_kmax, int Siz
#endif #endif
unsigned int NZE = 0; unsigned int NZE = 0;
int last_var = 0; int last_var = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < periods*Size; i++) for (int i = 0; i < periods*Size; i++)
{ {
b[i] = 0; b[i] = 0;
@ -1765,17 +1717,11 @@ dynSparseMatrix::Init_GE(int periods, int y_kmin, int y_kmax, int Size, map<pair
NbNZRow = (int *) mxMalloc(i); NbNZRow = (int *) mxMalloc(i);
NbNZCol = (int *) mxMalloc(i); NbNZCol = (int *) mxMalloc(i);
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < periods*Size; i++) for (int i = 0; i < periods*Size; i++)
{ {
b[i] = 0; b[i] = 0;
line_done[i] = 0; line_done[i] = 0;
} }
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < (periods+y_kmax+1)*Size; i++) for (int i = 0; i < (periods+y_kmax+1)*Size; i++)
{ {
FNZE_C[i] = NULL; FNZE_C[i] = NULL;
@ -1975,9 +1921,6 @@ dynSparseMatrix::compare(int *save_op, int *save_opa, int *save_opaa, int beg_t,
{ {
for (int i = beg_t; i < periods; i++) for (int i = beg_t; i < periods; i++)
{ {
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < Size; j++) for (int j = 0; j < Size; j++)
pivot[i*Size+j] = pivot[(i-1)*Size+j]+Size; pivot[i*Size+j] = pivot[(i-1)*Size+j]+Size;
} }
@ -1992,9 +1935,6 @@ dynSparseMatrix::compare(int *save_op, int *save_opa, int *save_opaa, int beg_t,
throw FatalExceptionHandling(tmp.str()); throw FatalExceptionHandling(tmp.str());
} }
} }
/*#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif*/
for (int t = 1; t < periods-beg_t-y_kmax; t++) for (int t = 1; t < periods-beg_t-y_kmax; t++)
{ {
int i = j = 0; int i = j = 0;
@ -2027,16 +1967,10 @@ dynSparseMatrix::compare(int *save_op, int *save_opa, int *save_opaa, int beg_t,
} }
int t1 = max(1, periods-beg_t-y_kmax); int t1 = max(1, periods-beg_t-y_kmax);
int periods_beg_t = periods-beg_t; int periods_beg_t = periods-beg_t;
/*#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif*/
for (int t = t1; t < periods_beg_t; t++) for (int t = t1; t < periods_beg_t; t++)
{ {
int i = j = 0; int i = j = 0;
int gap = periods_beg_t-t; int gap = periods_beg_t-t;
/*#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif*/
while (i < nop4) while (i < nop4)
{ {
t_save_op_s *save_op_s = (t_save_op_s *) (&(save_op[i])); t_save_op_s *save_op_s = (t_save_op_s *) (&(save_op[i]));
@ -2199,9 +2133,6 @@ dynSparseMatrix::complete(int beg_t, int Size, int periods, int *b)
} }
max_var = (periods+y_kmin)*y_size; max_var = (periods+y_kmin)*y_size;
min_var = y_kmin*y_size; min_var = y_kmin*y_size;
/*#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif*/
for (int t = periods+y_kmin-1; t >= beg_t+y_kmin; t--) for (int t = periods+y_kmin-1; t >= beg_t+y_kmin; t--)
{ {
int j = 0, k; int j = 0, k;
@ -2243,9 +2174,6 @@ dynSparseMatrix::bksub(int tbreak, int last_period, int Size, double slowc_l)
NonZeroElem *first; NonZeroElem *first;
int i, j, k; int i, j, k;
double yy; double yy;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size*(periods+y_kmin); i++) for (int i = 0; i < y_size*(periods+y_kmin); i++)
y[i] = ya[i]; y[i] = ya[i];
if (symbolic && tbreak) if (symbolic && tbreak)
@ -2284,9 +2212,6 @@ dynSparseMatrix::simple_bksub(int it_, int Size, double slowc_l)
int i, k; int i, k;
double yy; double yy;
NonZeroElem *first; NonZeroElem *first;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size; i++) for (int i = 0; i < y_size; i++)
y[i+it_*y_size] = ya[i+it_*y_size]; y[i+it_*y_size] = ya[i+it_*y_size];
for (i = Size-1; i >= 0; i--) for (i = Size-1; i >= 0; i--)
@ -2427,9 +2352,6 @@ dynSparseMatrix::substract_A_B(mxArray *A_m, mxArray *B_m)
double *B_d = mxGetPr(B_m); double *B_d = mxGetPr(B_m);
mxArray *C_m = mxCreateDoubleMatrix(m_A, n_B, mxREAL); mxArray *C_m = mxCreateDoubleMatrix(m_A, n_B, mxREAL);
double *C_d = mxGetPr(C_m); double *C_d = mxGetPr(C_m);
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < (int) n_A; j++) for (int j = 0; j < (int) n_A; j++)
for (unsigned int i = 0; i < m_A; i++) for (unsigned int i = 0; i < m_A; i++)
{ {
@ -2558,10 +2480,6 @@ dynSparseMatrix::mult_SAT_B(mxArray *A_m, mxArray *B_m)
double *B_d = mxGetPr(B_m); double *B_d = mxGetPr(B_m);
mxArray *C_m = mxCreateDoubleMatrix(m_A, n_B, mxREAL); mxArray *C_m = mxCreateDoubleMatrix(m_A, n_B, mxREAL);
double *C_d = mxGetPr(C_m); double *C_d = mxGetPr(C_m);
//unsigned int nze_A = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < (int)n_B; j++) for (int j = 0; j < (int)n_B; j++)
{ {
for (unsigned int i = 0; i < n_A; i++) for (unsigned int i = 0; i < n_A; i++)
@ -3154,9 +3072,6 @@ dynSparseMatrix::Solve_Matlab_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, d
mexCallMATLAB(1, &z, 2, rhs, "mldivide"); mexCallMATLAB(1, &z, 2, rhs, "mldivide");
double *res = mxGetPr(z); double *res = mxGetPr(z);
if (is_two_boundaries) if (is_two_boundaries)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < (int) n; i++) for (int i = 0; i < (int) n; i++)
{ {
int eq = index_vara[i+Size*y_kmin]; int eq = index_vara[i+Size*y_kmin];
@ -3165,9 +3080,6 @@ dynSparseMatrix::Solve_Matlab_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, d
y[eq] += slowc_l * yy; y[eq] += slowc_l * yy;
} }
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < (int) n; i++) for (int i = 0; i < (int) n; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -3256,9 +3168,6 @@ dynSparseMatrix::Solve_LU_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, do
} }
if (is_two_boundaries) if (is_two_boundaries)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
int eq = index_vara[i+Size*y_kmin]; int eq = index_vara[i+Size*y_kmin];
@ -3267,9 +3176,6 @@ dynSparseMatrix::Solve_LU_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, do
y[eq] += slowc_l * yy; y[eq] += slowc_l * yy;
} }
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -3325,9 +3231,6 @@ dynSparseMatrix::Solve_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, double s
umfpack_dl_report_info ((double*) NULL, Info) ; umfpack_dl_report_info ((double*) NULL, Info) ;
//double *res = mxGetPr(z); //double *res = mxGetPr(z);
if (is_two_boundaries) if (is_two_boundaries)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
int eq = index_vara[i+Size*y_kmin]; int eq = index_vara[i+Size*y_kmin];
@ -3336,9 +3239,6 @@ dynSparseMatrix::Solve_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, double s
y[eq] += slowc_l * yy; y[eq] += slowc_l * yy;
} }
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -3561,9 +3461,6 @@ dynSparseMatrix::Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild,
cudaChk(cudaFree(x0), " in Solve_Cuda_BiCGStab, can't free x0\n"); cudaChk(cudaFree(x0), " in Solve_Cuda_BiCGStab, can't free x0\n");
cudaChk(cudaFree(b), " in Solve_Cuda_BiCGStab, can't free b\n"); cudaChk(cudaFree(b), " in Solve_Cuda_BiCGStab, can't free b\n");
if (is_two_boundaries) if (is_two_boundaries)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
int eq = index_vara[i+Size*y_kmin]; int eq = index_vara[i+Size*y_kmin];
@ -3572,9 +3469,6 @@ dynSparseMatrix::Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild,
y[eq] += slowc * yy; y[eq] += slowc * yy;
} }
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -4552,9 +4446,6 @@ dynSparseMatrix::Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild,
cudaChk(cudaMemcpy(tmp_vect_host, x0, n * sizeof(double), cudaMemcpyDeviceToHost), " in Solve_Cuda_BiCGStab, cudaMemcpy tmp_vect_host = x0 has failed\n"); cudaChk(cudaMemcpy(tmp_vect_host, x0, n * sizeof(double), cudaMemcpyDeviceToHost), " in Solve_Cuda_BiCGStab, cudaMemcpy tmp_vect_host = x0 has failed\n");
if (is_two_boundaries) if (is_two_boundaries)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
int eq = index_vara[i+Size*y_kmin]; int eq = index_vara[i+Size*y_kmin];
@ -4563,9 +4454,6 @@ dynSparseMatrix::Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild,
y[eq] += slowc * yy; y[eq] += slowc * yy;
} }
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -4658,9 +4546,6 @@ dynSparseMatrix::Solve_Matlab_GMRES(mxArray *A_m, mxArray *b_m, int Size, double
{ {
double *res = mxGetPr(z); double *res = mxGetPr(z);
if (is_two_boundaries) if (is_two_boundaries)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < (int) n; i++) for (int i = 0; i < (int) n; i++)
{ {
int eq = index_vara[i+Size*y_kmin]; int eq = index_vara[i+Size*y_kmin];
@ -4669,9 +4554,6 @@ dynSparseMatrix::Solve_Matlab_GMRES(mxArray *A_m, mxArray *b_m, int Size, double
y[eq] += slowc * yy; y[eq] += slowc * yy;
} }
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < (int) n; i++) for (int i = 0; i < (int) n; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -4752,9 +4634,6 @@ dynSparseMatrix::Solve_Matlab_BiCGStab(mxArray *A_m, mxArray *b_m, int Size, dou
mxArray *res = mult_SAT_B(Sparse_transpose(A_m), x0_m); mxArray *res = mult_SAT_B(Sparse_transpose(A_m), x0_m);
double *resid = mxGetPr(res); double *resid = mxGetPr(res);
double *b = mxGetPr(b_m); double *b = mxGetPr(b_m);
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < (int)n; i++) for (int i = 0; i < (int)n; i++)
resid[i] = b[i] - resid[i]; resid[i] = b[i] - resid[i];
mxArray *rhs[2]; mxArray *rhs[2];
@ -4768,9 +4647,6 @@ dynSparseMatrix::Solve_Matlab_BiCGStab(mxArray *A_m, mxArray *b_m, int Size, dou
z = lhs[0]; z = lhs[0];
double *phat = mxGetPr(z); double *phat = mxGetPr(z);
double *x0 = mxGetPr(x0_m); double *x0 = mxGetPr(x0_m);
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < (int)n; i++) for (int i = 0; i < (int)n; i++)
phat[i] = x0[i] + phat[i]; phat[i] = x0[i] + phat[i];
@ -4778,9 +4654,6 @@ dynSparseMatrix::Solve_Matlab_BiCGStab(mxArray *A_m, mxArray *b_m, int Size, dou
res = mult_SAT_B(Sparse_transpose(A_m), z); res = mult_SAT_B(Sparse_transpose(A_m), z);
resid = mxGetPr(res); resid = mxGetPr(res);
double cum_abs = 0; double cum_abs = 0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) reduction(+:cum_abs)
#endif
for (int i = 0; i < (int)n; i++) for (int i = 0; i < (int)n; i++)
{ {
resid[i] = b[i] - resid[i]; resid[i] = b[i] - resid[i];
@ -4867,9 +4740,6 @@ dynSparseMatrix::Solve_Matlab_BiCGStab(mxArray *A_m, mxArray *b_m, int Size, dou
{ {
double *res = mxGetPr(z); double *res = mxGetPr(z);
if (is_two_boundaries) if (is_two_boundaries)
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < (int) n; i++) for (int i = 0; i < (int) n; i++)
{ {
int eq = index_vara[i+Size*y_kmin]; int eq = index_vara[i+Size*y_kmin];
@ -4878,9 +4748,6 @@ dynSparseMatrix::Solve_Matlab_BiCGStab(mxArray *A_m, mxArray *b_m, int Size, dou
y[eq] += slowc * yy; y[eq] += slowc * yy;
} }
else else
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < (int) n; i++) for (int i = 0; i < (int) n; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -4904,9 +4771,6 @@ dynSparseMatrix::Singular_display(int block, int Size)
rhs[0] = mxCreateDoubleMatrix(Size, Size, mxREAL); rhs[0] = mxCreateDoubleMatrix(Size, Size, mxREAL);
double *pind; double *pind;
pind = mxGetPr(rhs[0]); pind = mxGetPr(rhs[0]);
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int j = 0; j < Size * Size; j++) for (int j = 0; j < Size * Size; j++)
pind[j] = 0.0; pind[j] = 0.0;
for (int ii = 0; ii < Size; ii++) for (int ii = 0; ii < Size; ii++)
@ -5233,9 +5097,6 @@ dynSparseMatrix::Solve_ByteCode_Sparse_GaussianElimination(int Size, int blck, i
} }
} }
double slowc_lbx = slowc; double slowc_lbx = slowc;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size; i++) for (int i = 0; i < y_size; i++)
ya[i+it_*y_size] = y[i+it_*y_size]; ya[i+it_*y_size] = y[i+it_*y_size];
@ -5844,9 +5705,6 @@ dynSparseMatrix::Solve_ByteCode_Symbolic_Sparse_GaussianElimination(int Size, bo
/*The backward substitution*/ /*The backward substitution*/
double slowc_lbx = slowc; double slowc_lbx = slowc;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size*(periods+y_kmin); i++) for (int i = 0; i < y_size*(periods+y_kmin); i++)
ya[i] = y[i]; ya[i] = y[i];
slowc_save = slowc; slowc_save = slowc;
@ -5863,9 +5721,6 @@ dynSparseMatrix::Grad_f_product(int n, mxArray *b_m, double* vectr, mxArray *A_m
if ((solve_algo == 5 && steady_state) || (stack_solve_algo == 5 && !steady_state)) if ((solve_algo == 5 && steady_state) || (stack_solve_algo == 5 && !steady_state))
{ {
NonZeroElem *first; NonZeroElem *first;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) private(first)
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
double sum = 0; double sum = 0;
@ -5913,9 +5768,6 @@ dynSparseMatrix::Grad_f_product(int n, mxArray *b_m, double* vectr, mxArray *A_m
} }
} }
memset(vectr, 0, n * sizeof(double)); memset(vectr, 0, n * sizeof(double));
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) /*shared(vectr)*/
#endif
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
for (SuiteSparse_long j = Ap[i]; j < Ap[i+1]; j++) for (SuiteSparse_long j = Ap[i]; j < Ap[i+1]; j++)
vectr[Ai[j]] += Ax[j] * b_[i]; vectr[Ai[j]] += Ax[j] * b_[i];
@ -5934,9 +5786,6 @@ dynSparseMatrix::Check_and_Correct_Previous_Iteration(int block_num, int y_size,
{ {
prev_slowc_save = slowc_save; prev_slowc_save = slowc_save;
slowc_save /= 1.1; slowc_save /= 1.1;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -5952,9 +5801,6 @@ dynSparseMatrix::Check_and_Correct_Previous_Iteration(int block_num, int y_size,
{ {
prev_slowc_save = slowc_save; prev_slowc_save = slowc_save;
slowc_save /= 1.5; slowc_save /= 1.5;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -5979,9 +5825,6 @@ dynSparseMatrix::Check_and_Correct_Previous_Iteration(int block_num, int y_size,
double *p = (double*)mxMalloc(size * sizeof(double)); double *p = (double*)mxMalloc(size * sizeof(double));
Grad_f_product(size, b_m_save, p, A_m_save, Ap_save, Ai_save, Ax_save, b_save); Grad_f_product(size, b_m_save, p, A_m_save, Ap_save, Ai_save, Ax_save, b_save);
double slope=0.0; double slope=0.0;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS"))) reduction(+:slope)
#endif
for (int i = 1; i < size; i++) for (int i = 1; i < size; i++)
slope += - direction[i] * p[i]; slope += - direction[i] * p[i];
/*if (slope > 0) /*if (slope > 0)
@ -6037,9 +5880,6 @@ dynSparseMatrix::Check_and_Correct_Previous_Iteration(int block_num, int y_size,
prev_slowc_save = slowc_save; prev_slowc_save = slowc_save;
glambda2 = crit_opt; glambda2 = crit_opt;
try_at_iteration++; try_at_iteration++;
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -6051,10 +5891,7 @@ dynSparseMatrix::Check_and_Correct_Previous_Iteration(int block_num, int y_size,
mxFree(p); mxFree(p);
} }
//if (print_it) //if (print_it)
mexPrintf("Error: Simulation diverging, trying to correct it using slowc=%f\n", slowc_save); mexPrintf("Error: Simulation diverging, trying to correct it using slowc=%f\n", slowc_save);
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -6222,9 +6059,6 @@ dynSparseMatrix::Simulate_One_Boundary(int block_num, int y_size, int y_kmin, in
} }
if (zero_solution) if (zero_solution)
{ {
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
int eq = index_vara[i]; int eq = index_vara[i];
@ -6467,9 +6301,6 @@ dynSparseMatrix::Simulate_Newton_Two_Boundaries(int blck, int y_size, int y_kmin
try_at_iteration++; try_at_iteration++;
if (slowc_save <= bottom) if (slowc_save <= bottom)
{ {
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size*(periods+y_kmin); i++) for (int i = 0; i < y_size*(periods+y_kmin); i++)
y[i] = ya[i]+direction[i]; y[i] = ya[i]+direction[i];
g0 = res2; g0 = res2;
@ -6491,9 +6322,6 @@ dynSparseMatrix::Simulate_Newton_Two_Boundaries(int blck, int y_size, int y_kmin
else else
mexPrintf("Simulation diverging, trying to correct it using slowc=%f\n", slowc_save); mexPrintf("Simulation diverging, trying to correct it using slowc=%f\n", slowc_save);
} }
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (int i = 0; i < y_size*(periods+y_kmin); i++) for (int i = 0; i < y_size*(periods+y_kmin); i++)
y[i] = ya[i]+slowc_save*direction[i]; y[i] = ya[i]+slowc_save*direction[i];
iter--; iter--;

View File

@ -794,17 +794,10 @@ main(int nrhs, const char *prhs[])
direction = (double *) mxMalloc(size_of_direction); direction = (double *) mxMalloc(size_of_direction);
memset(direction, 0, size_of_direction); memset(direction, 0, size_of_direction);
double *x = (double *) mxMalloc(col_x*row_x*sizeof(double)); double *x = (double *) mxMalloc(col_x*row_x*sizeof(double));
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (i = 0; i < row_x*col_x; i++) for (i = 0; i < row_x*col_x; i++)
{ {
x[i] = double (xd[i]); x[i] = double (xd[i]);
} }
#ifdef USE_OMP
#pragma omp parallel for num_threads(atoi(getenv("DYNARE_NUM_THREADS")))
#endif
for (i = 0; i < row_y*col_y; i++) for (i = 0; i < row_y*col_y; i++)
{ {
y[i] = double (yd[i]); y[i] = double (yd[i]);

View File

@ -36,7 +36,7 @@ using namespace std;
Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be
included simultaneously (because of Bison limitations). included simultaneously (because of Bison limitations).
*/ */
void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console, void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console, bool nograph, bool nointeractive,
bool parallel, const string &parallel_config_file, const string &cluster_name, bool parallel_slave_open_mode, bool parallel, const string &parallel_config_file, const string &cluster_name, bool parallel_slave_open_mode,
bool parallel_test bool parallel_test
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
@ -48,7 +48,7 @@ void
usage() usage()
{ {
cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms] [nolog] [warn_uninit]" cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms] [nolog] [warn_uninit]"
<< " [console] [parallel[=cluster_name]] [conffile=parallel_config_path_and_filename] [parallel_slave_open_mode] [parallel_test] " << " [console] [nograph] [nointeractive] [parallel[=cluster_name]] [conffile=parallel_config_path_and_filename] [parallel_slave_open_mode] [parallel_test] "
<< " [-D<variable>[=<value>]]" << " [-D<variable>[=<value>]]"
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
<< " [cygwin] [msvc]" << " [cygwin] [msvc]"
@ -84,6 +84,8 @@ main(int argc, char **argv)
bool no_warn = false; bool no_warn = false;
bool warn_uninit = false; bool warn_uninit = false;
bool console = false; bool console = false;
bool nograph = false;
bool nointeractive = false;
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
bool cygwin = false; bool cygwin = false;
bool msvc = false; bool msvc = false;
@ -129,6 +131,10 @@ main(int argc, char **argv)
warn_uninit = true; warn_uninit = true;
else if (!strcmp(argv[arg], "console")) else if (!strcmp(argv[arg], "console"))
console = true; console = true;
else if (!strcmp(argv[arg], "nograph"))
nograph = true;
else if (!strcmp(argv[arg], "nointeractive"))
nointeractive = true;
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
else if (!strcmp(argv[arg], "cygwin")) else if (!strcmp(argv[arg], "cygwin"))
cygwin = true; cygwin = true;
@ -221,7 +227,7 @@ main(int argc, char **argv)
return EXIT_SUCCESS; return EXIT_SUCCESS;
// Do the rest // Do the rest
main2(macro_output, basename, debug, clear_all, no_tmp_terms, no_log, no_warn, warn_uninit, console, main2(macro_output, basename, debug, clear_all, no_tmp_terms, no_log, no_warn, warn_uninit, console, nograph, nointeractive,
parallel, parallel_config_file, cluster_name, parallel_slave_open_mode, parallel_test parallel, parallel_config_file, cluster_name, parallel_slave_open_mode, parallel_test
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
, cygwin, msvc , cygwin, msvc

View File

@ -26,7 +26,7 @@ using namespace std;
#include "ConfigFile.hh" #include "ConfigFile.hh"
void void
main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console, main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console, bool nograph, bool nointeractive,
bool parallel, const string &parallel_config_file, const string &cluster_name, bool parallel_slave_open_mode, bool parallel, const string &parallel_config_file, const string &cluster_name, bool parallel_slave_open_mode,
bool parallel_test bool parallel_test
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
@ -58,7 +58,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tm
mod_file->computingPass(no_tmp_terms); mod_file->computingPass(no_tmp_terms);
// Write outputs // Write outputs
mod_file->writeOutputFiles(basename, clear_all, no_log, no_warn, console, config_file mod_file->writeOutputFiles(basename, clear_all, no_log, no_warn, console, nograph, nointeractive, config_file
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
, cygwin, msvc , cygwin, msvc
#endif #endif

View File

@ -455,7 +455,7 @@ ModFile::computingPass(bool no_tmp_terms)
} }
void void
ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, bool no_warn, bool console, const ConfigFile &config_file ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, bool no_warn, bool console, bool nograph, bool nointeractive, const ConfigFile &config_file
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
, bool cygwin, bool msvc , bool cygwin, bool msvc
#endif #endif
@ -509,7 +509,12 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
if (console) if (console)
mOutputFile << "options_.console_mode = 1;" << endl mOutputFile << "options_.console_mode = 1;" << endl
<< "options_.nodisplay = 1;" << endl; << "options_.nodisplay = 1;" << endl;
if (nograph)
mOutputFile << "options_.nograph = 1;" << endl;
if (nointeractive)
mOutputFile << "options_.nointeractive = 1;" << endl;
cout << "Processing outputs ..."; cout << "Processing outputs ...";
symbol_table.writeOutput(mOutputFile); symbol_table.writeOutput(mOutputFile);

View File

@ -127,10 +127,12 @@ public:
\param basename The base name used for writing output files. Should be the name of the mod file without its extension \param basename The base name used for writing output files. Should be the name of the mod file without its extension
\param clear_all Should a "clear all" instruction be written to output ? \param clear_all Should a "clear all" instruction be written to output ?
\param console Are we in console mode ? \param console Are we in console mode ?
\param nograph Should we build the figures?
\param nointeractive Should Dynare request user input?
\param cygwin Should the MEX command of use_dll be adapted for Cygwin? \param cygwin Should the MEX command of use_dll be adapted for Cygwin?
\param msvc Should the MEX command of use_dll be adapted for MSVC? \param msvc Should the MEX command of use_dll be adapted for MSVC?
*/ */
void writeOutputFiles(const string &basename, bool clear_all, bool no_log, bool no_warn, bool console, const ConfigFile &config_file void writeOutputFiles(const string &basename, bool clear_all, bool no_log, bool no_warn, bool console, bool nograph, bool nointeractive, const ConfigFile &config_file
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
, bool cygwin, bool msvc , bool cygwin, bool msvc
#endif #endif