Merge branch 'prepare-4.5'

issue#70
Stéphane Adjemian (Charybdis) 2017-05-19 16:33:12 +02:00
commit 2be5a18c8a
38 changed files with 1252 additions and 1183 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2007-2015 Dynare Team
* Copyright (C) 2007-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -2025,4 +2025,3 @@ public:
#endif
#pragma pack(pop)
#endif

View File

@ -202,9 +202,9 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
it = options_list.num_options.find("hp_filter");
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("bandpass.indicator");
OptionsList::num_options_t::const_iterator it2 = options_list.num_options.find("one_sided_hp_filter");
if ((it != options_list.num_options.end() && it1 != options_list.num_options.end()) ||
(it != options_list.num_options.end() && it2 != options_list.num_options.end()) ||
(it1 != options_list.num_options.end() && it2 != options_list.num_options.end()))
if ((it != options_list.num_options.end() && it1 != options_list.num_options.end())
|| (it != options_list.num_options.end() && it2 != options_list.num_options.end())
|| (it1 != options_list.num_options.end() && it2 != options_list.num_options.end()))
{
cerr << "ERROR: stoch_simul: can only use one of hp, one-sided hp, and bandpass filters"
<< endl;
@ -618,15 +618,15 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
exit(EXIT_FAILURE);
}
if (options_list.string_options.find("datafile") == options_list.string_options.end() &&
!mod_file_struct.estimation_data_statement_present)
if (options_list.string_options.find("datafile") == options_list.string_options.end()
&& !mod_file_struct.estimation_data_statement_present)
{
cerr << "ERROR: The estimation statement requires a data file to be supplied via the datafile option." << endl;
exit(EXIT_FAILURE);
}
if (options_list.string_options.find("mode_file") != options_list.string_options.end() &&
mod_file_struct.estim_params_use_calib)
if (options_list.string_options.find("mode_file") != options_list.string_options.end()
&& mod_file_struct.estim_params_use_calib)
{
cerr << "ERROR: The mode_file option of the estimation statement is incompatible with the use_calibration option of the estimated_params_init block." << endl;
exit(EXIT_FAILURE);
@ -1369,8 +1369,8 @@ MSSBVAREstimationStatement::checkPass(ModFileStructure &mod_file_struct, Warning
mod_file_struct.bvar_present = true;
if (options_list.num_options.find("ms.create_init") == options_list.num_options.end())
if (options_list.string_options.find("datafile") == options_list.string_options.end() ||
options_list.num_options.find("ms.initial_year") == options_list.num_options.end())
if (options_list.string_options.find("datafile") == options_list.string_options.end()
|| options_list.num_options.find("ms.initial_year") == options_list.num_options.end())
{
cerr << "ERROR: If you do not pass no_create_init to ms_estimation, "
<< "you must pass the datafile and initial_year options." << endl;
@ -1489,9 +1489,9 @@ MSSBVARIrfStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
if (it != options_list.num_options.end())
filtered_probabilities_present = true;
if ((filtered_probabilities_present && regime_present) ||
(filtered_probabilities_present && regimes_present) ||
(regimes_present && regime_present))
if ((filtered_probabilities_present && regime_present)
|| (filtered_probabilities_present && regimes_present)
|| (regimes_present && regime_present))
{
cerr << "ERROR: You may only pass one of regime, regimes and "
<< "filtered_probabilities to ms_irf" << endl;
@ -1560,9 +1560,9 @@ MSSBVARVarianceDecompositionStatement::checkPass(ModFileStructure &mod_file_stru
if (it != options_list.num_options.end())
filtered_probabilities_present = true;
if ((filtered_probabilities_present && regime_present) ||
(filtered_probabilities_present && regimes_present) ||
(regimes_present && regime_present))
if ((filtered_probabilities_present && regime_present)
|| (filtered_probabilities_present && regimes_present)
|| (regimes_present && regime_present))
{
cerr << "ERROR: You may only pass one of regime, regimes and "
<< "filtered_probabilities to ms_variance_decomposition" << endl;
@ -1858,8 +1858,8 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(const OptionsList &options_li
if (it_num != options_list.num_options.end())
{
using namespace boost;
OptionsList::num_options_t::const_iterator it_num_regimes =
options_list.num_options.find("ms.number_of_regimes");
OptionsList::num_options_t::const_iterator it_num_regimes
= options_list.num_options.find("ms.number_of_regimes");
assert(it_num_regimes != options_list.num_options.end());
int num_regimes = lexical_cast< int >(it_num_regimes->second);
@ -1941,8 +1941,8 @@ MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo
if (it_num != options_list.num_options.end())
{
using namespace boost;
OptionsList::num_options_t::const_iterator it_num_regimes =
options_list.num_options.find("ms.number_of_regimes");
OptionsList::num_options_t::const_iterator it_num_regimes
= options_list.num_options.find("ms.number_of_regimes");
assert(it_num_regimes != options_list.num_options.end());
int num_regimes = lexical_cast< int >(it_num_regimes->second);
vector<double> col_trans_prob_sum(num_regimes, 0);
@ -2044,8 +2044,8 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
{
output << endl;
OptionsList::num_options_t::const_iterator it =
options_list.num_options.find("ms.chain");
OptionsList::num_options_t::const_iterator it
= options_list.num_options.find("ms.chain");
assert(it != options_list.num_options.end());
output << "chain = " << it->second << ";" << endl;
@ -2071,8 +2071,8 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
if (!itvs->empty())
output << "duration.push_back(" << *itvs << ");" << endl;
OptionsList::symbol_list_options_t::const_iterator itsl =
options_list.symbol_list_options.find("ms.parameters");
OptionsList::symbol_list_options_t::const_iterator itsl
= options_list.symbol_list_options.find("ms.parameters");
assert(itsl != options_list.symbol_list_options.end());
vector<string> parameters = itsl->second.get_symbols();
output << "parameters.clear();" << endl;
@ -2104,11 +2104,11 @@ SvarStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation
it2 = options_list.string_options.find("ms.constants");
assert((it0 != options_list.string_options.end()
&& it1 == options_list.string_options.end()
&& it2 == options_list.string_options.end()) ||
(it0 == options_list.string_options.end()
&& it2 == options_list.string_options.end())
|| (it0 == options_list.string_options.end()
&& it1 != options_list.string_options.end()
&& it2 == options_list.string_options.end()) ||
(it0 == options_list.string_options.end()
&& it2 == options_list.string_options.end())
|| (it0 == options_list.string_options.end()
&& it1 == options_list.string_options.end()
&& it2 != options_list.string_options.end()));
}
@ -2193,15 +2193,15 @@ EstimationDataStatement::checkPass(ModFileStructure &mod_file_struct, WarningCon
exit(EXIT_FAILURE);
}
if ((options_list.string_options.find("file") == options_list.string_options.end()) &&
(options_list.string_options.find("series") == options_list.string_options.end()))
if ((options_list.string_options.find("file") == options_list.string_options.end())
&& (options_list.string_options.find("series") == options_list.string_options.end()))
{
cerr << "ERROR: The file or series option must be passed to the data statement." << endl;
exit(EXIT_FAILURE);
}
if ((options_list.string_options.find("file") != options_list.string_options.end()) &&
(options_list.string_options.find("series") != options_list.string_options.end()))
if ((options_list.string_options.find("file") != options_list.string_options.end())
&& (options_list.string_options.find("series") != options_list.string_options.end()))
{
cerr << "ERROR: The file and series options cannot be used simultaneously in the data statement." << endl;
exit(EXIT_FAILURE);
@ -2373,8 +2373,8 @@ JointPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
exit(EXIT_FAILURE);
}
if (options_list.num_options.find("mean") == options_list.num_options.end() &&
options_list.num_options.find("mode") == options_list.num_options.end())
if (options_list.num_options.find("mean") == options_list.num_options.end()
&& options_list.num_options.find("mode") == options_list.num_options.end())
{
cerr << "ERROR: You must pass at least one of mean and mode to the prior statement." << endl;
exit(EXIT_FAILURE);
@ -2455,7 +2455,6 @@ JointPriorStatement::writeOutputHelper(ostream &output, const string &field, con
output << "};" << endl;
}
BasicPriorStatement::~BasicPriorStatement()
{
}
@ -2482,16 +2481,16 @@ BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
exit(EXIT_FAILURE);
}
if (options_list.num_options.find("mean") == options_list.num_options.end() &&
options_list.num_options.find("mode") == options_list.num_options.end())
if (options_list.num_options.find("mean") == options_list.num_options.end()
&& options_list.num_options.find("mode") == options_list.num_options.end())
{
cerr << "ERROR: You must pass at least one of mean and mode to the prior statement." << endl;
exit(EXIT_FAILURE);
}
OptionsList::num_options_t::const_iterator it_stdev = options_list.num_options.find("stdev");
if ((it_stdev == options_list.num_options.end() && variance == NULL) ||
(it_stdev != options_list.num_options.end() && variance != NULL))
if ((it_stdev == options_list.num_options.end() && variance == NULL)
|| (it_stdev != options_list.num_options.end() && variance != NULL))
{
cerr << "ERROR: You must pass exactly one of stdev and variance to the prior statement." << endl;
exit(EXIT_FAILURE);
@ -2829,8 +2828,8 @@ PriorEqualStatement::PriorEqualStatement(const string &to_declaration_type_arg,
void
PriorEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{
if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr") ||
(from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr"))
if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr")
|| (from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr"))
{
cerr << "Internal Dynare Error" << endl;
exit(EXIT_FAILURE);
@ -2861,7 +2860,6 @@ PriorEqualStatement::writeOutput(ostream &output, const string &basename, bool m
else
get_base_name(symbol_table.getType(from_name1), rhs_field);
if (to_declaration_type == "corr")
lhs_field += "_corr";
@ -3141,8 +3139,8 @@ OptionsEqualStatement::OptionsEqualStatement(const string &to_declaration_type_a
void
OptionsEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{
if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr") ||
(from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr"))
if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr")
|| (from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr"))
{
cerr << "Internal Dynare Error" << endl;
exit(EXIT_FAILURE);
@ -3173,7 +3171,6 @@ OptionsEqualStatement::writeOutput(ostream &output, const string &basename, bool
else
get_base_name(symbol_table.getType(from_name1), rhs_field);
if (to_declaration_type == "corr")
lhs_field += "_corr";

View File

@ -136,7 +136,8 @@ public:
class RamseyConstraintsStatement : public Statement
{
public:
struct Constraint {
struct Constraint
{
int endo;
BinaryOpcode code;
expr_t expression;
@ -423,7 +424,8 @@ public:
/*! \param model_tree_arg the model tree used to store the objective function.
It is owned by the PlannerObjectiveStatement, and will be deleted by its destructor */
PlannerObjectiveStatement(StaticModel *model_tree_arg);
virtual ~PlannerObjectiveStatement();
virtual
~PlannerObjectiveStatement();
/*! \todo check there are only endogenous variables at the current period in the objective
(no exogenous, no lead/lag) */
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
@ -792,11 +794,11 @@ public:
void writeOutputHelper(ostream &output, const string &field, const string &lhs_field) const;
};
class BasicPriorStatement : public Statement
{
public:
virtual ~BasicPriorStatement();
virtual
~BasicPriorStatement();
protected:
const string name;
const string subsample_name;
@ -899,7 +901,8 @@ public:
class BasicOptionsStatement : public Statement
{
public:
virtual ~BasicOptionsStatement();
virtual
~BasicOptionsStatement();
protected:
const string name;
const string subsample_name;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2016 Dynare Team
* Copyright (C) 2010-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -158,7 +158,6 @@ ConfigFile::getConfigFileInfo(const string &config_file)
}
}
string name, computerName, port, userName, password, remoteDrive,
remoteDirectory, dynarePath, matlabOctavePath, operatingSystem,
global_init_file;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2016 Dynare Team
* Copyright (C) 2010-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -37,7 +37,11 @@ public:
private:
map<string, string> hooks;
public:
inline map<string, string>get_hooks() { return hooks; };
inline map<string, string>
get_hooks()
{
return hooks;
};
};
class Path
@ -48,7 +52,11 @@ public:
private:
map<string, vector<string> > paths;
public:
inline map<string, vector<string> >get_paths() { return paths; };
inline map<string, vector<string> >
get_paths()
{
return paths;
};
};
class SlaveNode

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -104,7 +104,8 @@ private:
public:
DataTree(SymbolTable &symbol_table_arg, NumericalConstants &num_constants_arg, ExternalFunctionsTable &external_functions_table_arg);
virtual ~DataTree();
virtual
~DataTree();
//! Some predefined constants
expr_t Zero, One, Two, MinusOne, NaN, Infinity, MinusInfinity, Pi;

View File

@ -2987,7 +2987,6 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
row_state_var_incidence.insert(make_pair(it_state_equ - state_equ.begin(), it_state_var - state_var.begin()));
}
}
/*tmp_block_endo_derivative[make_pair(it->second.first, make_pair(it->first.second, it->first.first))] = it->second.second;
if (block == 0)
@ -3047,7 +3046,6 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
output << modstruct << "n_diag = " << nb_diag << ";" << endl;
KF_index_file.write(reinterpret_cast<char *>(&nb_diag), sizeof(nb_diag));
typedef pair<int, pair<int, int > > index_KF;
vector<index_KF> v_index_KF;
for (int i = 0; i < n; i++)
@ -4483,7 +4481,6 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
equations[i] = substeq;
}
// Substitute in aux_equations
// Without this loop, the auxiliary equations in equations
// will diverge from those in aux_equations
@ -5095,7 +5092,6 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons
// this is always empty here, but needed by d1->writeOutput
deriv_node_temp_terms_t tef_terms;
// Indexing derivatives in column order
vector<derivative> D;
for (first_derivatives_t::const_iterator it = first_derivatives.begin();

View File

@ -532,13 +532,16 @@ public:
unsigned int row_nbr;
expr_t value;
derivative(long unsigned int arg1, long unsigned int arg2, int arg3, expr_t arg4) :
linear_address(arg1), col_nbr(arg2), row_nbr(arg3), value(arg4) {};
linear_address(arg1), col_nbr(arg2), row_nbr(arg3), value(arg4)
{
};
};
class derivative_less_than
{
public:
bool operator()(const derivative & d1, const derivative & d2) const
bool
operator()(const derivative &d1, const derivative &d2) const
{
return d1.linear_address < d2.linear_address;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -124,8 +124,8 @@ main(int argc, char **argv)
clear_all = false;
else if (strlen(argv[arg]) >= 19 && !strncmp(argv[arg], "params_derivs_order", 19))
{
if (strlen(argv[arg]) >= 22 || argv[arg][19] != '=' ||
!(argv[arg][20] == '0' || argv[arg][20] == '1' || argv[arg][20] == '2'))
if (strlen(argv[arg]) >= 22 || argv[arg][19] != '='
|| !(argv[arg][20] == '0' || argv[arg][20] == '1' || argv[arg][20] == '2'))
{
cerr << "Incorrect syntax for params_derivs_order option" << endl;
usage();

View File

@ -514,7 +514,6 @@ NumConstNode::substituteStaticAuxiliaryVariable() const
return const_cast<NumConstNode *>(this);
}
VariableNode::VariableNode(DataTree &datatree_arg, int symb_id_arg, int lag_arg) :
ExprNode(datatree_arg),
symb_id(symb_id_arg),
@ -3807,7 +3806,6 @@ BinaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpN
return buildSimilarBinaryOpNode(arg1subst, arg2subst, datatree);
}
expr_t
BinaryOpNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
{
@ -4483,7 +4481,6 @@ TrinaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOp
return buildSimilarTrinaryOpNode(arg1subst, arg2subst, arg3subst, datatree);
}
expr_t
TrinaryOpNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
{

View File

@ -173,7 +173,8 @@ protected:
public:
ExprNode(DataTree &datatree_arg);
virtual ~ExprNode();
virtual
~ExprNode();
//! Initializes data member non_null_derivatives
virtual void prepareForDerivation() = 0;
@ -550,7 +551,11 @@ public:
{
return symb_id;
};
int get_lag() const { return lag; };
int
get_lag() const
{
return lag;
};
virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const;
virtual expr_t getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recursive_variables);
virtual int maxEndoLead() const;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2014-2015 Dynare Team
* Copyright (C) 2014-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2011 Dynare Team
* Copyright (C) 2010-2015 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2011 Dynare Team
* Copyright (C) 2010-2015 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2012 Dynare Team
* Copyright (C) 2009-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -257,15 +257,15 @@ ModFile::checkPass(bool nostrict)
exit(EXIT_FAILURE);
}
if (dynamic_model.staticOnlyEquationsNbr() > 0 &&
(mod_file_struct.ramsey_model_present || mod_file_struct.discretionary_policy_present))
if (dynamic_model.staticOnlyEquationsNbr() > 0
&& (mod_file_struct.ramsey_model_present || mod_file_struct.discretionary_policy_present))
{
cerr << "ERROR: marking equations as [static] or [dynamic] is not possible with ramsey_model, ramsey_policy or discretionary_policy" << endl;
exit(EXIT_FAILURE);
}
if (stochastic_statement_present &&
(dynamic_model.isUnaryOpUsed(oSign)
if (stochastic_statement_present
&& (dynamic_model.isUnaryOpUsed(oSign)
|| dynamic_model.isUnaryOpUsed(oAbs)
|| dynamic_model.isBinaryOpUsed(oMax)
|| dynamic_model.isBinaryOpUsed(oMin)
@ -277,8 +277,8 @@ ModFile::checkPass(bool nostrict)
|| 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;
if (linear &&
(dynamic_model.isUnaryOpUsed(oSign)
if (linear
&& (dynamic_model.isUnaryOpUsed(oSign)
|| dynamic_model.isUnaryOpUsed(oAbs)
|| dynamic_model.isBinaryOpUsed(oMax)
|| dynamic_model.isBinaryOpUsed(oMin)
@ -566,8 +566,8 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_deri
else // No computing task requested, compute derivatives up to 2nd order by default
dynamic_model.computingPass(true, true, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
if ((linear && !mod_file_struct.ramsey_model_present && !dynamic_model.checkHessianZero()) ||
(linear && mod_file_struct.ramsey_model_present && !orig_ramsey_dynamic_model.checkHessianZero()))
if ((linear && !mod_file_struct.ramsey_model_present && !dynamic_model.checkHessianZero())
|| (linear && mod_file_struct.ramsey_model_present && !orig_ramsey_dynamic_model.checkHessianZero()))
{
map<int, string> eqs;
if (mod_file_struct.ramsey_model_present)
@ -880,7 +880,6 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
<< "end" << endl;
}
if (!no_log)
mOutputFile << "diary off" << endl;
@ -939,7 +938,6 @@ ModFile::writeExternalFilesC(const string &basename, FileOutputType output) cons
if (!no_static)
static_model.writeStaticFile(basename, false, false, true, false);
// static_model.writeStaticCFile(basename, block, byte_code, use_dll);
// static_model.writeParamsDerivativesFileC(basename, cuda);
// static_model.writeAuxVarInitvalC(mOutputFile, oMatlabOutsideModel, cuda);

View File

@ -1839,9 +1839,9 @@ ModelTree::computeParamsDerivativesTemporaryTerms()
params_derivs_temporary_terms_g2 = temp_terms_map[eHessianParamsDeriv];
}
bool ModelTree::isNonstationary(int symb_id) const
bool
ModelTree::isNonstationary(int symb_id) const
{
return (nonstationary_symbols_map.find(symb_id)
!= nonstationary_symbols_map.end());
}

View File

@ -128,7 +128,6 @@ protected:
*/
third_derivatives_t hessian_params_derivatives;
//! Temporary terms for the static/dynamic file (those which will be noted Txxxx)
temporary_terms_t temporary_terms;
temporary_terms_t temporary_terms_res;
@ -144,7 +143,6 @@ protected:
temporary_terms_t params_derivs_temporary_terms_g12;
temporary_terms_t params_derivs_temporary_terms_g2;
//! Trend variables and their growth factors
map<int, expr_t> trend_symbols_map;
@ -268,7 +266,8 @@ protected:
virtual unsigned int getBlockMaxLag(int block_number) const = 0;
//! Return the maximum lead in a block
virtual unsigned int getBlockMaxLead(int block_number) const = 0;
inline void setBlockLeadLag(int block, int max_lag, int max_lead)
inline void
setBlockLeadLag(int block, int max_lag, int max_lead)
{
block_lag_lead[block] = make_pair(max_lag, max_lead);
};

View File

@ -259,8 +259,8 @@ void
ParsingDriver::declare_statement_local_variable(string *name)
{
if (mod_file->symbol_table.exists(*name))
error("Symbol " + *name + " cannot be assigned within a statement " +
"while being assigned elsewhere in the modfile");
error("Symbol " + *name + " cannot be assigned within a statement "
+"while being assigned elsewhere in the modfile");
declare_symbol(name, eStatementDeclaredVariable, NULL, NULL);
delete name;
}
@ -1426,8 +1426,8 @@ ParsingDriver::copy_subsamples(string *to_name1, string *to_name2, string *from_
mod_file->addStatement(new SubsamplesEqualStatement(*to_name1, *to_name2, *from_name1, *from_name2,
mod_file->symbol_table));
subsample_declarations[make_pair(*to_name1, *to_name2)] =
subsample_declarations[make_pair(*from_name1, *from_name2)];
subsample_declarations[make_pair(*to_name1, *to_name2)]
= subsample_declarations[make_pair(*from_name1, *from_name2)];
delete to_name1;
delete to_name2;
@ -1494,7 +1494,6 @@ ParsingDriver::check_subsample_declaration_exists(string *name1, string *name2,
error("The subsample name " + *subsample_name + " was not previously declared in a subsample statement.");
}
void
ParsingDriver::set_prior(string *name, string *subsample_name)
{
@ -2881,7 +2880,8 @@ ParsingDriver::add_moment_calibration_item(string *endo1, string *endo2, string
moment_calibration_constraints.push_back(c);
}
void ParsingDriver::end_moment_calibration()
void
ParsingDriver::end_moment_calibration()
{
mod_file->addStatement(new MomentCalibration(moment_calibration_constraints,
mod_file->symbol_table));
@ -2918,7 +2918,8 @@ ParsingDriver::add_irf_calibration_item(string *endo, string *periods, string *e
irf_calibration_constraints.push_back(c);
}
void ParsingDriver::end_irf_calibration()
void
ParsingDriver::end_irf_calibration()
{
mod_file->addStatement(new IrfCalibration(irf_calibration_constraints,
mod_file->symbol_table,
@ -2940,7 +2941,6 @@ ParsingDriver::histval_file(string *filename)
delete filename;
}
void
ParsingDriver::perfect_foresight_setup()
{
@ -3027,7 +3027,6 @@ ParsingDriver::add_shock_group_element(string *name)
delete name;
}
void
ParsingDriver::add_shock_group(string *name)
{

View File

@ -239,7 +239,9 @@ private:
ostringstream model_errors;
public:
ParsingDriver(WarningConsolidation &warnings_arg, bool nostrict_arg) : warnings(warnings_arg), nostrict(nostrict_arg), model_error_encountered(false) { };
ParsingDriver(WarningConsolidation &warnings_arg, bool nostrict_arg) : warnings(warnings_arg), nostrict(nostrict_arg), model_error_encountered(false)
{
};
//! Starts parsing, and constructs the MOD file representation
/*! The returned pointer should be deleted after use */

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -77,7 +77,8 @@ Statement::writeCOutput(ostream &output, const string &basename)
{
}
void Statement::writeJuliaOutput(ostream &output, const string &basename)
void
Statement::writeJuliaOutput(ostream &output, const string &basename)
{
}

View File

@ -125,7 +125,8 @@ public:
class Statement
{
public:
virtual ~Statement();
virtual
~Statement();
//! Do some internal check, and fill the ModFileStructure class
/*! Don't forget to update ComputingTasks.hh, Shocks.hh and
NumericalInitialization.hh if you modify the signature of this

View File

@ -1338,7 +1338,6 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
int id2 = getSymbIDByDerivID(var2);
int id3 = getSymbIDByDerivID(var3);
// Reference column number for the g3 matrix
int ref_col = id1 * hessianColsNbr + id2 * JacobianColsNbr + id3;
@ -1622,7 +1621,6 @@ StaticModel::writeStaticCFile(const string &func_name) const
output << "#define max(a, b) (((a) > (b)) ? (a) : (b))" << endl
<< "#define min(a, b) (((a) > (b)) ? (b) : (a))" << endl;
// Write function definition if oPowerDeriv is used
writePowerDerivCHeader(output);
writeNormcdfCHeader(output);
@ -2129,7 +2127,8 @@ StaticModel::writeAuxVarInitval(ostream &output, ExprNodeOutputType output_type)
}
}
void StaticModel::writeSetAuxiliaryVariables(const string &basename, const bool julia) const
void
StaticModel::writeSetAuxiliaryVariables(const string &basename, const bool julia) const
{
string func_name = basename + "_set_auxiliary_variables";
@ -2311,7 +2310,6 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
third_derivs1_output << ";" << endl;
}
ofstream paramsDerivsFile;
string filename = julia ? basename + "StaticParamsDerivs.jl" : basename + "_static_params_derivs.m";
paramsDerivsFile.open(filename.c_str(), ios::out | ios::binary);

View File

@ -215,12 +215,14 @@ public:
return (block_type_firstequation_size_mfs[block_number].second.first);
};
//! Return the number of exogenous variable in the block block_number
virtual unsigned int getBlockExoSize(int block_number) const
virtual unsigned int
getBlockExoSize(int block_number) const
{
return 0;
};
//! Return the number of colums in the jacobian matrix for exogenous variable in the block block_number
virtual unsigned int getBlockExoColSize(int block_number) const
virtual unsigned int
getBlockExoColSize(int block_number) const
{
return 0;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2016 Dynare Team
* Copyright (C) 2010-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2011 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -42,9 +42,17 @@ public:
//! Clears all content
void clear();
//! Get a copy of the string vector
vector<string> get_symbols() const { return symbols; };
vector<string>
get_symbols() const
{
return symbols;
};
//! Is Empty
int empty() const { return symbols.empty(); };
int
empty() const
{
return symbols.empty();
};
};
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -216,7 +216,6 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
<< "M_.exo_names_tex = char(M_.exo_names_tex, '" << getTeXName(exo_ids[id]) << "');" << endl
<< "M_.exo_names_long = char(M_.exo_names_long, '" << getLongName(exo_ids[id]) << "');" << endl;
map<string, map<int, string> > partitions = getPartitionsForType(eExogenous);
for (map<string, map<int, string> >::const_iterator it = partitions.begin();
it != partitions.end(); it++)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -58,13 +58,41 @@ private:
expr_t expr_node; //! Auxiliary variable definition
public:
AuxVarInfo(int symb_id_arg, aux_var_t type_arg, int orig_symb_id, int orig_lead_lag, int equation_number_for_multiplier_arg, int information_set_arg, expr_t expr_node_arg);
int get_symb_id() const { return symb_id; };
aux_var_t get_type() const { return type; };
int get_orig_symb_id() const { return orig_symb_id; };
int get_orig_lead_lag() const { return orig_lead_lag; };
int get_equation_number_for_multiplier() const { return equation_number_for_multiplier; };
int get_information_set() const { return information_set; };
expr_t get_expr_node() const { return expr_node; } ;
int
get_symb_id() const
{
return symb_id;
};
aux_var_t
get_type() const
{
return type;
};
int
get_orig_symb_id() const
{
return orig_symb_id;
};
int
get_orig_lead_lag() const
{
return orig_lead_lag;
};
int
get_equation_number_for_multiplier() const
{
return equation_number_for_multiplier;
};
int
get_information_set() const
{
return information_set;
};
expr_t
get_expr_node() const
{
return expr_node;
};
};
//! Stores the symbol table
@ -249,7 +277,11 @@ public:
*/
int searchAuxiliaryVars(int orig_symb_id, int orig_lead_lag) const throw (SearchFailedException);
//! Returns the number of auxiliary variables
int AuxVarsSize() const { return aux_vars.size(); };
int
AuxVarsSize() const
{
return aux_vars.size();
};
//! Retruns expr_node for an auxiliary variable
expr_t getAuxiliaryVarsExprNode(int symb_id) const throw (SearchFailedException);
//! Tests if symbol already exists

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2013 Dynare Team
* Copyright (C) 2012-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -20,7 +20,8 @@
#include "WarningConsolidation.hh"
#include <ostream>
WarningConsolidation&
WarningConsolidation
&
operator<<(WarningConsolidation &wcc, const string &warning)
{
if (wcc.no_warn)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2013 Dynare Team
* Copyright (C) 2012-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -34,16 +34,28 @@ private:
bool no_warn;
public:
WarningConsolidation(bool no_warn_arg) : no_warn(no_warn_arg) { };
~WarningConsolidation() { };
WarningConsolidation(bool no_warn_arg) : no_warn(no_warn_arg)
{
};
~WarningConsolidation()
{
};
//! Add A Warning to the StringStream
friend WarningConsolidation &operator<<(WarningConsolidation &wcc, const string &warning);
friend WarningConsolidation &operator<<(WarningConsolidation &wcc, const Dynare::location &loc);
friend WarningConsolidation &operator<<(WarningConsolidation &wcc, ostream & (*pf)(ostream &));
inline void addWarning(const string &w) { warnings << w; };
inline void addWarning(ostream& (*pf) (ostream&)) { warnings << pf; };
inline void
addWarning(const string &w)
{
warnings << w;
};
inline void
addWarning(ostream & (*pf)(ostream &))
{
warnings << pf;
};
//! Write Warnings to m file
void writeOutput(ostream &output) const;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2015 Dynare Team
* Copyright (C) 2008-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2015 Dynare Team
* Copyright (C) 2008-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -177,7 +177,8 @@ public:
//! Constructor
MacroDriver();
//! Destructor
virtual ~MacroDriver();
virtual
~MacroDriver();
//! Starts parsing a file, returns output in out
/*! \param no_line_macro should we omit the @#line statements ? */

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2013 Dynare Team
* Copyright (C) 2008-2014 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2016 Dynare Team
* Copyright (C) 2008-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -49,7 +49,8 @@ public:
{
};
MacroValue(MacroDriver &driver_arg);
virtual ~MacroValue();
virtual
~MacroValue();
//! Applies + operator
virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError) = 0;
//! Applies unary + operator
@ -118,7 +119,8 @@ private:
const int value;
public:
IntMV(MacroDriver &driver, int value_arg);
virtual ~IntMV();
virtual
~IntMV();
//! Computes arithmetic addition
virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError);
//! Unary plus
@ -158,7 +160,11 @@ public:
If mv2 < mv1, returns an empty range (for consistency with MATLAB).
*/
static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError);
inline int get_int_value() const { return value; };
inline int
get_int_value() const
{
return value;
};
};
//! Represents a string value in macro language
@ -170,7 +176,8 @@ private:
const string value;
public:
StringMV(MacroDriver &driver, const string &value_arg);
virtual ~StringMV();
virtual
~StringMV();
//! Computes string concatenation
virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError);
virtual const MacroValue *operator==(const MacroValue &mv) const throw (TypeError);
@ -202,7 +209,8 @@ private:
const vector<T> values;
public:
ArrayMV(MacroDriver &driver, const vector<T> &values_arg);
virtual ~ArrayMV();
virtual
~ArrayMV();
//! Computes array concatenation
/*! Both array must be of same type */
virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError);