Merge branch 'master' into use-dynSeries
Conflicts: matlab/dynare_estimation_1.missue#70
commit
ff36525486
|
@ -516,16 +516,32 @@ ConfigFile::checkPass(WarningConsolidation &warnings) const
|
|||
cerr << "ERROR (node " << it->first << "): the UserName option must be passed for every remote node." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
if (it->second->userName.empty() || it->second->password.empty())
|
||||
if (it->second->operatingSystem.compare("windows") == 0)
|
||||
{
|
||||
cerr << "ERROR (node " << it->first << "): the Password option must be passed under Windows for every remote node." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
if (it->second->password.empty())
|
||||
{
|
||||
cerr << "ERROR (node " << it->first << "): the Password option must be passed under Windows for every remote node." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (it->second->remoteDrive.empty())
|
||||
{
|
||||
cerr << "ERROR (node " << it->first << "): the RemoteDrive option must be passed under Windows for every remote node." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if (it->second->remoteDrive.empty())
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
if (it->second->operatingSystem.empty())
|
||||
{
|
||||
cerr << "ERROR (node " << it->first << "): the RemoteDrive option must be passed under Windows for every remote node." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
if (it->second->password.empty())
|
||||
{
|
||||
cerr << "ERROR (node " << it->first << "): the Password option must be passed under Windows for every remote node." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (it->second->remoteDrive.empty())
|
||||
{
|
||||
cerr << "ERROR (node " << it->first << "): the RemoteDrive option must be passed under Windows for every remote node." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (it->second->remoteDirectory.empty())
|
||||
|
|
|
@ -3924,29 +3924,29 @@ DynamicModel::writeLatexFile(const string &basename) const
|
|||
void
|
||||
DynamicModel::substituteEndoLeadGreaterThanTwo(bool deterministic_model)
|
||||
{
|
||||
substituteLeadLagInternal(avEndoLead, deterministic_model);
|
||||
substituteLeadLagInternal(avEndoLead, deterministic_model, vector<string>());
|
||||
}
|
||||
|
||||
void
|
||||
DynamicModel::substituteEndoLagGreaterThanTwo(bool deterministic_model)
|
||||
{
|
||||
substituteLeadLagInternal(avEndoLag, deterministic_model);
|
||||
substituteLeadLagInternal(avEndoLag, deterministic_model, vector<string>());
|
||||
}
|
||||
|
||||
void
|
||||
DynamicModel::substituteExoLead(bool deterministic_model)
|
||||
{
|
||||
substituteLeadLagInternal(avExoLead, deterministic_model);
|
||||
substituteLeadLagInternal(avExoLead, deterministic_model, vector<string>());
|
||||
}
|
||||
|
||||
void
|
||||
DynamicModel::substituteExoLag(bool deterministic_model)
|
||||
{
|
||||
substituteLeadLagInternal(avExoLag, deterministic_model);
|
||||
substituteLeadLagInternal(avExoLag, deterministic_model, vector<string>());
|
||||
}
|
||||
|
||||
void
|
||||
DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model)
|
||||
DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model, const vector<string> &subset)
|
||||
{
|
||||
ExprNode::subst_table_t subst_table;
|
||||
vector<BinaryOpNode *> neweqs;
|
||||
|
@ -3976,7 +3976,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
|
|||
subst = value->substituteExoLag(subst_table, neweqs);
|
||||
break;
|
||||
case avDiffForward:
|
||||
subst = value->differentiateForwardVars(subst_table, neweqs);
|
||||
subst = value->differentiateForwardVars(subset, subst_table, neweqs);
|
||||
break;
|
||||
default:
|
||||
cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl;
|
||||
|
@ -4004,7 +4004,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
|
|||
subst = equations[i]->substituteExoLag(subst_table, neweqs);
|
||||
break;
|
||||
case avDiffForward:
|
||||
subst = equations[i]->differentiateForwardVars(subst_table, neweqs);
|
||||
subst = equations[i]->differentiateForwardVars(subset, subst_table, neweqs);
|
||||
break;
|
||||
default:
|
||||
cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl;
|
||||
|
@ -4134,9 +4134,9 @@ DynamicModel::removeTrendVariableFromEquations()
|
|||
}
|
||||
|
||||
void
|
||||
DynamicModel::differentiateForwardVars()
|
||||
DynamicModel::differentiateForwardVars(const vector<string> &subset)
|
||||
{
|
||||
substituteLeadLagInternal(avDiffForward, true);
|
||||
substituteLeadLagInternal(avDiffForward, true, subset);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -139,8 +139,11 @@ private:
|
|||
void collectBlockVariables();
|
||||
|
||||
//! Factorized code for substitutions of leads/lags
|
||||
/*! \param[in] type determines which type of variables is concerned */
|
||||
void substituteLeadLagInternal(aux_var_t type, bool deterministic_model);
|
||||
/*! \param[in] type determines which type of variables is concerned
|
||||
\param[in] deterministic_model whether we are in a deterministic model (only for exogenous leads/lags)
|
||||
\param[in] subset variables to which to apply the transformation (only for diff of forward vars)
|
||||
*/
|
||||
void substituteLeadLagInternal(aux_var_t type, bool deterministic_model, const vector<string> &subset);
|
||||
|
||||
private:
|
||||
//! Indicate if the temporary terms are computed for the overall model (true) or not (false). Default value true
|
||||
|
@ -281,7 +284,9 @@ public:
|
|||
void removeTrendVariableFromEquations();
|
||||
|
||||
//! Transforms the model by creating aux vars for the diff of forward vars
|
||||
void differentiateForwardVars();
|
||||
/*! If subset is empty, does the transformation for all fwrd vars; otherwise
|
||||
restrict it to the vars in subset */
|
||||
void differentiateForwardVars(const vector<string> &subset);
|
||||
|
||||
//! Fills eval context with values of model local variables and auxiliary variables
|
||||
void fillEvalContext(eval_context_t &eval_context) const;
|
||||
|
|
|
@ -112,13 +112,13 @@ class ParsingDriver;
|
|||
%token LABELS LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_IDENT_FILES LOAD_MH_FILE LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR LYAPUNOV
|
||||
%token LYAPUNOV_FIXED_POINT_TOL LYAPUNOV_DOUBLING_TOL LYAPUNOV_SQUARE_ROOT_SOLVER_TOL LOG_DEFLATOR LOG_TREND_VAR LOG_GROWTH_FACTOR MARKOWITZ MARGINAL_DENSITY MAX MAXIT
|
||||
%token MFS MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN MINIMAL_SOLVING_PERIODS SOLVE_MAXIT
|
||||
%token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
|
||||
%token MODE_CHECK MODE_CHECK_NEIGHBOURHOOD_SIZE MODE_CHECK_SYMMETRIC_PLOTS MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
|
||||
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS
|
||||
%token <string_val> NAME
|
||||
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS
|
||||
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF
|
||||
%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS MAX_DIM_COVA_GROUP ADVANCED
|
||||
%token PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERFECT_FORESIGHT PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
|
||||
%token PARALLEL_LOCAL_FILES PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERFECT_FORESIGHT PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
|
||||
%token PRINT PRIOR_MC PRIOR_TRUNC PRIOR_MODE PRIOR_MEAN POSTERIOR_MODE POSTERIOR_MEAN POSTERIOR_MEDIAN PRUNING
|
||||
%token <string_val> QUOTED_STRING
|
||||
%token QZ_CRITERIUM FULL DSGE_VAR DSGE_VARLAG DSGE_PRIOR_WEIGHT TRUNCATE
|
||||
|
@ -128,7 +128,7 @@ class ParsingDriver;
|
|||
%token STDERR STEADY STOCH_SIMUL SURPRISE SYLVESTER SYLVESTER_FIXED_POINT_TOL REGIMES REGIME
|
||||
%token TEX RAMSEY_POLICY PLANNER_DISCOUNT DISCRETIONARY_POLICY DISCRETIONARY_TOL
|
||||
%token <string_val> TEX_NAME
|
||||
%token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE
|
||||
%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 XLS_SHEET XLS_RANGE
|
||||
|
@ -568,8 +568,10 @@ model_options : BLOCK { driver.block(); }
|
|||
| BYTECODE { driver.byte_code(); }
|
||||
| USE_DLL { driver.use_dll(); }
|
||||
| NO_STATIC { driver.no_static();}
|
||||
| DIFFERENTIATE_FORWARD_VARS { driver.differentiate_forward_vars(); }
|
||||
| DIFFERENTIATE_FORWARD_VARS { driver.differentiate_forward_vars_all(); }
|
||||
| DIFFERENTIATE_FORWARD_VARS EQUAL '(' symbol_list ')' { driver.differentiate_forward_vars_some(); }
|
||||
| o_linear
|
||||
| PARALLEL_LOCAL_FILES EQUAL '(' parallel_local_filename_list ')'
|
||||
;
|
||||
|
||||
model_options_list : model_options_list COMMA model_options
|
||||
|
@ -1512,6 +1514,8 @@ estimation_options : o_datafile
|
|||
| o_mode_file
|
||||
| o_mode_compute
|
||||
| o_mode_check
|
||||
| o_mode_check_neighbourhood_size
|
||||
| o_mode_check_symmetric_plots
|
||||
| o_prior_trunc
|
||||
| o_mh_mode
|
||||
| o_mh_nblocks
|
||||
|
@ -1560,6 +1564,7 @@ estimation_options : o_datafile
|
|||
| o_analytic_derivation
|
||||
| o_ar
|
||||
| o_endogenous_prior
|
||||
| o_use_univariate_filters_if_singularity_is_detected
|
||||
;
|
||||
|
||||
list_optim_option : QUOTED_STRING COMMA QUOTED_STRING
|
||||
|
@ -1674,6 +1679,12 @@ filename : symbol
|
|||
| QUOTED_STRING
|
||||
;
|
||||
|
||||
parallel_local_filename_list : filename
|
||||
{ driver.add_parallel_local_file($1); }
|
||||
| parallel_local_filename_list COMMA filename
|
||||
{ driver.add_parallel_local_file($3); }
|
||||
;
|
||||
|
||||
mc_filename_list : filename
|
||||
{ driver.add_mc_filename($1); }
|
||||
| filename '(' non_negative_number ')'
|
||||
|
@ -2335,6 +2346,8 @@ o_mode_file : MODE_FILE EQUAL filename { driver.option_str("mode_file", $3); };
|
|||
o_mode_compute : MODE_COMPUTE EQUAL INT_NUMBER { driver.option_num("mode_compute", $3); };
|
||||
| MODE_COMPUTE EQUAL symbol { driver.option_str("mode_compute", $3); };
|
||||
o_mode_check : MODE_CHECK { driver.option_num("mode_check", "1"); };
|
||||
o_mode_check_neighbourhood_size : MODE_CHECK_NEIGHBOURHOOD_SIZE EQUAL signed_number_w_inf { driver.option_num("mode_check_neighbourhood_size", $3); };
|
||||
o_mode_check_symmetric_plots : MODE_CHECK_SYMMETRIC_PLOTS EQUAL INT_NUMBER { driver.option_num("mode_check_symmetric_plots", $3); };
|
||||
o_prior_trunc : PRIOR_TRUNC EQUAL non_negative_number { driver.option_num("prior_trunc", $3); };
|
||||
o_mh_mode : MH_MODE EQUAL INT_NUMBER { driver.option_num("mh_mode", $3); };
|
||||
o_mh_nblocks : MH_NBLOCKS EQUAL INT_NUMBER { driver.option_num("mh_nblck", $3); };
|
||||
|
@ -2651,6 +2664,7 @@ o_data_obs_nbr : DATA_OBS_NBR EQUAL INT_NUMBER { driver.option_num("ms.forecast_
|
|||
o_discretionary_tol: DISCRETIONARY_TOL EQUAL non_negative_number { driver.option_num("discretionary_tol",$3); };
|
||||
o_analytic_derivation : ANALYTIC_DERIVATION { driver.option_num("analytic_derivation", "1"); }
|
||||
o_endogenous_prior : ENDOGENOUS_PRIOR { driver.option_num("endogenous_prior", "1"); }
|
||||
o_use_univariate_filters_if_singularity_is_detected : USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED EQUAL INT_NUMBER { driver.option_num("use_univariate_filters_if_singularity_is_detected", $3); }
|
||||
|
||||
range : symbol ':' symbol
|
||||
{
|
||||
|
|
|
@ -239,6 +239,8 @@ string eofbuff;
|
|||
<DYNARE_STATEMENT>mode_file {return token::MODE_FILE;}
|
||||
<DYNARE_STATEMENT>mode_compute {return token::MODE_COMPUTE;}
|
||||
<DYNARE_STATEMENT>mode_check {return token::MODE_CHECK;}
|
||||
<DYNARE_STATEMENT>mode_check_neighbourhood_size {return token::MODE_CHECK_NEIGHBOURHOOD_SIZE;}
|
||||
<DYNARE_STATEMENT>mode_check_symmetric_plots {return token::MODE_CHECK_SYMMETRIC_PLOTS;}
|
||||
<DYNARE_STATEMENT>prior_trunc {return token::PRIOR_TRUNC;}
|
||||
<DYNARE_STATEMENT>mh_mode {return token::MH_MODE;}
|
||||
<DYNARE_STATEMENT>mh_nblocks {return token::MH_NBLOCKS;}
|
||||
|
@ -307,6 +309,7 @@ string eofbuff;
|
|||
<DYNARE_STATEMENT>square_root_solver {return token::SQUARE_ROOT_SOLVER;}
|
||||
<DYNARE_STATEMENT>cycle_reduction {return token::CYCLE_REDUCTION;}
|
||||
<DYNARE_STATEMENT>logarithmic_reduction {return token::LOGARITHMIC_REDUCTION;}
|
||||
<DYNARE_STATEMENT>use_univariate_filters_if_singularity_is_detected {return token::USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED;}
|
||||
<DYNARE_STATEMENT>default {return token::DEFAULT;}
|
||||
<DYNARE_STATEMENT>alpha {
|
||||
yylval->string_val = new string(yytext);
|
||||
|
@ -567,6 +570,7 @@ string eofbuff;
|
|||
<DYNARE_BLOCK>all_values_required {return token::ALL_VALUES_REQUIRED;}
|
||||
<DYNARE_BLOCK>no_static {return token::NO_STATIC;}
|
||||
<DYNARE_BLOCK>differentiate_forward_vars {return token::DIFFERENTIATE_FORWARD_VARS;}
|
||||
<DYNARE_BLOCK>parallel_local_files {return token::PARALLEL_LOCAL_FILES;}
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>linear {return token::LINEAR;}
|
||||
|
||||
|
|
32
ExprNode.cc
32
ExprNode.cc
|
@ -431,7 +431,7 @@ NumConstNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpN
|
|||
}
|
||||
|
||||
expr_t
|
||||
NumConstNode::differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
NumConstNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
{
|
||||
return const_cast<NumConstNode *>(this);
|
||||
}
|
||||
|
@ -1225,14 +1225,16 @@ VariableNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpN
|
|||
}
|
||||
|
||||
expr_t
|
||||
VariableNode::differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
VariableNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
{
|
||||
expr_t value;
|
||||
switch (type)
|
||||
{
|
||||
case eEndogenous:
|
||||
assert(lag <= 1);
|
||||
if (lag <= 0)
|
||||
if (lag <= 0
|
||||
|| (subset.size() > 0
|
||||
&& find(subset.begin(), subset.end(), datatree.symbol_table.getName(symb_id)) == subset.end()))
|
||||
return const_cast<VariableNode *>(this);
|
||||
else
|
||||
{
|
||||
|
@ -1255,7 +1257,7 @@ VariableNode::differentiateForwardVars(subst_table_t &subst_table, vector<Binary
|
|||
if (value->maxEndoLead() <= 0)
|
||||
return const_cast<VariableNode *>(this);
|
||||
else
|
||||
return value->differentiateForwardVars(subst_table, neweqs);
|
||||
return value->differentiateForwardVars(subset, subst_table, neweqs);
|
||||
default:
|
||||
return const_cast<VariableNode *>(this);
|
||||
}
|
||||
|
@ -2339,9 +2341,9 @@ UnaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNo
|
|||
}
|
||||
|
||||
expr_t
|
||||
UnaryOpNode::differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
UnaryOpNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
{
|
||||
expr_t argsubst = arg->differentiateForwardVars(subst_table, neweqs);
|
||||
expr_t argsubst = arg->differentiateForwardVars(subset, subst_table, neweqs);
|
||||
return buildSimilarUnaryOpNode(argsubst, datatree);
|
||||
}
|
||||
|
||||
|
@ -3583,10 +3585,10 @@ BinaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpN
|
|||
|
||||
|
||||
expr_t
|
||||
BinaryOpNode::differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
BinaryOpNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
{
|
||||
expr_t arg1subst = arg1->differentiateForwardVars(subst_table, neweqs);
|
||||
expr_t arg2subst = arg2->differentiateForwardVars(subst_table, neweqs);
|
||||
expr_t arg1subst = arg1->differentiateForwardVars(subset, subst_table, neweqs);
|
||||
expr_t arg2subst = arg2->differentiateForwardVars(subset, subst_table, neweqs);
|
||||
return buildSimilarBinaryOpNode(arg1subst, arg2subst, datatree);
|
||||
}
|
||||
|
||||
|
@ -4200,11 +4202,11 @@ TrinaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOp
|
|||
|
||||
|
||||
expr_t
|
||||
TrinaryOpNode::differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
TrinaryOpNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
{
|
||||
expr_t arg1subst = arg1->differentiateForwardVars(subst_table, neweqs);
|
||||
expr_t arg2subst = arg2->differentiateForwardVars(subst_table, neweqs);
|
||||
expr_t arg3subst = arg3->differentiateForwardVars(subst_table, neweqs);
|
||||
expr_t arg1subst = arg1->differentiateForwardVars(subset, subst_table, neweqs);
|
||||
expr_t arg2subst = arg2->differentiateForwardVars(subset, subst_table, neweqs);
|
||||
expr_t arg3subst = arg3->differentiateForwardVars(subset, subst_table, neweqs);
|
||||
return buildSimilarTrinaryOpNode(arg1subst, arg2subst, arg3subst, datatree);
|
||||
}
|
||||
|
||||
|
@ -4765,11 +4767,11 @@ ExternalFunctionNode::substituteExpectation(subst_table_t &subst_table, vector<B
|
|||
}
|
||||
|
||||
expr_t
|
||||
ExternalFunctionNode::differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
ExternalFunctionNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
|
||||
{
|
||||
vector<expr_t> arguments_subst;
|
||||
for (vector<expr_t>::const_iterator it = arguments.begin(); it != arguments.end(); it++)
|
||||
arguments_subst.push_back((*it)->differentiateForwardVars(subst_table, neweqs));
|
||||
arguments_subst.push_back((*it)->differentiateForwardVars(subset, subst_table, neweqs));
|
||||
return buildSimilarExternalFunctionNode(arguments_subst, datatree);
|
||||
}
|
||||
|
||||
|
|
16
ExprNode.hh
16
ExprNode.hh
|
@ -361,11 +361,13 @@ public:
|
|||
|
||||
//! Constructs a new expression where forward variables (supposed to be at most in t+1) have been replaced by themselves at t, plus a new aux var representing their (time) differentiate
|
||||
/*!
|
||||
\param[in] subset variables to which to limit the transformation; transform
|
||||
all fwrd vars if empty
|
||||
\param[in,out] subst_table Map used to store mapping between a given
|
||||
forward variable and the aux var that contains its differentiate
|
||||
\param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
|
||||
*/
|
||||
virtual expr_t differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0;
|
||||
virtual expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0;
|
||||
|
||||
//! Return true if the nodeID is a numerical constant equal to value and false otherwise
|
||||
/*!
|
||||
|
@ -452,7 +454,7 @@ public:
|
|||
virtual expr_t substituteExoLag(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const;
|
||||
virtual expr_t decreaseLeadsLagsPredeterminedVariables() const;
|
||||
virtual expr_t differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual bool isNumConstNodeEqualTo(double value) const;
|
||||
virtual bool containsEndogenous(void) const;
|
||||
virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const;
|
||||
|
@ -514,7 +516,7 @@ public:
|
|||
virtual expr_t substituteExoLag(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const;
|
||||
virtual expr_t decreaseLeadsLagsPredeterminedVariables() const;
|
||||
virtual expr_t differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual bool isNumConstNodeEqualTo(double value) const;
|
||||
virtual bool containsEndogenous(void) const;
|
||||
virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const;
|
||||
|
@ -591,7 +593,7 @@ public:
|
|||
virtual expr_t substituteExoLag(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const;
|
||||
virtual expr_t decreaseLeadsLagsPredeterminedVariables() const;
|
||||
virtual expr_t differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual bool isNumConstNodeEqualTo(double value) const;
|
||||
virtual bool containsEndogenous(void) const;
|
||||
virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const;
|
||||
|
@ -681,7 +683,7 @@ public:
|
|||
virtual expr_t substituteExoLag(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const;
|
||||
virtual expr_t decreaseLeadsLagsPredeterminedVariables() const;
|
||||
virtual expr_t differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual bool isNumConstNodeEqualTo(double value) const;
|
||||
virtual bool containsEndogenous(void) const;
|
||||
virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const;
|
||||
|
@ -751,7 +753,7 @@ public:
|
|||
virtual expr_t substituteExoLag(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const;
|
||||
virtual expr_t decreaseLeadsLagsPredeterminedVariables() const;
|
||||
virtual expr_t differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual bool isNumConstNodeEqualTo(double value) const;
|
||||
virtual bool containsEndogenous(void) const;
|
||||
virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const;
|
||||
|
@ -825,7 +827,7 @@ public:
|
|||
virtual expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const;
|
||||
virtual expr_t buildSimilarExternalFunctionNode(vector<expr_t> &alt_args, DataTree &alt_datatree) const;
|
||||
virtual expr_t decreaseLeadsLagsPredeterminedVariables() const;
|
||||
virtual expr_t differentiateForwardVars(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
|
||||
virtual bool isNumConstNodeEqualTo(double value) const;
|
||||
virtual bool containsEndogenous(void) const;
|
||||
virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const;
|
||||
|
|
30
ModFile.cc
30
ModFile.cc
|
@ -250,6 +250,19 @@ ModFile::checkPass()
|
|||
cerr << "ERROR: marking equations as [static] or [dynamic] is not possible with ramsey_policy or discretionary_policy" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (stochastic_statement_present &&
|
||||
(dynamic_model.isUnaryOpUsed(oSign)
|
||||
|| dynamic_model.isUnaryOpUsed(oAbs)
|
||||
|| dynamic_model.isBinaryOpUsed(oMax)
|
||||
|| dynamic_model.isBinaryOpUsed(oMin)
|
||||
|| dynamic_model.isBinaryOpUsed(oGreater)
|
||||
|| dynamic_model.isBinaryOpUsed(oLess)
|
||||
|| dynamic_model.isBinaryOpUsed(oGreaterEqual)
|
||||
|| dynamic_model.isBinaryOpUsed(oLessEqual)
|
||||
|| dynamic_model.isBinaryOpUsed(oEqualEqual)
|
||||
|| dynamic_model.isBinaryOpUsed(oDifferent)))
|
||||
warnings << "WARNING: you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which is unsuitable for a stochastic context; see the reference manual, section about \"Expressions\", for more details." << endl;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -309,7 +322,7 @@ ModFile::transformPass()
|
|||
}
|
||||
|
||||
if (differentiate_forward_vars)
|
||||
dynamic_model.differentiateForwardVars();
|
||||
dynamic_model.differentiateForwardVars(differentiate_forward_vars_subset);
|
||||
|
||||
if (mod_file_struct.dsge_var_estimated || !mod_file_struct.dsge_var_calibrated.empty())
|
||||
try
|
||||
|
@ -518,6 +531,21 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
|
|||
<< "options_.bytecode=" << byte_code << ";" << endl
|
||||
<< "options_.use_dll=" << use_dll << ";" << endl;
|
||||
|
||||
if (parallel_local_files.size() > 0)
|
||||
{
|
||||
mOutputFile << "options_.parallel_info.local_files = {" << endl;
|
||||
for (size_t i = 0; i < parallel_local_files.size(); i++)
|
||||
{
|
||||
size_t j = parallel_local_files[i].find_last_of("/\\");
|
||||
if (j == string::npos)
|
||||
mOutputFile << "'', '" << parallel_local_files[i] << "';" << endl;
|
||||
else
|
||||
mOutputFile << "'" << parallel_local_files[i].substr(0, j+1) << "', '"
|
||||
<< parallel_local_files[i].substr(j+1, string::npos) << "';" << endl;
|
||||
}
|
||||
mOutputFile << "};" << endl;
|
||||
}
|
||||
|
||||
config_file.writeCluster(mOutputFile);
|
||||
|
||||
if (byte_code)
|
||||
|
|
10
ModFile.hh
10
ModFile.hh
|
@ -78,6 +78,12 @@ public:
|
|||
//! Is the 'differentiate_forward_vars' option used?
|
||||
bool differentiate_forward_vars;
|
||||
|
||||
/*! If the 'differentiate_forward_vars' option is used, contains the set of
|
||||
endogenous with respect to which to do the transformation;
|
||||
if empty, means that the transformation must be applied to all endos
|
||||
with a lead */
|
||||
vector<string> differentiate_forward_vars_subset;
|
||||
|
||||
//! Are nonstationary variables present ?
|
||||
bool nonstationary_variables;
|
||||
|
||||
|
@ -88,6 +94,10 @@ public:
|
|||
//! Stores the original number of equations in the model_block
|
||||
int ramsey_policy_orig_eqn_nbr;
|
||||
|
||||
//! Stores the list of extra files to be transefered during a parallel run
|
||||
/*! (i.e. option parallel_local_files of model block) */
|
||||
vector<string> parallel_local_files;
|
||||
|
||||
private:
|
||||
//! List of statements
|
||||
vector<Statement *> statements;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2013 Dynare Team
|
||||
* Copyright (C) 2003-2012 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -245,9 +245,7 @@ EndValStatement::writeOutput(ostream &output, const string &basename) const
|
|||
<< "%" << endl;
|
||||
// Writing endval block to set terminal values for variables
|
||||
output << "ys0_= oo_.steady_state;" << endl
|
||||
<< "ex0_ = oo_.exo_steady_state;" << endl
|
||||
<< "oo_.steady_state = zeros(size(ys0_));" << endl
|
||||
<< "oo_.exo_steady_state = zeros(size(ex0_));" << endl;
|
||||
<< "ex0_ = oo_.exo_steady_state;" << endl;
|
||||
|
||||
writeInitValues(output);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,16 @@ ParsingDriver::parse(istream &in, bool debug)
|
|||
void
|
||||
ParsingDriver::error(const Dynare::parser::location_type &l, const string &m)
|
||||
{
|
||||
cerr << "ERROR: " << l << ": " << m << endl;
|
||||
cerr << "ERROR: " << *l.begin.filename << ": line " << l.begin.line;
|
||||
if (l.begin.line == l.end.line)
|
||||
if (l.begin.column == l.end.column - 1)
|
||||
cerr << ", col " << l.begin.column;
|
||||
else
|
||||
cerr << ", cols " << l.begin.column << "-" << l.end.column - 1;
|
||||
else
|
||||
cerr << ", col " << l.begin.column << " -"
|
||||
<< " line " << l.end.line << ", col " << l.end.column - 1;
|
||||
cerr << ": " << m << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -494,11 +503,26 @@ ParsingDriver::byte_code()
|
|||
}
|
||||
|
||||
void
|
||||
ParsingDriver::differentiate_forward_vars()
|
||||
ParsingDriver::differentiate_forward_vars_all()
|
||||
{
|
||||
mod_file->differentiate_forward_vars = true;
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::differentiate_forward_vars_some()
|
||||
{
|
||||
mod_file->differentiate_forward_vars = true;
|
||||
mod_file->differentiate_forward_vars_subset = symbol_list.get_symbols();
|
||||
for (vector<string>::const_iterator it = mod_file->differentiate_forward_vars_subset.begin();
|
||||
it != mod_file->differentiate_forward_vars_subset.end(); ++it)
|
||||
{
|
||||
check_symbol_existence(*it);
|
||||
if (mod_file->symbol_table.getType(*it) != eEndogenous)
|
||||
error("Symbol " + *it + " is not an endogenous");
|
||||
}
|
||||
symbol_list.clear();
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::cutoff(string *value)
|
||||
{
|
||||
|
@ -2526,3 +2550,11 @@ ParsingDriver::model_diagnostics()
|
|||
{
|
||||
mod_file->addStatement(new ModelDiagnosticsStatement());
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::add_parallel_local_file(string *filename)
|
||||
{
|
||||
mod_file->parallel_local_files.push_back(*filename);
|
||||
delete filename;
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ private:
|
|||
OptionsList options_list;
|
||||
//! Temporary storage for trend elements
|
||||
ObservationTrendsStatement::trend_elements_t trend_elements;
|
||||
//! Temporary storage for filename list of ModelComparison
|
||||
//! Temporary storage for filename list of ModelComparison (contains weights)
|
||||
ModelComparisonStatement::filename_list_t filename_list;
|
||||
//! Temporary storage for list of EstimationParams (from estimated_params* statements)
|
||||
vector<EstimationParams> estim_params_list;
|
||||
|
@ -245,8 +245,10 @@ public:
|
|||
void byte_code();
|
||||
//! the static model is not computed
|
||||
void no_static();
|
||||
//! the differentiate_forward_vars option is enabled
|
||||
void differentiate_forward_vars();
|
||||
//! the differentiate_forward_vars option is enabled (for all vars)
|
||||
void differentiate_forward_vars_all();
|
||||
//! the differentiate_forward_vars option is enabled (for a subset of vars)
|
||||
void differentiate_forward_vars_some();
|
||||
//! cutoff option of model block
|
||||
void cutoff(string *value);
|
||||
//! mfs option of model block
|
||||
|
@ -646,6 +648,8 @@ public:
|
|||
void process_graph_format_option();
|
||||
//! Model diagnostics
|
||||
void model_diagnostics();
|
||||
//! Processing the parallel_local_files option
|
||||
void add_parallel_local_file(string *filename);
|
||||
};
|
||||
|
||||
#endif // ! PARSING_DRIVER_HH
|
||||
|
|
Loading…
Reference in New Issue