Merge branch 'master' into new_ep

time-shift
Michel Juillard 2015-02-19 10:27:15 +01:00
commit 55ea2100c6
31 changed files with 173 additions and 66 deletions

View File

@ -95,7 +95,7 @@
@c %**end of header
@copying
Copyright @copyright{} 1996-2014, Dynare Team.
Copyright @copyright{} 1996-2015, Dynare Team.
@quotation
Permission is granted to copy, distribute and/or modify this document
@ -1875,10 +1875,33 @@ end;
@end deffn
Dynare has the ability to output the list of model equations to a
@LaTeX{} file, using the @code{write_latex_dynamic_model} command. The
static model can also be written with the
@code{write_latex_static_model} command.
Dynare has the ability to output the original list of model equations
to a @LaTeX{} file, using the @code{write_latex_original_model}
command, the list of transformed model equations using the
@code{write_latex_dynamic_model} command, and the list of static model
equations using the @code{write_latex_static_model} command.
@anchor{write_latex_original_model}
@deffn Command write_latex_original_model ;
@descriptionhead
This command creates a @LaTeX{} file containing the model, as defined
in the model block.
If your @file{.mod} file is @file{@var{FILENAME}.mod}, then Dynare
will create a file called @file{@var{FILENAME}_dynamic.tex},
containing the list of all the dynamic model equations.
If @LaTeX{} names were given for variables and parameters
(@pxref{Variable declarations}), then those will be used; otherwise,
the plain text names will be used.
Time subscripts (@code{t}, @code{t+1}, @code{t-1}, @dots{}) will be
appended to the variable names, as @LaTeX{} subscripts.
@end deffn
@anchor{write_latex_dynamic_model}

View File

@ -33,7 +33,7 @@ function [dr,info,M_,options_,oo_] = dr_block(dr,task,M_,options_,oo_,varargin)
% none.
%
% Copyright (C) 2010-2013 Dynare Team
% Copyright (C) 2010-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -72,7 +72,7 @@ end;
if (options_.bytecode)
[chck, zz, data]= bytecode('dynamic','evaluate', z, zx, M_.params, dr.ys, 1, data);
else
[r, data] = feval([M_.fname '_dynamic'], z', zx, M_.params, dr.ys, M_.maximum_lag+1, data);
[r, data] = feval([M_.fname '_dynamic'], options_, M_, oo_, z', zx, M_.params, dr.ys, M_.maximum_lag+1, data);
chck = 0;
end;
mexErrCheck('bytecode', chck);

View File

@ -16,7 +16,7 @@ function info = dyn_forecast(var_list,task)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2013 Dynare Team
% Copyright (C) 2003-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -37,6 +37,8 @@ global options_ oo_ M_
info = 0;
make_ex_;
maximum_lag = M_.maximum_lag;
endo_names = M_.endo_names;
@ -122,15 +124,15 @@ if ~isscalar(trend)
end
for i=1:n_var
eval(['oo_.forecast.Mean.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+1:end)'';']);
eval(['oo_.forecast.HPDinf.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+1:end)''-' ...
' int_width(:,' int2str(i) ');']);
eval(['oo_.forecast.HPDsup.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+1:end)''+' ...
' int_width(:,' int2str(i) ');']);
eval(['oo_.forecast.Mean.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+(1:horizon))'';']);
eval(['oo_.forecast.HPDinf.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+(1:horizon))''-' ...
' int_width(1:horizon,' int2str(i) ');']);
eval(['oo_.forecast.HPDsup.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+(1:horizon))''+' ...
' int_width(1:horizon,' int2str(i) ');']);
end
for i=1:M_.exo_det_nbr
eval(['oo_.forecast.Exogenous.' M_.exo_det_names(i,:) '= oo_.exo_det_simul(:,' int2str(i) ');']);
eval(['oo_.forecast.Exogenous.' M_.exo_det_names(i,:) '= oo_.exo_det_simul(maximum_lag+(1:horizon),' int2str(i) ');']);
end
if options_.nograph == 0

View File

@ -14,7 +14,7 @@ function [steady_state,params,check] = dyn_ramsey_static(ys_init,M,options_,oo)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2014 Dynare Team
% Copyright (C) 2003-2015 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -15,7 +15,7 @@ function dynareroot = dynare_config(path_to_dynare,verbose)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2001-2014 Dynare Team
% Copyright (C) 2001-2015 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -14,7 +14,7 @@ function [ts,results] = extended_path(initial_conditions,sample_size)
%
% SPECIAL REQUIREMENTS
% Copyright (C) 2009-2013 Dynare Team
% Copyright (C) 2009-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -325,4 +325,4 @@ if info_convergence
y = endo_simul(:,2);
else
y = NaN(size(endo_nbr,1));
end
end

View File

@ -1,6 +1,6 @@
function [flag,endo_simul,err] = solve_stochastic_perfect_foresight_model(endo_simul,exo_simul,pfm,nnodes,order)
% Copyright (C) 2012-2013 Dynare Team
% Copyright (C) 2012-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -232,4 +232,4 @@ function [flag,endo_simul,err] = solve_stochastic_perfect_foresight_model(endo_s
end
if verbose
disp (['-----------------------------------------------------']) ;
end
end

View File

@ -19,7 +19,7 @@ function DynareResults = initial_estimation_checks(objective_function,xparam1,Dy
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2014 Dynare Team
% Copyright (C) 2003-2015 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,5 +1,5 @@
function ra = lnsrch1_wrapper_two_boundaries(ya, fname, y, y_index, x, ...
params, steady_state, periods, y_kmin, y_size)
params, steady_state, periods, y_kmin, y_size,Periods)
% wrapper for solve_one_boundary m-file when it is used with a dynamic
% model
%
@ -26,7 +26,7 @@ function ra = lnsrch1_wrapper_two_boundaries(ya, fname, y, y_index, x, ...
% none.
%
% Copyright (C) 2009-2011 Dynare Team
% Copyright (C) 2009-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -45,5 +45,5 @@ function ra = lnsrch1_wrapper_two_boundaries(ya, fname, y, y_index, x, ...
%reshape the input arguments of the dynamic function
y(y_kmin+1:y_kmin+periods, y_index) = reshape(ya',length(y_index),periods)';
[r, y, g1, g2, g3, b]=feval(fname, y, x, params, steady_state, periods, 0, y_kmin, y_size);
[r, y, g1, g2, g3, b]=feval(fname, y, x, params, steady_state, periods, 0, y_kmin, y_size, Periods);
ra = reshape(r(:, y_kmin+1:periods+y_kmin),periods*y_size, 1);

View File

@ -12,7 +12,7 @@ function perfect_foresight_solver()
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 1996-2014 Dynare Team
% Copyright (C) 1996-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -164,4 +164,4 @@ else
end
ts = dseries(transpose(oo_.endo_simul),initial_period,cellstr(M_.endo_names));
assignin('base', 'Simulated_time_series', ts);
assignin('base', 'Simulated_time_series', ts);

View File

@ -1,6 +1,7 @@
function check_input_arguments(DynareOptions, DynareModel, DynareResults)
%function check_input_arguments(DynareOptions, DynareModel, DynareResults)
% Copyright (C) 2014 Dynare Team
% Copyright (C) 2015 Dynare Team
%
% This file is part of Dynare.
%
@ -43,6 +44,7 @@ if isempty(DynareResults.endo_simul) || any(size(DynareResults.endo_simul) ~= [
error('perfect_foresight_solver:ArgCheck','PERFECT_FORESIGHT_SOLVER: ''oo_.endo_simul'' has wrong size. Did you run ''perfect_foresight_setup'' ?')
end
if isempty(DynareResults.exo_simul) || any(size(DynareResults.exo_simul) ~= [ DynareModel.maximum_lag+DynareOptions.periods+DynareModel.maximum_lead, DynareModel.exo_nbr ])
if (DynareModel.exo_nbr > 0) && (isempty(DynareResults.exo_simul) || ...
any(size(DynareResults.exo_simul) ~= [ DynareModel.maximum_lag+DynareOptions.periods+DynareModel.maximum_lead, DynareModel.exo_nbr ]))
error('perfect_foresight_solver:ArgCheck','PERFECT_FORESIGHT_SOLVER: ''oo_.exo_simul'' has wrong size. Did you run ''perfect_foresight_setup'' ?')
end

View File

@ -1,4 +1,22 @@
function [oo_, maxerror] = simulation_core(options_, M_, oo_)
%function [oo_, maxerror] = simulation_core(options_, M_, oo_)
% Copyright (C) 2015 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 options_.block
if options_.bytecode
@ -15,7 +33,7 @@ if options_.block
end
mexErrCheck('bytecode', info);
else
eval([M_.fname '_dynamic']);
oo_ = feval([M_.fname '_dynamic'], options_, M_, oo_);
end
else
if options_.bytecode

View File

@ -13,7 +13,7 @@ function oo = sim1(M, options, oo)
% SPECIAL REQUIREMENTS
% None.
% Copyright (C) 1996-2013 Dynare Team
% Copyright (C) 1996-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -216,4 +216,4 @@ end
if verbose
disp (['-----------------------------------------------------']) ;
skipline();
end
end

View File

@ -16,7 +16,7 @@ function oo_ = sim1_lbj(options_, M_, oo_)
% SPECIAL REQUIREMENTS
% None.
% Copyright (C) 1996-2012 Dynare Team
% Copyright (C) 1996-2015 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,7 +1,7 @@
function oo_ = sim1_purely_backward(options_, M_, oo_)
% Performs deterministic simulation of a purely backward model
% Copyright (C) 2012-2014 Dynare Team
% Copyright (C) 2012-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -52,4 +52,4 @@ function oo_ = sim1_purely_backward(options_, M_, oo_)
end
oo_.endo_simul(:,it) = tmp(nyb+1:nyb+M_.endo_nbr);
end
end

View File

@ -1,7 +1,7 @@
function oo_ = sim1_purely_forward(options_, M_, oo_)
% Performs deterministic simulation of a purely forward model
% Copyright (C) 2012-2014 Dynare Team
% Copyright (C) 2012-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -44,4 +44,4 @@ function oo_ = sim1_purely_forward(options_, M_, oo_)
end
oo_.endo_simul(:,it) = tmp(1:M_.endo_nbr);
end
end

View File

@ -1,4 +1,4 @@
function [y, oo]= solve_two_boundaries(fname, y, x, params, steady_state, y_index, nze, periods, y_kmin_l, y_kmax_l, is_linear, Block_Num, y_kmin, maxit_, solve_tolf, lambda, cutoff, stack_solve_algo, M, oo)
function [y, oo]= solve_two_boundaries(fname, y, x, params, steady_state, y_index, nze, periods, y_kmin_l, y_kmax_l, is_linear, Block_Num, y_kmin, maxit_, solve_tolf, lambda, cutoff, stack_solve_algo,options,M, oo)
% Computes the deterministic simulation of a block of equation containing
% both lead and lag variables using relaxation methods
%
@ -46,7 +46,7 @@ function [y, oo]= solve_two_boundaries(fname, y, x, params, steady_state, y_inde
% none.
%
% Copyright (C) 1996-2013 Dynare Team
% Copyright (C) 1996-2015 Dynare Team
%
% This file is part of Dynare.
%
@ -81,7 +81,7 @@ Jacobian_Size=Blck_size*(y_kmin+y_kmax_l +periods);
g1=spalloc( Blck_size*periods, Jacobian_Size, nze*periods);
reduced = 0;
while ~(cvg==1 || iter>maxit_),
[r, y, g1, g2, g3, b]=feval(fname, y, x, params, steady_state, periods, 0, y_kmin, Blck_size);
[r, y, g1, g2, g3, b]=feval(fname, y, x, params, steady_state, periods, 0, y_kmin, Blck_size,options.periods);
preconditioner = 2;
g1a=g1(:, y_kmin*Blck_size+1:(periods+y_kmin)*Blck_size);
term1 = g1(:, 1:y_kmin_l*Blck_size)*reshape(y(1+y_kmin-y_kmin_l:y_kmin,y_index)',1,y_kmin_l*Blck_size)';
@ -298,8 +298,7 @@ while ~(cvg==1 || iter>maxit_),
g = (ra'*g1a)';
f = 0.5*ra'*ra;
p = -g1a\ra;
[yn,f,ra,check]=lnsrch1(ya,f,g,p,stpmax, ...
'lnsrch1_wrapper_two_boundaries',nn,nn, fname, y, y_index, x, params, steady_state, periods, y_kmin, Blck_size);
[yn,f,ra,check]=lnsrch1(ya,f,g,p,stpmax,'lnsrch1_wrapper_two_boundaries',nn,nn, fname, y, y_index,x, params, steady_state, periods, y_kmin, Blck_size,options.periods);
dx = ya - yn;
y(1+y_kmin:periods+y_kmin,y_index)=reshape(yn',length(y_index),periods)';
end

View File

@ -1431,6 +1431,17 @@ WriteLatexStaticModelStatement::writeOutput(ostream &output, const string &basen
static_model.writeLatexFile(basename);
}
WriteLatexOriginalModelStatement::WriteLatexOriginalModelStatement(const DynamicModel &original_model_arg) :
original_model(original_model_arg)
{
}
void
WriteLatexOriginalModelStatement::writeOutput(ostream &output, const string &basename) const
{
original_model.writeLatexOriginalFile(basename);
}
ShockDecompositionStatement::ShockDecompositionStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg) :
symbol_list(symbol_list_arg),

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2014 Dynare Team
* Copyright (C) 2003-2015 Dynare Team
*
* This file is part of Dynare.
*
@ -509,6 +509,15 @@ public:
virtual void writeOutput(ostream &output, const string &basename) const;
};
class WriteLatexOriginalModelStatement : public Statement
{
private:
const DynamicModel &original_model;
public:
WriteLatexOriginalModelStatement(const DynamicModel &original_model_arg);
virtual void writeOutput(ostream &output, const string &basename) const;
};
class ShockDecompositionStatement : public Statement
{
private:

View File

@ -342,7 +342,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
else if (simulation_type == SOLVE_BACKWARD_SIMPLE || simulation_type == SOLVE_FORWARD_SIMPLE)
output << "function [residual, y, g1, g2, g3, varargout] = " << dynamic_basename << "_" << block+1 << "(y, x, params, steady_state, it_, jacobian_eval)\n";
else
output << "function [residual, y, g1, g2, g3, b, varargout] = " << dynamic_basename << "_" << block+1 << "(y, x, params, steady_state, periods, jacobian_eval, y_kmin, y_size)\n";
output << "function [residual, y, g1, g2, g3, b, varargout] = " << dynamic_basename << "_" << block+1 << "(y, x, params, steady_state, periods, jacobian_eval, y_kmin, y_size, Periods)\n";
BlockType block_type;
if (simulation_type == SOLVE_TWO_BOUNDARIES_COMPLETE || simulation_type == SOLVE_TWO_BOUNDARIES_SIMPLE)
block_type = SIMULTAN;
@ -364,7 +364,6 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
<< " % // Simulation type "
<< BlockSim(simulation_type) << " //" << endl
<< " % ////////////////////////////////////////////////////////////////////////" << endl;
output << " global options_ oo_;" << endl;
//The Temporary terms
if (simulation_type == EVALUATE_BACKWARD || simulation_type == EVALUATE_FORWARD)
{
@ -385,9 +384,9 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
output << " else\n";
if (simulation_type == SOLVE_TWO_BOUNDARIES_COMPLETE || simulation_type == SOLVE_TWO_BOUNDARIES_SIMPLE)
{
output << " g1 = spalloc(" << block_mfs << "*options_.periods, "
<< block_mfs << "*(options_.periods+" << max_leadlag_block[block].first+max_leadlag_block[block].second+1 << ")"
<< ", " << nze << "*options_.periods);\n";
output << " g1 = spalloc(" << block_mfs << "*Periods, "
<< block_mfs << "*(Periods+" << max_leadlag_block[block].first+max_leadlag_block[block].second+1 << ")"
<< ", " << nze << "*Periods);\n";
}
else
{
@ -1789,8 +1788,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
int Nb_SGE = 0;
bool open_par = false;
mDynamicModelFile << "function [varargout] = " << dynamic_basename << "(varargin)\n";
mDynamicModelFile << " global oo_ options_ M_ ;\n";
mDynamicModelFile << "function [varargout] = " << dynamic_basename << "(options_, M_, oo_, varargin)\n";
mDynamicModelFile << " g2=[];g3=[];\n";
//Temporary variables declaration
OK = true;
@ -1805,7 +1803,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
(*it)->writeOutput(tmp_output, oMatlabStaticModelSparse, temporary_terms);
}
if (tmp_output.str().length() > 0)
mDynamicModelFile << " global " << tmp_output.str() << " M_ ;\n";
mDynamicModelFile << " global " << tmp_output.str() << ";\n";
mDynamicModelFile << " T_init=zeros(1,options_.periods+M_.maximum_lag+M_.maximum_lead);\n";
tmp_output.str("");
@ -1882,7 +1880,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
break;
case SOLVE_TWO_BOUNDARIES_COMPLETE:
case SOLVE_TWO_BOUNDARIES_SIMPLE:
mDynamicModelFile << " [r, y, dr(" << count_call << ").g1, dr(" << count_call << ").g2, dr(" << count_call << ").g3, b, dr(" << count_call << ").g1_x, dr(" << count_call << ").g1_xd, dr(" << count_call << ").g1_o]=" << dynamic_basename << "_" << block + 1 << "(y, x, params, steady_state, it_-" << max_lag << ", 1, " << max_lag << ", " << block_recursive << ");\n";
mDynamicModelFile << " [r, y, dr(" << count_call << ").g1, dr(" << count_call << ").g2, dr(" << count_call << ").g3, b, dr(" << count_call << ").g1_x, dr(" << count_call << ").g1_xd, dr(" << count_call << ").g1_o]=" << dynamic_basename << "_" << block + 1 << "(y, x, params, steady_state, it_-" << max_lag << ", 1, " << max_lag << ", " << block_recursive << "," << "options_.periods" << ");\n";
mDynamicModelFile << " residual(y_index_eq)=r(:,M_.maximum_lag+1);\n";
break;
default:
@ -2065,7 +2063,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
<<", options_.periods, " << max_leadlag_block[block].first
<<", " << max_leadlag_block[block].second
<<", " << blocks_linear[block]
<<", blck_num, y_kmin, options_.simul.maxit, options_.solve_tolf, options_.slowc, " << cutoff << ", options_.stack_solve_algo, M_, oo_);\n";
<<", blck_num, y_kmin, options_.simul.maxit, options_.solve_tolf, options_.slowc, " << cutoff << ", options_.stack_solve_algo, options_, M_, oo_);\n";
mDynamicModelFile << " tmp = y(:,M_.block_structure.block(" << block + 1 << ").variable);\n";
mDynamicModelFile << " if any(isnan(tmp) | isinf(tmp))\n";
mDynamicModelFile << " disp(['Inf or Nan value during the resolution of block " << block <<"']);\n";
@ -2077,6 +2075,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
mDynamicModelFile << " end;\n";
open_par = false;
mDynamicModelFile << " oo_.endo_simul = y';\n";
mDynamicModelFile << " varargout{1} = oo_;\n";
mDynamicModelFile << "return;\n";
mDynamicModelFile << "end" << endl;
@ -3997,6 +3996,12 @@ DynamicModel::writeLatexFile(const string &basename) const
writeLatexModelFile(basename + "_dynamic.tex", oLatexDynamicModel);
}
void
DynamicModel::writeLatexOriginalFile(const string &basename) const
{
writeLatexModelFile(basename + "_original.tex", oLatexDynamicModel);
}
void
DynamicModel::substituteEndoLeadGreaterThanTwo(bool deterministic_model)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2014 Dynare Team
* Copyright (C) 2003-2015 Dynare Team
*
* This file is part of Dynare.
*
@ -252,6 +252,9 @@ public:
//! Writes LaTeX file with the equations of the dynamic model
void writeLatexFile(const string &basename) const;
//! Writes LaTeX file with the equations of the dynamic model (for the original model)
void writeLatexOriginalFile(const string &basename) const;
virtual int getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException);
virtual int getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException);
virtual void addAllParamDerivId(set<int> &deriv_id_set);

View File

@ -126,7 +126,7 @@ class ParsingDriver;
%token <string_val> TEX_NAME
%token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED
%token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES
%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL
%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL WRITE_LATEX_ORIGINAL_MODEL
%token XLS_SHEET XLS_RANGE LONG_NAME
%left COMMA
%left EQUAL_EQUAL EXCLAMATION_EQUAL
@ -250,6 +250,7 @@ statement : parameters
| identification
| write_latex_dynamic_model
| write_latex_static_model
| write_latex_original_model
| shock_decomposition
| conditional_forecast
| conditional_forecast_paths
@ -1906,6 +1907,10 @@ write_latex_static_model : WRITE_LATEX_STATIC_MODEL ';'
{ driver.write_latex_static_model(); }
;
write_latex_original_model : WRITE_LATEX_ORIGINAL_MODEL ';'
{ driver.write_latex_original_model(); }
;
shock_decomposition : SHOCK_DECOMPOSITION ';'
{driver.shock_decomposition(); }
| SHOCK_DECOMPOSITION '(' shock_decomposition_options_list ')' ';'

View File

@ -129,6 +129,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
<INITIAL>save_params_and_steady_state {BEGIN DYNARE_STATEMENT; return token::SAVE_PARAMS_AND_STEADY_STATE;}
<INITIAL>write_latex_dynamic_model {BEGIN DYNARE_STATEMENT; return token::WRITE_LATEX_DYNAMIC_MODEL;}
<INITIAL>write_latex_static_model {BEGIN DYNARE_STATEMENT; return token::WRITE_LATEX_STATIC_MODEL;}
<INITIAL>write_latex_original_model {BEGIN DYNARE_STATEMENT; return token::WRITE_LATEX_ORIGINAL_MODEL;}
<INITIAL>steady {BEGIN DYNARE_STATEMENT; return token::STEADY;}
<INITIAL>check {BEGIN DYNARE_STATEMENT; return token::CHECK;}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2007-2014 Dynare Team
* Copyright (C) 2007-2015 Dynare Team
*
* This file is part of Dynare.
*
@ -1851,8 +1851,20 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
}
return;
case oExpectation:
cerr << "UnaryOpNode::writeOutput: not implemented on oExpectation" << endl;
exit(EXIT_FAILURE);
if (!IS_LATEX(output_type))
{
cerr << "UnaryOpNode::writeOutput: not implemented on oExpectation" << endl;
exit(EXIT_FAILURE);
}
output << "\\mathbb{E}_{t";
if (expectation_information_set != 0)
{
if (expectation_information_set > 0)
output << "+";
output << expectation_information_set;
}
output << "}";
break;
case oErf:
output << "erf";
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2014 Dynare Team
* Copyright (C) 2006-2015 Dynare Team
*
* This file is part of Dynare.
*
@ -32,6 +32,7 @@
ModFile::ModFile(WarningConsolidation &warnings_arg)
: expressions_tree(symbol_table, num_constants, external_functions_table),
original_model(symbol_table, num_constants, external_functions_table),
dynamic_model(symbol_table, num_constants, external_functions_table),
trend_dynamic_model(symbol_table, num_constants, external_functions_table),
ramsey_FOC_equations_dynamic_model(symbol_table, num_constants, external_functions_table),
@ -306,6 +307,9 @@ ModFile::checkPass()
void
ModFile::transformPass(bool nostrict)
{
// Save the original model (must be done before any model transformations by preprocessor)
dynamic_model.cloneDynamic(original_model);
if (nostrict)
{
set<int> unusedEndogs = dynamic_model.findUnusedEndogenous();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2014 Dynare Team
* Copyright (C) 2006-2015 Dynare Team
*
* This file is part of Dynare.
*
@ -51,6 +51,8 @@ public:
NumericalConstants num_constants;
//! Expressions outside model block
DataTree expressions_tree;
//! Original model, as declared in the "model" block, that won't be modified by the preprocessor
DynamicModel original_model;
//! Dynamic model, as declared in the "model" block
DynamicModel dynamic_model;
//! A copy of Dynamic model, for testing trends declared by user

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2014 Dynare Team
* Copyright (C) 2003-2015 Dynare Team
*
* This file is part of Dynare.
*
@ -1352,6 +1352,7 @@ ModelTree::writeLatexModelFile(const string &filename, ExprNodeOutputType output
output << "\\documentclass[10pt,a4paper]{article}" << endl
<< "\\usepackage[landscape]{geometry}" << endl
<< "\\usepackage{fullpage}" << endl
<< "\\usepackage{amsfonts}" << endl
<< "\\usepackage{breqn}" << endl
<< "\\begin{document}" << endl
<< "\\footnotesize" << endl;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2014 Dynare Team
* Copyright (C) 2003-2015 Dynare Team
*
* This file is part of Dynare.
*
@ -1820,6 +1820,12 @@ ParsingDriver::write_latex_static_model()
mod_file->addStatement(new WriteLatexStaticModelStatement(mod_file->static_model));
}
void
ParsingDriver::write_latex_original_model()
{
mod_file->addStatement(new WriteLatexOriginalModelStatement(mod_file->original_model));
}
void
ParsingDriver::bvar_density(string *maxnlags)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2014 Dynare Team
* Copyright (C) 2003-2015 Dynare Team
*
* This file is part of Dynare.
*
@ -503,6 +503,8 @@ public:
void write_latex_dynamic_model();
//! Adds a write_latex_static_model statement
void write_latex_static_model();
//! Adds a write_latex_original_model statement
void write_latex_original_model();
//! BVAR marginal density
void bvar_density(string *maxnlags);
//! BVAR forecast

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2013 Dynare Team
* Copyright (C) 2008-2015 Dynare Team
*
* This file is part of Dynare.
*
@ -190,7 +190,7 @@ CONT \\\\
yylloc->step();
}
<FOR_BODY>. { for_body_tmp.append(yytext); yylloc->step(); }
<FOR_BODY><<EOF>> { driver.error(for_stmt_loc_tmp, "@#for loop not matched by an @#endfor (unexpected end of file)"); }
<FOR_BODY><<EOF>> { driver.error(for_stmt_loc_tmp, "@#for loop not matched by an @#endfor or file does not end with a new line (unexpected end of file)"); }
<FOR_BODY>^{SPC}*@#{SPC}*endfor{SPC}*(\/\/.*)?{EOL} {
yylloc->lines(1);
yylloc->step();
@ -227,7 +227,7 @@ CONT \\\\
yylloc->step();
}
<THEN_BODY>. { then_body_tmp.append(yytext); yylloc->step(); }
<THEN_BODY><<EOF>> { driver.error(if_stmt_loc_tmp, "@#if/@#ifdef/@#ifndef not matched by an @#endif (unexpected end of file)"); }
<THEN_BODY><<EOF>> { driver.error(if_stmt_loc_tmp, "@#if/@#ifdef/@#ifndef not matched by an @#endif or file does not end with a new line (unexpected end of file)"); }
<THEN_BODY>^{SPC}*@#{SPC}*else{SPC}*(\/\/.*)?{EOL} {
yylloc->lines(1);
yylloc->step();
@ -269,7 +269,7 @@ CONT \\\\
yylloc->step();
}
<ELSE_BODY>. { else_body_tmp.append(yytext); yylloc->step(); }
<ELSE_BODY><<EOF>> { driver.error(if_stmt_loc_tmp, "@#if/@#ifdef/@#ifndef not matched by an @#endif (unexpected end of file)"); }
<ELSE_BODY><<EOF>> { driver.error(if_stmt_loc_tmp, "@#if/@#ifdef/@#ifndef not matched by an @#endif or file does not end with a new line (unexpected end of file)"); }
<ELSE_BODY>^{SPC}*@#{SPC}*endif{SPC}*(\/\/.*)?{EOL} {
yylloc->lines(1);

View File

@ -35,6 +35,8 @@ e = 0;
u = 0;
end;
write_latex_original_model;
shocks;
var e; stderr 0.009;
var u; stderr 0.009;