Port to C++11 auto keyword
Performed using modernize-use-auto from clang-tidy. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.htmlissue#70
parent
dcfc598196
commit
c0ed97d247
|
@ -221,7 +221,7 @@ PriorPosteriorFunctionStatement::PriorPosteriorFunctionStatement(const bool prio
|
|||
void
|
||||
PriorPosteriorFunctionStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||
{
|
||||
OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("function");
|
||||
auto it2 = options_list.string_options.find("function");
|
||||
if (it2 == options_list.string_options.end() || it2->second.empty())
|
||||
{
|
||||
cerr << "ERROR: both the prior_function and posterior_function commands require the 'function' argument"
|
||||
|
@ -316,7 +316,7 @@ PacModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
}
|
||||
|
||||
output << "M_.pac." << name << ".lhs = [";
|
||||
for (vector<int>::const_iterator it = lhs.begin(); it !=lhs.end(); it++)
|
||||
for (auto it = lhs.begin(); it !=lhs.end(); it++)
|
||||
{
|
||||
if (it != lhs.begin())
|
||||
output << " ";
|
||||
|
@ -324,7 +324,7 @@ PacModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "M_.pac." << name << ".undiff_eqtags = {";
|
||||
for (map<string, int>::const_iterator it = undiff.begin(); it != undiff.end(); it++)
|
||||
for (auto it = undiff.begin(); it != undiff.end(); it++)
|
||||
{
|
||||
if (it != undiff.begin())
|
||||
output << "; ";
|
||||
|
@ -332,7 +332,7 @@ PacModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
}
|
||||
output << "};" << endl
|
||||
<< "M_.pac." << name << ".undiff_num = [";
|
||||
for (map<string, int>::const_iterator it = undiff.begin(); it != undiff.end(); it++)
|
||||
for (auto it = undiff.begin(); it != undiff.end(); it++)
|
||||
{
|
||||
if (it != undiff.begin())
|
||||
output << " ";
|
||||
|
@ -401,12 +401,12 @@ VarModelStatement::getVarModelInfo(string &var_model_name,
|
|||
var_model_name = name;
|
||||
if (symbol_list.empty())
|
||||
{
|
||||
OptionsList::vec_str_options_t::const_iterator it = options_list.vector_str_options.find("var.eqtags");
|
||||
auto it = options_list.vector_str_options.find("var.eqtags");
|
||||
var_model_eqtags[name] = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("var.order");
|
||||
auto it = options_list.num_options.find("var.order");
|
||||
var_model_info[name] = make_pair(symbol_list, atoi(it->second.c_str()));
|
||||
}
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
symbol_list.writeOutput("options_.var.var_list_", output);
|
||||
|
||||
output << "options_.var.eqn = [";
|
||||
for (vector<int>::const_iterator it = eqnumber.begin();
|
||||
for (auto it = eqnumber.begin();
|
||||
it != eqnumber.end(); it++)
|
||||
{
|
||||
if (it != eqnumber.begin())
|
||||
|
@ -450,7 +450,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "options_.var.lhs = [";
|
||||
for (vector<int>::const_iterator it = lhs.begin();
|
||||
for (auto it = lhs.begin();
|
||||
it != lhs.end(); it++)
|
||||
{
|
||||
if (it != lhs.begin())
|
||||
|
@ -460,7 +460,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
output << "];" << endl
|
||||
<< "options_.var.max_lag = " << max_lag << ";" << endl
|
||||
<< "options_.var.nonstationary = [";
|
||||
for (vector<bool>::const_iterator it = nonstationary.begin();
|
||||
for (auto it = nonstationary.begin();
|
||||
it != nonstationary.end(); it++)
|
||||
{
|
||||
if (it != nonstationary.begin())
|
||||
|
@ -472,7 +472,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "options_.var.diff = [";
|
||||
for (vector<bool>::const_iterator it = diff.begin();
|
||||
for (auto it = diff.begin();
|
||||
it != diff.end(); it++)
|
||||
{
|
||||
if (it != diff.begin())
|
||||
|
@ -484,7 +484,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "options_.var.orig_diff_var = [";
|
||||
for (vector<int>::const_iterator it = orig_diff_var.begin();
|
||||
for (auto it = orig_diff_var.begin();
|
||||
it != orig_diff_var.end(); it++)
|
||||
{
|
||||
if (it != orig_diff_var.begin())
|
||||
|
@ -496,11 +496,11 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
}
|
||||
output << "];" << endl;
|
||||
int i = 1;
|
||||
for (vector<set<pair<int, int > > >::const_iterator it = rhs_by_eq.begin();
|
||||
for (auto it = rhs_by_eq.begin();
|
||||
it != rhs_by_eq.end(); it++, i++)
|
||||
{
|
||||
output << "options_.var.rhs.vars_at_eq{" << i << "}.var = [";
|
||||
for (set<pair<int, int> >::const_iterator it1 = it->begin();
|
||||
for (auto it1 = it->begin();
|
||||
it1 != it->end(); it1++)
|
||||
{
|
||||
if (it1 != it->begin())
|
||||
|
@ -509,7 +509,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "options_.var.rhs.vars_at_eq{" << i << "}.lag = [";
|
||||
for (set<pair<int, int> >::const_iterator it1 = it->begin();
|
||||
for (auto it1 = it->begin();
|
||||
it1 != it->end(); it1++)
|
||||
{
|
||||
if (it1 != it->begin())
|
||||
|
@ -531,7 +531,7 @@ VarModelStatement::createVarModelMFunction(ostream &output, const map<string, se
|
|||
|
||||
stringstream ss;
|
||||
set<int> horizons = var_expectation_functions_to_write.find(name)->second;
|
||||
for (set<int>::const_iterator it = horizons.begin(); it != horizons.end(); it++)
|
||||
for (auto it = horizons.begin(); it != horizons.end(); it++)
|
||||
{
|
||||
if (it != horizons.begin())
|
||||
ss << " ";
|
||||
|
@ -555,7 +555,7 @@ VarEstimationStatement::VarEstimationStatement(OptionsList options_list_arg) :
|
|||
void
|
||||
VarEstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||
{
|
||||
OptionsList::string_options_t::const_iterator it = options_list.string_options.find("var_estimation.model_name");
|
||||
auto it = options_list.string_options.find("var_estimation.model_name");
|
||||
if (it == options_list.string_options.end())
|
||||
{
|
||||
cerr << "ERROR: You must provide the model name to the var_estimation statement." << endl;
|
||||
|
@ -594,7 +594,7 @@ VarRestrictionsStatement::findIdxInVector(const vector<string> &vecvars, const s
|
|||
{
|
||||
int idx = 0;
|
||||
bool setflag = false;
|
||||
for (vector<string>::const_iterator itvs = vecvars.begin();
|
||||
for (auto itvs = vecvars.begin();
|
||||
itvs != vecvars.end(); itvs++, idx++)
|
||||
if (*itvs == var)
|
||||
{
|
||||
|
@ -614,7 +614,7 @@ VarRestrictionsStatement::findIdxInVector(const vector<string> &vecvars, const s
|
|||
void
|
||||
VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
map<string, vector<string> >::const_iterator itvs = var_map.find(var_model_name);
|
||||
auto itvs = var_map.find(var_model_name);
|
||||
if (itvs == var_map.end())
|
||||
{
|
||||
cerr << "ERROR: you are imposing restrictions on a VAR named " << var_model_name
|
||||
|
@ -628,13 +628,13 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
|
|||
|
||||
// Exclusion Restrictions
|
||||
int idx = 1;
|
||||
for (map<int, map<int, SymbolList> >::const_iterator it = exclusion_restrictions.begin();
|
||||
for (auto it = exclusion_restrictions.begin();
|
||||
it != exclusion_restrictions.end(); it++, idx++)
|
||||
{
|
||||
output << Mstr << "exclusion_restrictions{" << idx<< "}.lag = "
|
||||
<< it->first << ";" << endl
|
||||
<< Mstr << "exclusion_restrictions{" << idx << "}.restrictions = [";
|
||||
for (map<int, SymbolList>::const_iterator it1 = it->second.begin();
|
||||
for (auto it1 = it->second.begin();
|
||||
it1 != it->second.end(); it1++)
|
||||
{
|
||||
if (it1 != it->second.begin())
|
||||
|
@ -654,7 +654,7 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
|
|||
|
||||
// Equation Restrictions
|
||||
idx = 1;
|
||||
for (equation_restrictions_t::const_iterator it = equation_restrictions.begin();
|
||||
for (auto it = equation_restrictions.begin();
|
||||
it != equation_restrictions.end(); it++, idx++, nrestrictions++)
|
||||
{
|
||||
output << Mstr << "equation_restriction{" << idx << "}.eq = '"
|
||||
|
@ -686,7 +686,7 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
|
|||
|
||||
// Cross Equation Restrictions
|
||||
idx = 1;
|
||||
for (crossequation_restrictions_t::const_iterator it = crossequation_restrictions.begin();
|
||||
for (auto it = crossequation_restrictions.begin();
|
||||
it != crossequation_restrictions.end(); it++, idx++, nrestrictions++)
|
||||
{
|
||||
output << Mstr << "crossequation_restriction{" << idx << "}.val = "
|
||||
|
@ -720,7 +720,7 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
|
|||
|
||||
// Covariance Const Restrictions
|
||||
idx = 1;
|
||||
for (map<pair<int, int>, double>::const_iterator it = covariance_number_restriction.begin();
|
||||
for (auto it = covariance_number_restriction.begin();
|
||||
it != covariance_number_restriction.end(); it++, idx++)
|
||||
output << Mstr << "covariance_const_restriction{" << idx << "}.var1 = '"
|
||||
<< symbol_table.getName(it->first.first) << "';" << endl
|
||||
|
@ -731,7 +731,7 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
|
|||
|
||||
// Covariance Pair Restrictions
|
||||
idx = 1;
|
||||
for (map<pair<int, int>, pair<int, int> >::const_iterator it = covariance_pair_restriction.begin();
|
||||
for (auto it = covariance_pair_restriction.begin();
|
||||
it != covariance_pair_restriction.end(); it++, idx++)
|
||||
output << Mstr << "covariance_pair_restriction{" << idx << "}.var11 = '"
|
||||
<< symbol_table.getName(it->first.first) << "';" << endl
|
||||
|
@ -758,7 +758,7 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
|
|||
mod_file_struct.stoch_simul_present = true;
|
||||
|
||||
// Fill in option_order of mod_file_struct
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
auto it = options_list.num_options.find("order");
|
||||
if (it != options_list.num_options.end())
|
||||
mod_file_struct.order_option = max(mod_file_struct.order_option, atoi(it->second.c_str()));
|
||||
|
||||
|
@ -774,8 +774,8 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
|
|||
mod_file_struct.k_order_solver = true;
|
||||
|
||||
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");
|
||||
auto it1 = options_list.num_options.find("bandpass.indicator");
|
||||
auto 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()))
|
||||
|
@ -790,8 +790,8 @@ void
|
|||
StochSimulStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
// Ensure that order 3 implies k_order (#844)
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver");
|
||||
auto it = options_list.num_options.find("order");
|
||||
auto it1 = options_list.num_options.find("k_order_solver");
|
||||
if ((it1 != options_list.num_options.end() && it1->second == "1")
|
||||
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
|
||||
output << "options_.k_order_solver = 1;" << endl;
|
||||
|
@ -863,7 +863,7 @@ RamseyModelStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsol
|
|||
/* Fill in option_order of mod_file_struct
|
||||
Since ramsey model needs one further order of derivation (for example, for 1st order
|
||||
approximation, it needs 2nd derivatives), we add 1 to the order declared by user */
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
auto it = options_list.num_options.find("order");
|
||||
if (it != options_list.num_options.end())
|
||||
{
|
||||
int order = atoi(it->second.c_str());
|
||||
|
@ -895,8 +895,8 @@ RamseyModelStatement::writeOutput(ostream &output, const string &basename, bool
|
|||
// It should probably rather be a M_ field, but we leave it in options_ for historical reason
|
||||
|
||||
// Ensure that order 3 implies k_order (#844)
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver");
|
||||
auto it = options_list.num_options.find("order");
|
||||
auto it1 = options_list.num_options.find("k_order_solver");
|
||||
if ((it1 != options_list.num_options.end() && it1->second == "1")
|
||||
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
|
||||
output << "options_.k_order_solver = 1;" << endl;
|
||||
|
@ -934,7 +934,7 @@ void
|
|||
RamseyConstraintsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
output << "M_.ramsey_model_constraints = {" << endl;
|
||||
for (RamseyConstraintsStatement::constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); ++it)
|
||||
for (auto it = constraints.begin(); it != constraints.end(); ++it)
|
||||
{
|
||||
if (it != constraints.begin())
|
||||
output << ", ";
|
||||
|
@ -969,7 +969,7 @@ RamseyConstraintsStatement::writeJsonOutput(ostream &output) const
|
|||
{
|
||||
output << "{\"statementName\": \"ramsey_constraints\""
|
||||
<< ", \"ramsey_model_constraints\": [" << endl;
|
||||
for (RamseyConstraintsStatement::constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); ++it)
|
||||
for (auto it = constraints.begin(); it != constraints.end(); ++it)
|
||||
{
|
||||
if (it != constraints.begin())
|
||||
output << ", ";
|
||||
|
@ -1021,7 +1021,7 @@ RamseyPolicyStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso
|
|||
/* Fill in option_order of mod_file_struct
|
||||
Since ramsey policy needs one further order of derivation (for example, for 1st order
|
||||
approximation, it needs 2nd derivatives), we add 1 to the order declared by user */
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
auto it = options_list.num_options.find("order");
|
||||
if (it != options_list.num_options.end())
|
||||
{
|
||||
int order = atoi(it->second.c_str());
|
||||
|
@ -1067,15 +1067,15 @@ void
|
|||
RamseyPolicyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
// Ensure that order 3 implies k_order (#844)
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver");
|
||||
auto it = options_list.num_options.find("order");
|
||||
auto it1 = options_list.num_options.find("k_order_solver");
|
||||
if ((it1 != options_list.num_options.end() && it1->second == "1")
|
||||
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
|
||||
output << "options_.k_order_solver = 1;" << endl;
|
||||
|
||||
options_list.writeOutput(output);
|
||||
output << "var_list_ = {";
|
||||
for (vector<string>::const_iterator it = ramsey_policy_list.begin();
|
||||
for (auto it = ramsey_policy_list.begin();
|
||||
it != ramsey_policy_list.end(); ++it)
|
||||
{
|
||||
if (it != ramsey_policy_list.begin())
|
||||
|
@ -1096,7 +1096,7 @@ RamseyPolicyStatement::writeJsonOutput(ostream &output) const
|
|||
options_list.writeJsonOutput(output);
|
||||
}
|
||||
output << ", \"ramsey_policy_list\": [";
|
||||
for (vector<string>::const_iterator it = ramsey_policy_list.begin();
|
||||
for (auto it = ramsey_policy_list.begin();
|
||||
it != ramsey_policy_list.end(); ++it)
|
||||
{
|
||||
if (it != ramsey_policy_list.begin())
|
||||
|
@ -1128,7 +1128,7 @@ DiscretionaryPolicyStatement::checkPass(ModFileStructure &mod_file_struct, Warni
|
|||
/* Fill in option_order of mod_file_struct
|
||||
Since discretionary policy needs one further order of derivation (for example, for 1st order
|
||||
approximation, it needs 2nd derivatives), we add 1 to the order declared by user */
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
auto it = options_list.num_options.find("order");
|
||||
if (it != options_list.num_options.end())
|
||||
{
|
||||
int order = atoi(it->second.c_str());
|
||||
|
@ -1156,8 +1156,8 @@ void
|
|||
DiscretionaryPolicyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
// Ensure that order 3 implies k_order (#844)
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver");
|
||||
auto it = options_list.num_options.find("order");
|
||||
auto it1 = options_list.num_options.find("k_order_solver");
|
||||
if ((it1 != options_list.num_options.end() && it1->second == "1")
|
||||
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
|
||||
output << "options_.k_order_solver = 1;" << endl;
|
||||
|
@ -1197,7 +1197,7 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
|
|||
mod_file_struct.estimation_present = true;
|
||||
|
||||
// Fill in option_order of mod_file_struct
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
auto it = options_list.num_options.find("order");
|
||||
if (it != options_list.num_options.end())
|
||||
{
|
||||
int order = atoi(it->second.c_str());
|
||||
|
@ -1227,7 +1227,7 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
|
|||
mod_file_struct.dsge_var_calibrated = it->second;
|
||||
|
||||
// Fill in mod_file_struct.dsge_var_estimated
|
||||
OptionsList::string_options_t::const_iterator it_str = options_list.string_options.find("dsge_var");
|
||||
auto it_str = options_list.string_options.find("dsge_var");
|
||||
if (it_str != options_list.string_options.end())
|
||||
mod_file_struct.dsge_var_estimated = true;
|
||||
|
||||
|
@ -1274,7 +1274,7 @@ EstimationStatement::writeOutput(ostream &output, const string &basename, bool m
|
|||
options_list.writeOutput(output);
|
||||
|
||||
// Special treatment for order option and particle filter
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
auto it = options_list.num_options.find("order");
|
||||
if (it == options_list.num_options.end())
|
||||
output << "options_.order = 1;" << endl;
|
||||
else if (atoi(it->second.c_str()) == 2)
|
||||
|
@ -1314,7 +1314,7 @@ DynareSensitivityStatement::DynareSensitivityStatement(OptionsList options_list_
|
|||
void
|
||||
DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||
{
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("identification");
|
||||
auto it = options_list.num_options.find("identification");
|
||||
if (it != options_list.num_options.end()
|
||||
&& it->second == "1")
|
||||
mod_file_struct.identification_present = true;
|
||||
|
@ -1329,13 +1329,13 @@ DynareSensitivityStatement::writeOutput(ostream &output, const string &basename,
|
|||
options_.
|
||||
\todo factorize this code between identification and dynare_sensitivity,
|
||||
and provide a generic mechanism for this situation (maybe using regexps) */
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("nodisplay");
|
||||
auto it = options_list.num_options.find("nodisplay");
|
||||
if (it != options_list.num_options.end())
|
||||
output << "options_.nodisplay = " << it->second << ";" << endl;
|
||||
it = options_list.num_options.find("nograph");
|
||||
if (it != options_list.num_options.end())
|
||||
output << "options_.nograph = " << it->second << ";" << endl;
|
||||
OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("graph_format");
|
||||
auto it2 = options_list.string_options.find("graph_format");
|
||||
if (it2 != options_list.string_options.end())
|
||||
output << "options_.graph_format = '" << it2->second << "';" << endl;
|
||||
|
||||
|
@ -1568,7 +1568,7 @@ EstimatedParamsStatement::writeJsonOutput(ostream &output) const
|
|||
{
|
||||
output << "{\"statementName\": \"estimated_params\", "
|
||||
<< "\"params\": [";
|
||||
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++)
|
||||
for (auto it = estim_params_list.begin(); it != estim_params_list.end(); it++)
|
||||
{
|
||||
if (it != estim_params_list.begin())
|
||||
output << ", ";
|
||||
|
@ -1693,7 +1693,7 @@ EstimatedParamsInitStatement::writeJsonOutput(ostream &output) const
|
|||
output << ", \"use_calibration_initialization\": 1";
|
||||
|
||||
output << ", \"params\": [";
|
||||
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++)
|
||||
for (auto it = estim_params_list.begin(); it != estim_params_list.end(); it++)
|
||||
{
|
||||
if (it != estim_params_list.begin())
|
||||
output << ", ";
|
||||
|
@ -1811,7 +1811,7 @@ EstimatedParamsBoundsStatement::writeJsonOutput(ostream &output) const
|
|||
output << "{\"statementName\": \"estimated_params_bounds\", "
|
||||
<< "\"params\": [";
|
||||
|
||||
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++)
|
||||
for (auto it = estim_params_list.begin(); it != estim_params_list.end(); it++)
|
||||
{
|
||||
if (it != estim_params_list.begin())
|
||||
output << ", ";
|
||||
|
@ -1969,7 +1969,7 @@ OsrParamsBoundsStatement::writeJsonOutput(ostream &output) const
|
|||
{
|
||||
output << "{\"statementName\": \"osr_params_bounds\""
|
||||
<< ", \"bounds\": [";
|
||||
for (vector<OsrParams>::const_iterator it = osr_params_list.begin();
|
||||
for (auto it = osr_params_list.begin();
|
||||
it != osr_params_list.end(); it++)
|
||||
{
|
||||
if (it != osr_params_list.begin())
|
||||
|
@ -1992,7 +1992,7 @@ OsrStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation
|
|||
mod_file_struct.osr_present = true;
|
||||
|
||||
// Fill in option_order of mod_file_struct
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
auto it = options_list.num_options.find("order");
|
||||
if (it != options_list.num_options.end())
|
||||
mod_file_struct.order_option = max(mod_file_struct.order_option, atoi(it->second.c_str()));
|
||||
|
||||
|
@ -2012,8 +2012,8 @@ void
|
|||
OsrStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
// Ensure that order 3 implies k_order (#844)
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order");
|
||||
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver");
|
||||
auto it = options_list.num_options.find("order");
|
||||
auto it1 = options_list.num_options.find("k_order_solver");
|
||||
if ((it1 != options_list.num_options.end() && it1->second == "1")
|
||||
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
|
||||
output << "options_.k_order_solver = 1;" << endl;
|
||||
|
@ -2094,7 +2094,7 @@ OptimWeightsStatement::writeJsonOutput(ostream &output) const
|
|||
{
|
||||
output << "{\"statementName\": \"optim_weights\", "
|
||||
<< "\"weights\": [";
|
||||
for (var_weights_t::const_iterator it = var_weights.begin();
|
||||
for (auto it = var_weights.begin();
|
||||
it != var_weights.end(); it++)
|
||||
{
|
||||
if (it != var_weights.begin())
|
||||
|
@ -2105,7 +2105,7 @@ OptimWeightsStatement::writeJsonOutput(ostream &output) const
|
|||
output << "\"}";
|
||||
}
|
||||
|
||||
for (covar_weights_t::const_iterator it = covar_weights.begin();
|
||||
for (auto it = covar_weights.begin();
|
||||
it != covar_weights.end(); it++)
|
||||
{
|
||||
if (it != covar_weights.begin() || !var_weights.empty())
|
||||
|
@ -2206,7 +2206,7 @@ ModelComparisonStatement::writeJsonOutput(ostream &output) const
|
|||
if (!filename_list.empty())
|
||||
output << ", \"filename_list\": {";
|
||||
|
||||
for (filename_list_t::const_iterator it = filename_list.begin();
|
||||
for (auto it = filename_list.begin();
|
||||
it != filename_list.end(); it++)
|
||||
{
|
||||
if (it != filename_list.begin())
|
||||
|
@ -2435,9 +2435,9 @@ MSSBVARSimulationStatement::writeOutput(ostream &output, const string &basename,
|
|||
options_list.writeOutput(output);
|
||||
|
||||
// Redeclare drop option if necessary
|
||||
OptionsList::num_options_t::const_iterator mh_replic_it = options_list.num_options.find("ms.mh_replic");
|
||||
OptionsList::num_options_t::const_iterator thinning_factor_it = options_list.num_options.find("ms.thinning_factor");
|
||||
OptionsList::num_options_t::const_iterator drop_it = options_list.num_options.find("ms.drop");
|
||||
auto mh_replic_it = options_list.num_options.find("ms.mh_replic");
|
||||
auto thinning_factor_it = options_list.num_options.find("ms.thinning_factor");
|
||||
auto drop_it = options_list.num_options.find("ms.drop");
|
||||
if (mh_replic_it != options_list.num_options.end() || thinning_factor_it != options_list.num_options.end())
|
||||
if (drop_it == options_list.num_options.end())
|
||||
output << "options_.ms.drop = 0.1*options_.ms.mh_replic*options_.ms.thinning_factor;" << endl;
|
||||
|
@ -2543,7 +2543,7 @@ MSSBVARIrfStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
|
|||
bool regimes_present = false;
|
||||
bool filtered_probabilities_present = false;
|
||||
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("ms.regimes");
|
||||
auto it = options_list.num_options.find("ms.regimes");
|
||||
if (it != options_list.num_options.end())
|
||||
regimes_present = true;
|
||||
|
||||
|
@ -2643,7 +2643,7 @@ MSSBVARVarianceDecompositionStatement::checkPass(ModFileStructure &mod_file_stru
|
|||
bool regimes_present = false;
|
||||
bool filtered_probabilities_present = false;
|
||||
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("ms.regimes");
|
||||
auto it = options_list.num_options.find("ms.regimes");
|
||||
if (it != options_list.num_options.end())
|
||||
regimes_present = true;
|
||||
|
||||
|
@ -2711,13 +2711,13 @@ IdentificationStatement::writeOutput(ostream &output, const string &basename, bo
|
|||
options_.
|
||||
\todo factorize this code between identification and dynare_sensitivity,
|
||||
and provide a generic mechanism for this situation (maybe using regexps) */
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("nodisplay");
|
||||
auto it = options_list.num_options.find("nodisplay");
|
||||
if (it != options_list.num_options.end())
|
||||
output << "options_.nodisplay = " << it->second << ";" << endl;
|
||||
it = options_list.num_options.find("nograph");
|
||||
if (it != options_list.num_options.end())
|
||||
output << "options_.nograph = " << it->second << ";" << endl;
|
||||
OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("graph_format");
|
||||
auto it2 = options_list.string_options.find("graph_format");
|
||||
if (it2 != options_list.string_options.end())
|
||||
output << "options_.graph_format = '" << it2->second << "';" << endl;
|
||||
|
||||
|
@ -3032,7 +3032,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
|
|||
output << "options_.ms.Qi = cell(" << n << ",1);" << endl;
|
||||
output << "options_.ms.Ri = cell(" << n << ",1);" << endl;
|
||||
|
||||
for (svar_identification_restrictions_t::const_iterator it = restrictions.begin(); it != restrictions.end(); it++)
|
||||
for (auto it = restrictions.begin(); it != restrictions.end(); it++)
|
||||
{
|
||||
assert(it->lag >= 0);
|
||||
if (it->lag == 0)
|
||||
|
@ -3074,7 +3074,7 @@ SvarIdentificationStatement::writeJsonOutput(ostream &output) const
|
|||
output << ", \"nlags\": " << getMaxLag()
|
||||
<< ", \"restrictions\": [";
|
||||
|
||||
for (svar_identification_restrictions_t::const_iterator it = restrictions.begin(); it != restrictions.end(); it++)
|
||||
for (auto it = restrictions.begin(); it != restrictions.end(); it++)
|
||||
{
|
||||
if (it != restrictions.begin())
|
||||
output << ", ";
|
||||
|
@ -3094,14 +3094,14 @@ SvarIdentificationStatement::writeJsonOutput(ostream &output) const
|
|||
MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg) :
|
||||
options_list(move(options_list_arg))
|
||||
{
|
||||
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("ms.restrictions");
|
||||
auto it_num = options_list.num_options.find("ms.restrictions");
|
||||
if (it_num != options_list.num_options.end())
|
||||
{
|
||||
using namespace boost;
|
||||
OptionsList::num_options_t::const_iterator it_num_regimes
|
||||
auto 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);
|
||||
auto num_regimes = lexical_cast< int >(it_num_regimes->second);
|
||||
|
||||
vector<string> tokenizedRestrictions;
|
||||
split(tokenizedRestrictions, it_num->second, is_any_of("["), token_compress_on);
|
||||
|
@ -3110,7 +3110,7 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg)
|
|||
{
|
||||
vector<string> restriction;
|
||||
split(restriction, tokenizedRestriction, is_any_of("], "));
|
||||
for (vector<string>::iterator it1 = restriction.begin();
|
||||
for (auto it1 = restriction.begin();
|
||||
it1 != restriction.end();)
|
||||
if (it1->empty())
|
||||
restriction.erase(it1);
|
||||
|
@ -3126,8 +3126,8 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg)
|
|||
|
||||
try
|
||||
{
|
||||
int from_regime = lexical_cast< int >(restriction[0]);
|
||||
int to_regime = lexical_cast< int >(restriction[1]);
|
||||
auto from_regime = lexical_cast< int >(restriction[0]);
|
||||
auto to_regime = lexical_cast< int >(restriction[1]);
|
||||
if (from_regime > num_regimes || to_regime > num_regimes)
|
||||
{
|
||||
cerr << "ERROR: the regimes specified in the restrictions option must be "
|
||||
|
@ -3143,7 +3143,7 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
double transition_probability = lexical_cast< double >(restriction[2]);
|
||||
auto transition_probability = lexical_cast< double >(restriction[2]);
|
||||
if (transition_probability > 1.0)
|
||||
{
|
||||
cerr << "ERROR: the transition probability, " << transition_probability
|
||||
|
@ -3166,7 +3166,7 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg)
|
|||
void
|
||||
MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||
{
|
||||
OptionsList::num_options_t::const_iterator itChain = options_list.num_options.find("ms.chain");
|
||||
auto itChain = options_list.num_options.find("ms.chain");
|
||||
assert(itChain != options_list.num_options.end());
|
||||
int chainNumber = atoi(itChain->second.c_str());
|
||||
if (++mod_file_struct.last_markov_switching_chain != chainNumber)
|
||||
|
@ -3176,14 +3176,14 @@ MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("ms.restrictions");
|
||||
auto it_num = options_list.num_options.find("ms.restrictions");
|
||||
if (it_num != options_list.num_options.end())
|
||||
{
|
||||
using namespace boost;
|
||||
OptionsList::num_options_t::const_iterator it_num_regimes
|
||||
auto 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);
|
||||
auto num_regimes = lexical_cast< int >(it_num_regimes->second);
|
||||
vector<double> col_trans_prob_sum(num_regimes, 0);
|
||||
vector<double> row_trans_prob_sum(num_regimes, 0);
|
||||
vector<bool> all_restrictions_in_row(num_regimes, true);
|
||||
|
@ -3283,7 +3283,7 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
|
|||
{
|
||||
output << endl;
|
||||
|
||||
OptionsList::num_options_t::const_iterator it
|
||||
auto it
|
||||
= options_list.num_options.find("ms.chain");
|
||||
assert(it != options_list.num_options.end());
|
||||
output << "chain = " << it->second << ";" << endl;
|
||||
|
@ -3309,7 +3309,7 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
|
|||
if (!itvs.empty())
|
||||
output << "duration.push_back(" << itvs << ");" << endl;
|
||||
|
||||
OptionsList::symbol_list_options_t::const_iterator itsl
|
||||
auto itsl
|
||||
= options_list.symbol_list_options.find("ms.parameters");
|
||||
assert(itsl != options_list.symbol_list_options.end());
|
||||
vector<string> parameters = itsl->second.get_symbols();
|
||||
|
@ -3338,7 +3338,7 @@ MarkovSwitchingStatement::writeJsonOutput(ostream &output) const
|
|||
|
||||
if (!restriction_map.empty())
|
||||
output << ", {";
|
||||
for (map<pair<int, int>, double >::const_iterator it = restriction_map.begin();
|
||||
for (auto it = restriction_map.begin();
|
||||
it != restriction_map.end(); it++)
|
||||
{
|
||||
if (it != restriction_map.begin())
|
||||
|
@ -3477,7 +3477,7 @@ EstimationDataStatement::checkPass(ModFileStructure &mod_file_struct, WarningCon
|
|||
{
|
||||
mod_file_struct.estimation_data_statement_present = true;
|
||||
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("nobs");
|
||||
auto it = options_list.num_options.find("nobs");
|
||||
if (it != options_list.num_options.end())
|
||||
if (atoi(it->second.c_str()) <= 0)
|
||||
{
|
||||
|
@ -3547,7 +3547,7 @@ SubsamplesStatement::writeOutput(ostream &output, const string &basename, bool m
|
|||
<< "estimation_info.subsamples(subsamples_indx).range_index = {};" << endl;
|
||||
|
||||
int map_indx = 1;
|
||||
for (subsample_declaration_map_t::const_iterator it = subsample_declaration_map.begin();
|
||||
for (auto it = subsample_declaration_map.begin();
|
||||
it != subsample_declaration_map.end(); it++, map_indx++)
|
||||
output << "estimation_info.subsamples(subsamples_indx).range_index(" << map_indx << ") = {'"
|
||||
<< it->first << "'};" << endl
|
||||
|
@ -3600,7 +3600,7 @@ SubsamplesStatement::writeJsonOutput(ostream &output) const
|
|||
output << ", \"name2\": \"" << name2 << "\"";
|
||||
|
||||
output << ", \"declarations\": {";
|
||||
for (subsample_declaration_map_t::const_iterator it = subsample_declaration_map.begin();
|
||||
for (auto it = subsample_declaration_map.begin();
|
||||
it != subsample_declaration_map.end(); it++)
|
||||
{
|
||||
if (it != subsample_declaration_map.begin())
|
||||
|
@ -3721,7 +3721,7 @@ JointPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("domain");
|
||||
auto it_num = options_list.num_options.find("domain");
|
||||
if (it_num != options_list.num_options.end())
|
||||
{
|
||||
using namespace boost;
|
||||
|
@ -3783,7 +3783,7 @@ JointPriorStatement::writeOutput(ostream &output, const string &basename, bool m
|
|||
void
|
||||
JointPriorStatement::writeOutputHelper(ostream &output, const string &field, const string &lhs_field) const
|
||||
{
|
||||
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field);
|
||||
auto itn = options_list.num_options.find(field);
|
||||
output << lhs_field << "." << field << " = {";
|
||||
if (field == "variance")
|
||||
output << "{";
|
||||
|
@ -3801,7 +3801,7 @@ JointPriorStatement::writeJsonOutput(ostream &output) const
|
|||
{
|
||||
output << "{\"statementName\": \"joint_prior\""
|
||||
<< ", \"key\": [";
|
||||
for (vector<string>::const_iterator it = joint_parameters.begin(); it != joint_parameters.end(); it++)
|
||||
for (auto it = joint_parameters.begin(); it != joint_parameters.end(); it++)
|
||||
{
|
||||
if (it != joint_parameters.begin())
|
||||
output << ", ";
|
||||
|
@ -3882,7 +3882,7 @@ BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
OptionsList::num_options_t::const_iterator it_stdev = options_list.num_options.find("stdev");
|
||||
auto 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))
|
||||
{
|
||||
|
@ -3890,7 +3890,7 @@ BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("domain");
|
||||
auto it_num = options_list.num_options.find("domain");
|
||||
if (it_num != options_list.num_options.end())
|
||||
{
|
||||
using namespace boost;
|
||||
|
@ -3950,7 +3950,7 @@ BasicPriorStatement::writeCommonOutput(ostream &output, const string &lhs_field)
|
|||
void
|
||||
BasicPriorStatement::writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const
|
||||
{
|
||||
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field);
|
||||
auto itn = options_list.num_options.find(field);
|
||||
if (itn != options_list.num_options.end())
|
||||
output << lhs_field << "." << field << " = "<< itn->second << ";" << endl;
|
||||
}
|
||||
|
@ -4004,7 +4004,7 @@ void
|
|||
BasicPriorStatement::writeCDomain(ostream &output) const
|
||||
{
|
||||
output << "domain.clear();" << endl;
|
||||
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("domain");
|
||||
auto it_num = options_list.num_options.find("domain");
|
||||
if (it_num != options_list.num_options.end())
|
||||
{
|
||||
using namespace boost;
|
||||
|
@ -4019,7 +4019,7 @@ BasicPriorStatement::writeCDomain(ostream &output) const
|
|||
void
|
||||
BasicPriorStatement::writeCOutputHelper(ostream &output, const string &field) const
|
||||
{
|
||||
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field);
|
||||
auto itn = options_list.num_options.find(field);
|
||||
if (itn != options_list.num_options.end())
|
||||
output << field << " = " << itn->second << ";" << endl;
|
||||
else
|
||||
|
@ -4442,7 +4442,7 @@ BasicOptionsStatement::writeCommonOutput(ostream &output, const string &lhs_fiel
|
|||
void
|
||||
BasicOptionsStatement::writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const
|
||||
{
|
||||
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field);
|
||||
auto itn = options_list.num_options.find(field);
|
||||
if (itn != options_list.num_options.end())
|
||||
output << lhs_field << "." << field << " = " << itn->second << ";" << endl;
|
||||
}
|
||||
|
@ -4450,7 +4450,7 @@ BasicOptionsStatement::writeCommonOutputHelper(ostream &output, const string &fi
|
|||
void
|
||||
BasicOptionsStatement::writeCOutputHelper(ostream &output, const string &field) const
|
||||
{
|
||||
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field);
|
||||
auto itn = options_list.num_options.find(field);
|
||||
if (itn != options_list.num_options.end())
|
||||
output << field << " = " << itn->second << ";" << endl;
|
||||
else
|
||||
|
@ -4774,7 +4774,7 @@ void
|
|||
CalibSmootherStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
options_list.writeOutput(output);
|
||||
OptionsList::string_options_t::const_iterator it = options_list.string_options.find("parameter_set");
|
||||
auto it = options_list.string_options.find("parameter_set");
|
||||
if (it == options_list.string_options.end())
|
||||
output << "options_.parameter_set = 'calibration';" << endl;
|
||||
symbol_list.writeOutput("var_list_", output);
|
||||
|
@ -4817,7 +4817,7 @@ ExtendedPathStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso
|
|||
}
|
||||
|
||||
// Fill in option_occbin of mod_file_struct
|
||||
OptionsList::string_options_t::const_iterator it = options_list.num_options.find("occbin");
|
||||
auto it = options_list.num_options.find("occbin");
|
||||
if (it != options_list.string_options.end())
|
||||
mod_file_struct.occbin_option = true;
|
||||
}
|
||||
|
|
|
@ -402,7 +402,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
|
|||
else
|
||||
try
|
||||
{
|
||||
double weight = lexical_cast<double>(token.c_str());
|
||||
auto weight = lexical_cast<double>(token.c_str());
|
||||
if (weight <= 0)
|
||||
{
|
||||
cerr << "ERROR (in config file): Misspecification of weights passed to Members option." << endl;
|
||||
|
|
|
@ -55,7 +55,7 @@ DataTree::AddNonNegativeConstant(const string &value)
|
|||
{
|
||||
int id = num_constants.AddNonNegativeConstant(value);
|
||||
|
||||
num_const_node_map_t::iterator it = num_const_node_map.find(id);
|
||||
auto it = num_const_node_map.find(id);
|
||||
if (it != num_const_node_map.end())
|
||||
return it->second;
|
||||
else
|
||||
|
@ -65,7 +65,7 @@ DataTree::AddNonNegativeConstant(const string &value)
|
|||
VariableNode *
|
||||
DataTree::AddVariableInternal(int symb_id, int lag)
|
||||
{
|
||||
variable_node_map_t::iterator it = variable_node_map.find(make_pair(symb_id, lag));
|
||||
auto it = variable_node_map.find(make_pair(symb_id, lag));
|
||||
if (it != variable_node_map.end())
|
||||
return it->second;
|
||||
else
|
||||
|
@ -94,7 +94,7 @@ DataTree::AddPlus(expr_t iArg1, expr_t iArg2)
|
|||
if (iArg1 != Zero && iArg2 != Zero)
|
||||
{
|
||||
// Simplify x+(-y) in x-y
|
||||
UnaryOpNode *uarg2 = dynamic_cast<UnaryOpNode *>(iArg2);
|
||||
auto *uarg2 = dynamic_cast<UnaryOpNode *>(iArg2);
|
||||
if (uarg2 != NULL && uarg2->get_op_code() == oUminus)
|
||||
return AddMinus(iArg1, uarg2->get_arg());
|
||||
|
||||
|
@ -137,7 +137,7 @@ DataTree::AddUMinus(expr_t iArg1)
|
|||
if (iArg1 != Zero)
|
||||
{
|
||||
// Simplify -(-x) in x
|
||||
UnaryOpNode *uarg = dynamic_cast<UnaryOpNode *>(iArg1);
|
||||
auto *uarg = dynamic_cast<UnaryOpNode *>(iArg1);
|
||||
if (uarg != NULL && uarg->get_op_code() == oUminus)
|
||||
return uarg->get_arg();
|
||||
|
||||
|
@ -506,7 +506,7 @@ DataTree::AddVarExpectation(const int symb_id, const int forecast_horizon, const
|
|||
{
|
||||
assert(symbol_table.getType(symb_id) == eEndogenous);
|
||||
|
||||
var_expectation_node_map_t::iterator it = var_expectation_node_map.find(make_pair(model_name, make_pair(symb_id, forecast_horizon)));
|
||||
auto it = var_expectation_node_map.find(make_pair(model_name, make_pair(symb_id, forecast_horizon)));
|
||||
if (it != var_expectation_node_map.end())
|
||||
return it->second;
|
||||
|
||||
|
@ -516,7 +516,7 @@ DataTree::AddVarExpectation(const int symb_id, const int forecast_horizon, const
|
|||
expr_t
|
||||
DataTree::AddPacExpectation(const string &model_name)
|
||||
{
|
||||
pac_expectation_node_map_t::iterator it = pac_expectation_node_map.find(model_name);
|
||||
auto it = pac_expectation_node_map.find(model_name);
|
||||
if (it != pac_expectation_node_map.end())
|
||||
return it->second;
|
||||
|
||||
|
@ -535,7 +535,7 @@ DataTree::AddLocalVariable(int symb_id, expr_t value) throw (LocalVariableExcept
|
|||
assert(symbol_table.getType(symb_id) == eModelLocalVariable);
|
||||
|
||||
// Throw an exception if symbol already declared
|
||||
map<int, expr_t>::iterator it = local_variables_table.find(symb_id);
|
||||
auto it = local_variables_table.find(symb_id);
|
||||
if (it != local_variables_table.end())
|
||||
throw LocalVariableException(symbol_table.getName(symb_id));
|
||||
|
||||
|
@ -548,7 +548,7 @@ DataTree::AddExternalFunction(int symb_id, const vector<expr_t> &arguments)
|
|||
{
|
||||
assert(symbol_table.getType(symb_id) == eExternalFunction);
|
||||
|
||||
external_function_node_map_t::iterator it = external_function_node_map.find(make_pair(arguments, symb_id));
|
||||
auto it = external_function_node_map.find(make_pair(arguments, symb_id));
|
||||
if (it != external_function_node_map.end())
|
||||
return it->second;
|
||||
|
||||
|
@ -560,7 +560,7 @@ DataTree::AddFirstDerivExternalFunction(int top_level_symb_id, const vector<expr
|
|||
{
|
||||
assert(symbol_table.getType(top_level_symb_id) == eExternalFunction);
|
||||
|
||||
first_deriv_external_function_node_map_t::iterator it
|
||||
auto it
|
||||
= first_deriv_external_function_node_map.find(make_pair(make_pair(arguments, input_index),
|
||||
top_level_symb_id));
|
||||
if (it != first_deriv_external_function_node_map.end())
|
||||
|
@ -574,7 +574,7 @@ DataTree::AddSecondDerivExternalFunction(int top_level_symb_id, const vector<exp
|
|||
{
|
||||
assert(symbol_table.getType(top_level_symb_id) == eExternalFunction);
|
||||
|
||||
second_deriv_external_function_node_map_t::iterator it
|
||||
auto it
|
||||
= second_deriv_external_function_node_map.find(make_pair(make_pair(arguments,
|
||||
make_pair(input_index1, input_index2)),
|
||||
top_level_symb_id));
|
||||
|
|
|
@ -330,13 +330,13 @@ inline expr_t
|
|||
DataTree::AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set, int param1_symb_id, int param2_symb_id, const string &adl_param_name, const vector<int> &adl_lags)
|
||||
{
|
||||
// If the node already exists in tree, share it
|
||||
unary_op_node_map_t::iterator it = unary_op_node_map.find(make_pair(make_pair(arg, op_code), make_pair(make_pair(arg_exp_info_set, make_pair(param1_symb_id, param2_symb_id)), make_pair(adl_param_name, adl_lags))));
|
||||
auto it = unary_op_node_map.find(make_pair(make_pair(arg, op_code), make_pair(make_pair(arg_exp_info_set, make_pair(param1_symb_id, param2_symb_id)), make_pair(adl_param_name, adl_lags))));
|
||||
if (it != unary_op_node_map.end())
|
||||
return it->second;
|
||||
|
||||
// Try to reduce to a constant
|
||||
// Case where arg is a constant and op_code == oUminus (i.e. we're adding a negative constant) is skipped
|
||||
NumConstNode *carg = dynamic_cast<NumConstNode *>(arg);
|
||||
auto *carg = dynamic_cast<NumConstNode *>(arg);
|
||||
if (op_code != oUminus || carg == NULL)
|
||||
{
|
||||
try
|
||||
|
@ -355,7 +355,7 @@ DataTree::AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set, int
|
|||
inline expr_t
|
||||
DataTree::AddBinaryOp(expr_t arg1, BinaryOpcode op_code, expr_t arg2, int powerDerivOrder)
|
||||
{
|
||||
binary_op_node_map_t::iterator it = binary_op_node_map.find(make_pair(make_pair(make_pair(arg1, arg2), powerDerivOrder), op_code));
|
||||
auto it = binary_op_node_map.find(make_pair(make_pair(make_pair(arg1, arg2), powerDerivOrder), op_code));
|
||||
if (it != binary_op_node_map.end())
|
||||
return it->second;
|
||||
|
||||
|
@ -376,7 +376,7 @@ DataTree::AddBinaryOp(expr_t arg1, BinaryOpcode op_code, expr_t arg2, int powerD
|
|||
inline expr_t
|
||||
DataTree::AddTrinaryOp(expr_t arg1, TrinaryOpcode op_code, expr_t arg2, expr_t arg3)
|
||||
{
|
||||
trinary_op_node_map_t::iterator it = trinary_op_node_map.find(make_pair(make_pair(make_pair(arg1, arg2), arg3), op_code));
|
||||
auto it = trinary_op_node_map.find(make_pair(make_pair(make_pair(arg1, arg2), arg3), op_code));
|
||||
if (it != trinary_op_node_map.end())
|
||||
return it->second;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ DynamicModel::AddVariable(int symb_id, int lag)
|
|||
void
|
||||
DynamicModel::compileDerivative(ofstream &code_file, unsigned int &instruction_number, int eq, int symb_id, int lag, const map_idx_t &map_idx) const
|
||||
{
|
||||
first_derivatives_t::const_iterator it = first_derivatives.find(make_pair(eq, getDerivID(symbol_table.getID(eEndogenous, symb_id), lag)));
|
||||
auto it = first_derivatives.find(make_pair(eq, getDerivID(symbol_table.getID(eEndogenous, symb_id), lag)));
|
||||
if (it != first_derivatives.end())
|
||||
(it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
||||
else
|
||||
|
@ -75,7 +75,7 @@ DynamicModel::compileDerivative(ofstream &code_file, unsigned int &instruction_n
|
|||
void
|
||||
DynamicModel::compileChainRuleDerivative(ofstream &code_file, unsigned int &instruction_number, int eqr, int varr, int lag, const map_idx_t &map_idx) const
|
||||
{
|
||||
map<pair<int, pair<int, int> >, expr_t>::const_iterator it = first_chain_rule_derivatives.find(make_pair(eqr, make_pair(varr, lag)));
|
||||
auto it = first_chain_rule_derivatives.find(make_pair(eqr, make_pair(varr, lag)));
|
||||
if (it != first_chain_rule_derivatives.end())
|
||||
(it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
||||
else
|
||||
|
@ -255,7 +255,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
|
|||
int prev_lag;
|
||||
unsigned int prev_var, count_col, count_col_endo, count_col_exo, count_col_exo_det, count_col_other_endo;
|
||||
map<pair<int, pair<int, int> >, expr_t> tmp_block_endo_derivative;
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
tmp_block_endo_derivative[make_pair(it->second.first, make_pair(it->first.second, it->first.first))] = it->second.second;
|
||||
prev_var = 999999999;
|
||||
prev_lag = -9999999;
|
||||
|
@ -272,7 +272,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
|
|||
}
|
||||
}
|
||||
map<pair<int, pair<int, int> >, expr_t> tmp_block_exo_derivative;
|
||||
for (derivative_t::const_iterator it = derivative_exo[block].begin(); it != (derivative_exo[block]).end(); it++)
|
||||
for (auto it = derivative_exo[block].begin(); it != (derivative_exo[block]).end(); it++)
|
||||
tmp_block_exo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
|
||||
prev_var = 999999999;
|
||||
prev_lag = -9999999;
|
||||
|
@ -289,7 +289,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
|
|||
}
|
||||
}
|
||||
map<pair<int, pair<int, int> >, expr_t> tmp_block_exo_det_derivative;
|
||||
for (derivative_t::const_iterator it = derivative_exo_det[block].begin(); it != (derivative_exo_det[block]).end(); it++)
|
||||
for (auto it = derivative_exo_det[block].begin(); it != (derivative_exo_det[block]).end(); it++)
|
||||
tmp_block_exo_det_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
|
||||
prev_var = 999999999;
|
||||
prev_lag = -9999999;
|
||||
|
@ -306,7 +306,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
|
|||
}
|
||||
}
|
||||
map<pair<int, pair<int, int> >, expr_t> tmp_block_other_endo_derivative;
|
||||
for (derivative_t::const_iterator it = derivative_other_endo[block].begin(); it != (derivative_other_endo[block]).end(); it++)
|
||||
for (auto it = derivative_other_endo[block].begin(); it != (derivative_other_endo[block]).end(); it++)
|
||||
tmp_block_other_endo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
|
||||
prev_var = 999999999;
|
||||
prev_lag = -9999999;
|
||||
|
@ -673,7 +673,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
|
|||
case SOLVE_BACKWARD_COMPLETE:
|
||||
case SOLVE_FORWARD_COMPLETE:
|
||||
output << " else" << endl;
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
{
|
||||
unsigned int eq = it->first.first;
|
||||
unsigned int var = it->first.second;
|
||||
|
@ -697,7 +697,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
|
|||
case SOLVE_TWO_BOUNDARIES_SIMPLE:
|
||||
case SOLVE_TWO_BOUNDARIES_COMPLETE:
|
||||
output << " else" << endl;
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
{
|
||||
unsigned int eq = it->first.first;
|
||||
unsigned int var = it->first.second;
|
||||
|
@ -1109,16 +1109,16 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
|
|||
file_open = true;
|
||||
}
|
||||
map<pair<int, pair<int, int> >, expr_t> tmp_block_endo_derivative;
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
tmp_block_endo_derivative[make_pair(it->second.first, make_pair(it->first.second, it->first.first))] = it->second.second;
|
||||
map<pair<int, pair<int, int> >, expr_t> tmp_exo_derivative;
|
||||
for (derivative_t::const_iterator it = derivative_exo[block].begin(); it != (derivative_exo[block]).end(); it++)
|
||||
for (auto it = derivative_exo[block].begin(); it != (derivative_exo[block]).end(); it++)
|
||||
tmp_exo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
|
||||
map<pair<int, pair<int, int> >, expr_t> tmp_exo_det_derivative;
|
||||
for (derivative_t::const_iterator it = derivative_exo_det[block].begin(); it != (derivative_exo_det[block]).end(); it++)
|
||||
for (auto it = derivative_exo_det[block].begin(); it != (derivative_exo_det[block]).end(); it++)
|
||||
tmp_exo_det_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
|
||||
map<pair<int, pair<int, int> >, expr_t> tmp_other_endo_derivative;
|
||||
for (derivative_t::const_iterator it = derivative_other_endo[block].begin(); it != (derivative_other_endo[block]).end(); it++)
|
||||
for (auto it = derivative_other_endo[block].begin(); it != (derivative_other_endo[block]).end(); it++)
|
||||
tmp_other_endo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
|
||||
int prev_var = -1;
|
||||
int prev_lag = -999999999;
|
||||
|
@ -1137,7 +1137,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
|
|||
unsigned int count_col_det_exo = 0;
|
||||
vector<unsigned int> exo_det;
|
||||
for (const auto & it : exo_det_block[block])
|
||||
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
{
|
||||
count_col_det_exo++;
|
||||
if (find(exo_det.begin(), exo_det.end(), *it1) == exo_det.end())
|
||||
|
@ -1147,7 +1147,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
|
|||
unsigned int count_col_exo = 0;
|
||||
vector<unsigned int> exo;
|
||||
for (const auto & it : exo_block[block])
|
||||
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
{
|
||||
count_col_exo++;
|
||||
if (find(exo.begin(), exo.end(), *it1) == exo.end())
|
||||
|
@ -1157,7 +1157,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
|
|||
vector<unsigned int> other_endo;
|
||||
unsigned int count_col_other_endo = 0;
|
||||
for (const auto & it : other_endo_block[block])
|
||||
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
{
|
||||
count_col_other_endo++;
|
||||
if (find(other_endo.begin(), other_endo.end(), *it1) == other_endo.end())
|
||||
|
@ -1316,7 +1316,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
|
|||
case SOLVE_TWO_BOUNDARIES_COMPLETE:
|
||||
case SOLVE_TWO_BOUNDARIES_SIMPLE:
|
||||
count_u = feedback_variables.size();
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
{
|
||||
int lag = it->second.first;
|
||||
unsigned int eq = it->first.first;
|
||||
|
@ -1543,7 +1543,7 @@ DynamicModel::writeVarExpectationCalls(ostream &output) const
|
|||
output << "dynamic_var_forecast_" << it.first << " = "
|
||||
<< "var_forecast_" << it.first << "(y);" << endl;
|
||||
|
||||
for (set<int>::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
output << "dynamic_var_forecast_" << it.first << "_" << *it1 << " = "
|
||||
<< "dynamic_var_forecast_" << it.first << "(" << ++i << ", :);" << endl;
|
||||
}
|
||||
|
@ -1710,7 +1710,7 @@ DynamicModel::printNonZeroHessianEquations(ostream &output) const
|
|||
{
|
||||
if (nonzero_hessian_eqs.size() != 1)
|
||||
output << "[";
|
||||
for (map<int, string>::const_iterator it = nonzero_hessian_eqs.begin();
|
||||
for (auto it = nonzero_hessian_eqs.begin();
|
||||
it != nonzero_hessian_eqs.end(); it++)
|
||||
{
|
||||
if (it != nonzero_hessian_eqs.begin())
|
||||
|
@ -1759,7 +1759,7 @@ DynamicModel::Write_Inf_To_Bin_File_Block(const string &dynamic_basename, const
|
|||
unsigned int block_size = getBlockSize(num);
|
||||
unsigned int block_mfs = getBlockMfs(num);
|
||||
unsigned int block_recursive = block_size - block_mfs;
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[num].begin(); it != (blocks_derivatives[num]).end(); it++)
|
||||
for (auto it = blocks_derivatives[num].begin(); it != (blocks_derivatives[num]).end(); it++)
|
||||
{
|
||||
unsigned int eq = it->first.first;
|
||||
unsigned int var = it->first.second;
|
||||
|
@ -3018,17 +3018,17 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
|
|||
set<int> exogenous;
|
||||
exogenous.clear();
|
||||
for (const auto & it : exo_block[block])
|
||||
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
exogenous.insert(*it1);
|
||||
set<int> exogenous_det;
|
||||
exogenous_det.clear();
|
||||
for (const auto & it : exo_det_block[block])
|
||||
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
exogenous_det.insert(*it1);
|
||||
set<int> other_endogenous;
|
||||
other_endogenous.clear();
|
||||
for (const auto & it : other_endo_block[block])
|
||||
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
|
||||
other_endogenous.insert(*it1);
|
||||
output << "block_structure.block(" << block+1 << ").Simulation_Type = " << simulation_type << ";\n";
|
||||
output << "block_structure.block(" << block+1 << ").maximum_lag = " << max_lag << ";\n";
|
||||
|
@ -3195,7 +3195,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
|
|||
for (int i = 0; i < block_size; i++)
|
||||
{
|
||||
unsigned int eq = getBlockEquationID(block, i);
|
||||
derivative_t::const_iterator it = derivative_other_endo[block].find(make_pair(lag, make_pair(eq, other_endogenou)));
|
||||
auto it = derivative_other_endo[block].find(make_pair(lag, make_pair(eq, other_endogenou)));
|
||||
if (it != derivative_other_endo[block].end())
|
||||
{
|
||||
count_lead_lag_incidence++;
|
||||
|
@ -3297,7 +3297,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
|
|||
if (block == 0)
|
||||
{
|
||||
set<pair<int, int> > row_state_var_incidence;
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
{
|
||||
vector<int>::const_iterator it_state_var = find(state_var.begin(), state_var.end(), getBlockVariableID(block, it->first.second)+1);
|
||||
if (it_state_var != state_var.end())
|
||||
|
@ -3319,7 +3319,7 @@ 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()));
|
||||
}
|
||||
}*/
|
||||
set<pair<int, int> >::const_iterator row_state_var_incidence_it = row_state_var_incidence.begin();
|
||||
auto row_state_var_incidence_it = row_state_var_incidence.begin();
|
||||
bool diag = true;
|
||||
int nb_diag_r = 0;
|
||||
while (row_state_var_incidence_it != row_state_var_incidence.end() && diag)
|
||||
|
@ -3337,7 +3337,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
|
|||
set<pair<int, int> > col_state_var_incidence;
|
||||
for (const auto & row_state_var_incidence_it : row_state_var_incidence)
|
||||
col_state_var_incidence.insert(make_pair(row_state_var_incidence_it.second, row_state_var_incidence_it.first));
|
||||
set<pair<int, int> >::const_iterator col_state_var_incidence_it = col_state_var_incidence.begin();
|
||||
auto col_state_var_incidence_it = col_state_var_incidence.begin();
|
||||
diag = true;
|
||||
int nb_diag_c = 0;
|
||||
while (col_state_var_incidence_it != col_state_var_incidence.end() && diag)
|
||||
|
@ -3537,7 +3537,7 @@ DynamicModel::getVarModelVariablesFromEqTags(vector<string> &var_model_eqtags,
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
set<pair<int, int> >::const_iterator it = lhs_set.begin();
|
||||
auto it = lhs_set.begin();
|
||||
if (it->second != 0)
|
||||
{
|
||||
cerr << "ERROR: in Equation " << eqtag
|
||||
|
@ -3836,7 +3836,7 @@ DynamicModel::substitutePacExpectation()
|
|||
|
||||
for (auto & equation : equations)
|
||||
{
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->substitutePacExpectation(subst_table));
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->substitutePacExpectation(subst_table));
|
||||
assert(substeq != NULL);
|
||||
equation = substeq;
|
||||
}
|
||||
|
@ -4007,7 +4007,7 @@ DynamicModel::writeXrefs(ostream &output) const
|
|||
<< "M_.xref1.exo = cell(1, M_.eq_nbr);" << endl
|
||||
<< "M_.xref1.exo_det = cell(1, M_.eq_nbr);" << endl;
|
||||
int i = 1;
|
||||
for (map<int, ExprNode::EquationInfo>::const_iterator it = xrefs.begin();
|
||||
for (auto it = xrefs.begin();
|
||||
it != xrefs.end(); it++, i++)
|
||||
{
|
||||
output << "M_.xref1.param{" << i << "} = [ ";
|
||||
|
@ -4054,7 +4054,7 @@ DynamicModel::writeRevXrefs(ostream &output, const map<pair<int, int>, set<int>
|
|||
else
|
||||
last_tsid = tsid;
|
||||
|
||||
for (set<int>::const_iterator it1 = it.second.begin();
|
||||
for (auto it1 = it.second.begin();
|
||||
it1 != it.second.end(); it1++)
|
||||
if (type == "param")
|
||||
output << *it1 + 1 << " ";
|
||||
|
@ -4244,7 +4244,7 @@ DynamicModel::collect_block_first_order_derivatives()
|
|||
block_other_endo_index[block_eq][var] = 0;
|
||||
else
|
||||
{
|
||||
map<int, int>::const_iterator it1 = it->second.find(var);
|
||||
auto it1 = it->second.find(var);
|
||||
if (it1 == it->second.end())
|
||||
{
|
||||
int size = block_other_endo_index[block_eq].size();
|
||||
|
@ -4273,7 +4273,7 @@ DynamicModel::collect_block_first_order_derivatives()
|
|||
block_exo_index[block_eq][var] = 0;
|
||||
else
|
||||
{
|
||||
map<int, int>::const_iterator it1 = it->second.find(var);
|
||||
auto it1 = it->second.find(var);
|
||||
if (it1 == it->second.end())
|
||||
{
|
||||
int size = block_exo_index[block_eq].size();
|
||||
|
@ -4301,7 +4301,7 @@ DynamicModel::collect_block_first_order_derivatives()
|
|||
block_det_exo_index[block_eq][var] = 0;
|
||||
else
|
||||
{
|
||||
map<int, int>::const_iterator it1 = it->second.find(var);
|
||||
auto it1 = it->second.find(var);
|
||||
if (it1 == it->second.end())
|
||||
{
|
||||
int size = block_det_exo_index[block_eq].size();
|
||||
|
@ -4506,7 +4506,7 @@ DynamicModel::computeRamseyPolicyFOCs(const StaticModel &static_model, const boo
|
|||
int i;
|
||||
for (i = 0; i < (int) equations.size(); i++)
|
||||
{
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->addMultipliersToConstraints(i));
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->addMultipliersToConstraints(i));
|
||||
assert(substeq != NULL);
|
||||
equations[i] = substeq;
|
||||
}
|
||||
|
@ -4802,7 +4802,7 @@ DynamicModel::getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDExcept
|
|||
int
|
||||
DynamicModel::getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException)
|
||||
{
|
||||
deriv_id_table_t::const_iterator it = deriv_id_table.find(make_pair(symb_id, lag));
|
||||
auto it = deriv_id_table.find(make_pair(symb_id, lag));
|
||||
if (it == deriv_id_table.end())
|
||||
throw UnknownDerivIDException();
|
||||
else
|
||||
|
@ -4874,7 +4874,7 @@ DynamicModel::computeDynJacobianCols(bool jacobianExo)
|
|||
int
|
||||
DynamicModel::getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException)
|
||||
{
|
||||
map<int, int>::const_iterator it = dyn_jacobian_cols_table.find(deriv_id);
|
||||
auto it = dyn_jacobian_cols_table.find(deriv_id);
|
||||
if (it == dyn_jacobian_cols_table.end())
|
||||
throw UnknownDerivIDException();
|
||||
else
|
||||
|
@ -4970,7 +4970,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
|||
}
|
||||
|
||||
int i = 1;
|
||||
for (second_derivatives_t::const_iterator it = residuals_params_second_derivatives.begin();
|
||||
for (auto it = residuals_params_second_derivatives.begin();
|
||||
it != residuals_params_second_derivatives.end(); ++it, i++)
|
||||
{
|
||||
int eq = it->first.first;
|
||||
|
@ -4994,7 +4994,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
|||
}
|
||||
|
||||
i = 1;
|
||||
for (third_derivatives_t::const_iterator it = jacobian_params_second_derivatives.begin();
|
||||
for (auto it = jacobian_params_second_derivatives.begin();
|
||||
it != jacobian_params_second_derivatives.end(); ++it, i++)
|
||||
{
|
||||
int eq = it->first.first;
|
||||
|
@ -5022,7 +5022,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
|||
}
|
||||
|
||||
i = 1;
|
||||
for (third_derivatives_t::const_iterator it = hessian_params_derivatives.begin();
|
||||
for (auto it = hessian_params_derivatives.begin();
|
||||
it != hessian_params_derivatives.end(); ++it, i++)
|
||||
{
|
||||
int eq = it->first.first;
|
||||
|
@ -5263,7 +5263,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
|
|||
cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(subst);
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(subst);
|
||||
assert(substeq != NULL);
|
||||
equation = substeq;
|
||||
}
|
||||
|
@ -5296,7 +5296,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
|
|||
cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(subst);
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(subst);
|
||||
assert(substeq != NULL);
|
||||
aux_equation = substeq;
|
||||
}
|
||||
|
@ -5329,7 +5329,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
|
|||
cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(subst);
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(subst);
|
||||
assert(substeq != NULL);
|
||||
diff_aux_equation = substeq;
|
||||
}
|
||||
|
@ -5402,7 +5402,7 @@ DynamicModel::substituteUnaryOps(StaticModel &static_model)
|
|||
// Substitute in equations
|
||||
for (auto & equation : equations)
|
||||
{
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->
|
||||
substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs));
|
||||
assert(substeq != NULL);
|
||||
equation = substeq;
|
||||
|
@ -5437,7 +5437,7 @@ DynamicModel::substituteDiff(StaticModel &static_model, ExprNode::subst_table_t
|
|||
// Substitute in equations
|
||||
for (auto & equation : equations)
|
||||
{
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->
|
||||
substituteDiff(static_model, diff_table, diff_subst_table, neweqs));
|
||||
assert(substeq != NULL);
|
||||
equation = substeq;
|
||||
|
@ -5472,7 +5472,7 @@ DynamicModel::substituteExpectation(bool partial_information_model)
|
|||
// Substitute in equations
|
||||
for (auto & equation : equations)
|
||||
{
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->substituteExpectation(subst_table, neweqs, partial_information_model));
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->substituteExpectation(subst_table, neweqs, partial_information_model));
|
||||
assert(substeq != NULL);
|
||||
equation = substeq;
|
||||
}
|
||||
|
@ -5501,7 +5501,7 @@ DynamicModel::transformPredeterminedVariables()
|
|||
|
||||
for (auto & equation : equations)
|
||||
{
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->decreaseLeadsLagsPredeterminedVariables());
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->decreaseLeadsLagsPredeterminedVariables());
|
||||
assert(substeq != NULL);
|
||||
equation = substeq;
|
||||
}
|
||||
|
@ -5515,7 +5515,7 @@ DynamicModel::detrendEquations()
|
|||
it != nonstationary_symbols_map.rend(); ++it)
|
||||
for (auto & equation : equations)
|
||||
{
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->detrend(it->first, it->second.first, it->second.second));
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->detrend(it->first, it->second.first, it->second.second));
|
||||
assert(substeq != NULL);
|
||||
equation = dynamic_cast<BinaryOpNode *>(substeq);
|
||||
}
|
||||
|
@ -5533,7 +5533,7 @@ DynamicModel::removeTrendVariableFromEquations()
|
|||
{
|
||||
for (auto & equation : equations)
|
||||
{
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->replaceTrendVar());
|
||||
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->replaceTrendVar());
|
||||
assert(substeq != NULL);
|
||||
equation = dynamic_cast<BinaryOpNode *>(substeq);
|
||||
}
|
||||
|
@ -5552,7 +5552,7 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const
|
|||
for (auto aux_equation : aux_equations)
|
||||
{
|
||||
assert(aux_equation->get_op_code() == oEqual);
|
||||
VariableNode *auxvar = dynamic_cast<VariableNode *>(aux_equation->get_arg1());
|
||||
auto *auxvar = dynamic_cast<VariableNode *>(aux_equation->get_arg1());
|
||||
assert(auxvar != NULL);
|
||||
try
|
||||
{
|
||||
|
@ -5603,7 +5603,7 @@ DynamicModel::isModelLocalVariableUsed() const
|
|||
void
|
||||
DynamicModel::addStaticOnlyEquation(expr_t eq, int lineno, const vector<pair<string, string> > &eq_tags)
|
||||
{
|
||||
BinaryOpNode *beq = dynamic_cast<BinaryOpNode *>(eq);
|
||||
auto *beq = dynamic_cast<BinaryOpNode *>(eq);
|
||||
assert(beq != NULL && beq->get_op_code() == oEqual);
|
||||
|
||||
vector<pair<string, string> > soe_eq_tags;
|
||||
|
@ -5785,7 +5785,7 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
|
|||
<< "size_t nback = " << zeta_back.size() << ";" << endl
|
||||
<< "size_t nmixed = " << zeta_mixed.size() << ";" << endl;
|
||||
output << "size_t zeta_static[" << zeta_static.size() << "] = {";
|
||||
for (vector<int>::iterator i = zeta_static.begin(); i != zeta_static.end(); ++i)
|
||||
for (auto i = zeta_static.begin(); i != zeta_static.end(); ++i)
|
||||
{
|
||||
if (i != zeta_static.begin())
|
||||
output << ",";
|
||||
|
@ -5794,7 +5794,7 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
|
|||
output << "};" << endl;
|
||||
|
||||
output << "size_t zeta_back[" << zeta_back.size() << "] = {";
|
||||
for (vector<int>::iterator i = zeta_back.begin(); i != zeta_back.end(); ++i)
|
||||
for (auto i = zeta_back.begin(); i != zeta_back.end(); ++i)
|
||||
{
|
||||
if (i != zeta_back.begin())
|
||||
output << ",";
|
||||
|
@ -5803,7 +5803,7 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
|
|||
output << "};" << endl;
|
||||
|
||||
output << "size_t zeta_fwrd[" << zeta_fwrd.size() << "] = {";
|
||||
for (vector<int>::iterator i = zeta_fwrd.begin(); i != zeta_fwrd.end(); ++i)
|
||||
for (auto i = zeta_fwrd.begin(); i != zeta_fwrd.end(); ++i)
|
||||
{
|
||||
if (i != zeta_fwrd.begin())
|
||||
output << ",";
|
||||
|
@ -5812,7 +5812,7 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
|
|||
output << "};" << endl;
|
||||
|
||||
output << "size_t zeta_mixed[" << zeta_mixed.size() << "] = {";
|
||||
for (vector<int>::iterator i = zeta_mixed.begin(); i != zeta_mixed.end(); ++i)
|
||||
for (auto i = zeta_mixed.begin(); i != zeta_mixed.end(); ++i)
|
||||
{
|
||||
if (i != zeta_mixed.begin())
|
||||
output << ",";
|
||||
|
@ -6343,7 +6343,7 @@ DynamicModel::writeJsonOutput(ostream &output) const
|
|||
void
|
||||
DynamicModel::writeJsonXrefsHelper(ostream &output, const map<pair<int, int>, set<int> > &xrefs) const
|
||||
{
|
||||
for (map<pair<int, int>, set<int> >::const_iterator it = xrefs.begin();
|
||||
for (auto it = xrefs.begin();
|
||||
it != xrefs.end(); it++)
|
||||
{
|
||||
if (it != xrefs.begin())
|
||||
|
@ -6351,7 +6351,7 @@ DynamicModel::writeJsonXrefsHelper(ostream &output, const map<pair<int, int>, se
|
|||
output << "{\"name\": \"" << symbol_table.getName(it->first.first) << "\""
|
||||
<< ", \"shift\": " << it->first.second
|
||||
<< ", \"equations\": [";
|
||||
for (set<int>::const_iterator it1 = it->second.begin();
|
||||
for (auto it1 = it->second.begin();
|
||||
it1 != it->second.end(); it1++)
|
||||
{
|
||||
if (it1 != it->second.begin())
|
||||
|
@ -6488,7 +6488,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
|
|||
<< " \"nrows\": " << equations.size()
|
||||
<< ", \"ncols\": " << dynJacobianColsNbr
|
||||
<< ", \"entries\": [";
|
||||
for (first_derivatives_t::const_iterator it = first_derivatives.begin();
|
||||
for (auto it = first_derivatives.begin();
|
||||
it != first_derivatives.end(); it++)
|
||||
{
|
||||
if (it != first_derivatives.begin())
|
||||
|
@ -6525,7 +6525,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
|
|||
<< " \"nrows\": " << equations.size()
|
||||
<< ", \"ncols\": " << hessianColsNbr
|
||||
<< ", \"entries\": [";
|
||||
for (second_derivatives_t::const_iterator it = second_derivatives.begin();
|
||||
for (auto it = second_derivatives.begin();
|
||||
it != second_derivatives.end(); it++)
|
||||
{
|
||||
if (it != second_derivatives.begin())
|
||||
|
@ -6571,7 +6571,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
|
|||
<< " \"nrows\": " << equations.size()
|
||||
<< ", \"ncols\": " << hessianColsNbr * dynJacobianColsNbr
|
||||
<< ", \"entries\": [";
|
||||
for (third_derivatives_t::const_iterator it = third_derivatives.begin();
|
||||
for (auto it = third_derivatives.begin();
|
||||
it != third_derivatives.end(); it++)
|
||||
{
|
||||
if (it != third_derivatives.begin())
|
||||
|
@ -6600,7 +6600,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
|
|||
cols.insert(id3 * hessianColsNbr + id2 * dynJacobianColsNbr + id1);
|
||||
|
||||
third_derivatives_output << ", \"col\": [";
|
||||
for (set<int>::iterator it2 = cols.begin(); it2 != cols.end(); it2++)
|
||||
for (auto it2 = cols.begin(); it2 != cols.end(); it2++)
|
||||
{
|
||||
if (it2 != cols.begin())
|
||||
third_derivatives_output << ", ";
|
||||
|
@ -6662,7 +6662,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< " \"neqs\": " << equations.size()
|
||||
<< ", \"nparamcols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (first_derivatives_t::const_iterator it = residuals_params_derivatives.begin();
|
||||
for (auto it = residuals_params_derivatives.begin();
|
||||
it != residuals_params_derivatives.end(); it++)
|
||||
{
|
||||
if (it != residuals_params_derivatives.begin())
|
||||
|
@ -6694,7 +6694,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< ", \"nvarcols\": " << dynJacobianColsNbr
|
||||
<< ", \"nparamcols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (second_derivatives_t::const_iterator it = jacobian_params_derivatives.begin();
|
||||
for (auto it = jacobian_params_derivatives.begin();
|
||||
it != jacobian_params_derivatives.end(); it++)
|
||||
{
|
||||
if (it != jacobian_params_derivatives.begin())
|
||||
|
@ -6732,7 +6732,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< ", \"nparam1cols\": " << symbol_table.param_nbr()
|
||||
<< ", \"nparam2cols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (second_derivatives_t::const_iterator it = residuals_params_second_derivatives.begin();
|
||||
for (auto it = residuals_params_second_derivatives.begin();
|
||||
it != residuals_params_second_derivatives.end(); ++it)
|
||||
{
|
||||
if (it != residuals_params_second_derivatives.begin())
|
||||
|
@ -6768,7 +6768,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< ", \"nparam1cols\": " << symbol_table.param_nbr()
|
||||
<< ", \"nparam2cols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (third_derivatives_t::const_iterator it = jacobian_params_second_derivatives.begin();
|
||||
for (auto it = jacobian_params_second_derivatives.begin();
|
||||
it != jacobian_params_second_derivatives.end(); ++it)
|
||||
{
|
||||
if (it != jacobian_params_second_derivatives.begin())
|
||||
|
@ -6811,7 +6811,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< ", \"nvar2cols\": " << dynJacobianColsNbr
|
||||
<< ", \"nparamcols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (third_derivatives_t::const_iterator it = hessian_params_derivatives.begin();
|
||||
for (auto it = hessian_params_derivatives.begin();
|
||||
it != hessian_params_derivatives.end(); ++it)
|
||||
{
|
||||
if (it != hessian_params_derivatives.begin())
|
||||
|
|
|
@ -543,7 +543,7 @@ public:
|
|||
virtual int
|
||||
getBlockVariableExoID(int block_number, int variable_number) const
|
||||
{
|
||||
map<int, var_t>::const_iterator it = exo_block[block_number].find(variable_number);
|
||||
auto it = exo_block[block_number].find(variable_number);
|
||||
return (it->first);
|
||||
};
|
||||
//! Return the position of equation_number in the block number belonging to the block block_number
|
||||
|
@ -568,10 +568,10 @@ public:
|
|||
virtual int
|
||||
getBlockInitialExogenousID(int block_number, int variable_number) const
|
||||
{
|
||||
map< int, map<int, int> >::const_iterator it = block_exo_index.find(block_number);
|
||||
auto it = block_exo_index.find(block_number);
|
||||
if (it != block_exo_index.end())
|
||||
{
|
||||
map<int, int>::const_iterator it1 = it->second.find(variable_number);
|
||||
auto it1 = it->second.find(variable_number);
|
||||
if (it1 != it->second.end())
|
||||
return it1->second;
|
||||
else
|
||||
|
@ -584,10 +584,10 @@ public:
|
|||
virtual int
|
||||
getBlockInitialDetExogenousID(int block_number, int variable_number) const
|
||||
{
|
||||
map< int, map<int, int> >::const_iterator it = block_det_exo_index.find(block_number);
|
||||
auto it = block_det_exo_index.find(block_number);
|
||||
if (it != block_det_exo_index.end())
|
||||
{
|
||||
map<int, int>::const_iterator it1 = it->second.find(variable_number);
|
||||
auto it1 = it->second.find(variable_number);
|
||||
if (it1 != it->second.end())
|
||||
return it1->second;
|
||||
else
|
||||
|
@ -600,10 +600,10 @@ public:
|
|||
virtual int
|
||||
getBlockInitialOtherEndogenousID(int block_number, int variable_number) const
|
||||
{
|
||||
map< int, map<int, int> >::const_iterator it = block_other_endo_index.find(block_number);
|
||||
auto it = block_other_endo_index.find(block_number);
|
||||
if (it != block_other_endo_index.end())
|
||||
{
|
||||
map<int, int>::const_iterator it1 = it->second.find(variable_number);
|
||||
auto it1 = it->second.find(variable_number);
|
||||
if (it1 != it->second.end())
|
||||
return it1->second;
|
||||
else
|
||||
|
|
164
src/ExprNode.cc
164
src/ExprNode.cc
|
@ -51,7 +51,7 @@ ExprNode::getDerivative(int deriv_id)
|
|||
prepareForDerivation();
|
||||
|
||||
// Return zero if derivative is necessarily null (using symbolic a priori)
|
||||
set<int>::const_iterator it = non_null_derivatives.find(deriv_id);
|
||||
auto it = non_null_derivatives.find(deriv_id);
|
||||
if (it == non_null_derivatives.end())
|
||||
return datatree.Zero;
|
||||
|
||||
|
@ -353,7 +353,7 @@ NumConstNode::computeDerivative(int deriv_id)
|
|||
void
|
||||
NumConstNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<NumConstNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<NumConstNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
temporary_terms_inuse.insert(idx);
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ VariableNode::computeDerivative(int deriv_id)
|
|||
void
|
||||
VariableNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VariableNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<VariableNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
temporary_terms_inuse.insert(idx);
|
||||
if (type == eModelLocalVariable)
|
||||
|
@ -778,7 +778,7 @@ VariableNode::writeJsonOutput(ostream &output,
|
|||
const deriv_node_temp_terms_t &tef_terms,
|
||||
const bool isdynamic) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VariableNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<VariableNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
output << "T" << idx;
|
||||
|
@ -1052,7 +1052,7 @@ VariableNode::substituteStaticAuxiliaryVariable() const
|
|||
double
|
||||
VariableNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException)
|
||||
{
|
||||
eval_context_t::const_iterator it = eval_context.find(symb_id);
|
||||
auto it = eval_context.find(symb_id);
|
||||
if (it == eval_context.end())
|
||||
throw EvalException();
|
||||
|
||||
|
@ -1214,7 +1214,7 @@ VariableNode::getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recur
|
|||
else
|
||||
{
|
||||
//if there is in the equation a recursive variable we could use a chaine rule derivation
|
||||
map<int, expr_t>::const_iterator it = recursive_variables.find(datatree.getDerivID(symb_id, lag));
|
||||
auto it = recursive_variables.find(datatree.getDerivID(symb_id, lag));
|
||||
if (it != recursive_variables.end())
|
||||
{
|
||||
map<int, expr_t>::const_iterator it2 = derivatives.find(deriv_id);
|
||||
|
@ -1649,7 +1649,7 @@ VariableNode::differentiateForwardVars(const vector<string> &subset, subst_table
|
|||
return const_cast<VariableNode *>(this);
|
||||
else
|
||||
{
|
||||
subst_table_t::iterator it = subst_table.find(this);
|
||||
auto it = subst_table.find(this);
|
||||
VariableNode *diffvar;
|
||||
if (it != subst_table.end())
|
||||
diffvar = const_cast<VariableNode *>(it->second);
|
||||
|
@ -1939,7 +1939,7 @@ UnaryOpNode::composeDerivatives(expr_t darg, int deriv_id)
|
|||
{
|
||||
if (datatree.getTypeByDerivID(deriv_id) == eParameter)
|
||||
{
|
||||
VariableNode *varg = dynamic_cast<VariableNode *>(arg);
|
||||
auto *varg = dynamic_cast<VariableNode *>(arg);
|
||||
if (varg == NULL)
|
||||
{
|
||||
cerr << "UnaryOpNode::composeDerivatives: STEADY_STATE() should only be used on "
|
||||
|
@ -1960,7 +1960,7 @@ UnaryOpNode::composeDerivatives(expr_t darg, int deriv_id)
|
|||
assert(datatree.isDynamic());
|
||||
if (datatree.getTypeByDerivID(deriv_id) == eParameter)
|
||||
{
|
||||
VariableNode *varg = dynamic_cast<VariableNode *>(arg);
|
||||
auto *varg = dynamic_cast<VariableNode *>(arg);
|
||||
assert(varg != NULL);
|
||||
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
|
||||
return datatree.AddSteadyStateParam2ndDeriv(arg, param1_symb_id, datatree.getSymbIDByDerivID(deriv_id));
|
||||
|
@ -2143,7 +2143,7 @@ UnaryOpNode::computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &r
|
|||
{
|
||||
expr_t this2 = const_cast<UnaryOpNode *>(this);
|
||||
|
||||
map<expr_t, pair<int, NodeTreeReference > >::iterator it = reference_count.find(this2);
|
||||
auto it = reference_count.find(this2);
|
||||
if (it == reference_count.end())
|
||||
{
|
||||
reference_count[this2] = make_pair(1, tr);
|
||||
|
@ -2166,7 +2166,7 @@ UnaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count,
|
|||
int equation) const
|
||||
{
|
||||
expr_t this2 = const_cast<UnaryOpNode *>(this);
|
||||
map<expr_t, int>::iterator it = reference_count.find(this2);
|
||||
auto it = reference_count.find(this2);
|
||||
if (it == reference_count.end())
|
||||
{
|
||||
reference_count[this2] = 1;
|
||||
|
@ -2187,7 +2187,7 @@ UnaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count,
|
|||
void
|
||||
UnaryOpNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
temporary_terms_inuse.insert(idx);
|
||||
else
|
||||
|
@ -2206,7 +2206,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
|
|||
const deriv_node_temp_terms_t &tef_terms,
|
||||
const bool isdynamic) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
output << "T" << idx;
|
||||
|
@ -2283,7 +2283,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
|
|||
output << "adl(";
|
||||
arg->writeJsonOutput(output, temporary_terms, tef_terms);
|
||||
output << ", '" << adl_param_name << "', [";
|
||||
for (vector<int>::const_iterator it = adl_lags.begin(); it != adl_lags.end(); it++)
|
||||
for (auto it = adl_lags.begin(); it != adl_lags.end(); it++)
|
||||
{
|
||||
if (it != adl_lags.begin())
|
||||
output << ", ";
|
||||
|
@ -2298,7 +2298,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
|
|||
return;
|
||||
case oSteadyStateParamDeriv:
|
||||
{
|
||||
VariableNode *varg = dynamic_cast<VariableNode *>(arg);
|
||||
auto *varg = dynamic_cast<VariableNode *>(arg);
|
||||
assert(varg != NULL);
|
||||
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
|
||||
assert(datatree.symbol_table.getType(param1_symb_id) == eParameter);
|
||||
|
@ -2309,7 +2309,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
|
|||
return;
|
||||
case oSteadyStateParam2ndDeriv:
|
||||
{
|
||||
VariableNode *varg = dynamic_cast<VariableNode *>(arg);
|
||||
auto *varg = dynamic_cast<VariableNode *>(arg);
|
||||
assert(varg != NULL);
|
||||
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
|
||||
assert(datatree.symbol_table.getType(param1_symb_id) == eParameter);
|
||||
|
@ -2464,7 +2464,7 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
return;
|
||||
case oSteadyStateParamDeriv:
|
||||
{
|
||||
VariableNode *varg = dynamic_cast<VariableNode *>(arg);
|
||||
auto *varg = dynamic_cast<VariableNode *>(arg);
|
||||
assert(varg != NULL);
|
||||
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
|
||||
assert(datatree.symbol_table.getType(param1_symb_id) == eParameter);
|
||||
|
@ -2476,7 +2476,7 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
return;
|
||||
case oSteadyStateParam2ndDeriv:
|
||||
{
|
||||
VariableNode *varg = dynamic_cast<VariableNode *>(arg);
|
||||
auto *varg = dynamic_cast<VariableNode *>(arg);
|
||||
assert(varg != NULL);
|
||||
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
|
||||
assert(datatree.symbol_table.getType(param1_symb_id) == eParameter);
|
||||
|
@ -2645,18 +2645,18 @@ UnaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
|||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||
const deriv_node_temp_terms_t &tef_terms) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
if (dynamic)
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDT_ fldt(ii->second);
|
||||
fldt.write(CompileCode, instruction_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDST_ fldst(ii->second);
|
||||
fldst.write(CompileCode, instruction_number);
|
||||
}
|
||||
|
@ -2966,7 +2966,7 @@ UnaryOpNode::VarMaxLag(DataTree &static_datatree, set<expr_t> &static_lhs, int &
|
|||
arg->VarMaxLag(static_datatree, static_lhs, max_lag);
|
||||
else
|
||||
{
|
||||
set<expr_t>::const_iterator it = static_lhs.find(this->toStatic(static_datatree));
|
||||
auto it = static_lhs.find(this->toStatic(static_datatree));
|
||||
if (it != static_lhs.end())
|
||||
{
|
||||
int max_lag_tmp = arg->maxLag() - arg->countDiffs();
|
||||
|
@ -3009,7 +3009,7 @@ UnaryOpNode::substituteAdl() const
|
|||
expr_t retval = NULL;
|
||||
ostringstream inttostr;
|
||||
|
||||
for (vector<int>::const_iterator it = adl_lags.begin(); it != adl_lags.end(); it++)
|
||||
for (auto it = adl_lags.begin(); it != adl_lags.end(); it++)
|
||||
if (it == adl_lags.begin())
|
||||
{
|
||||
inttostr << *it;
|
||||
|
@ -3078,7 +3078,7 @@ UnaryOpNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, diff_t
|
|||
|
||||
expr_t sthis = this->toStatic(static_datatree);
|
||||
int arg_max_lag = -arg->maxLag();
|
||||
diff_table_t::iterator it = nodes.find(sthis);
|
||||
auto it = nodes.find(sthis);
|
||||
if (it != nodes.end())
|
||||
{
|
||||
for (map<int, expr_t>::const_iterator it1 = it->second.begin();
|
||||
|
@ -3101,7 +3101,7 @@ UnaryOpNode::findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table)
|
|||
|
||||
expr_t sthis = this->toStatic(static_datatree);
|
||||
int arg_max_lag = -arg->maxLag();
|
||||
diff_table_t::iterator it = diff_table.find(sthis);
|
||||
auto it = diff_table.find(sthis);
|
||||
if (it != diff_table.end())
|
||||
{
|
||||
for (map<int, expr_t>::const_iterator it1 = it->second.begin();
|
||||
|
@ -3129,7 +3129,7 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table,
|
|||
return const_cast<VariableNode *>(sit->second);
|
||||
|
||||
expr_t sthis = dynamic_cast<UnaryOpNode *>(this->toStatic(static_datatree));
|
||||
diff_table_t::iterator it = diff_table.find(sthis);
|
||||
auto it = diff_table.find(sthis);
|
||||
if (it == diff_table.end() || it->second[-arg->maxLag()] != this)
|
||||
{
|
||||
cerr << "Internal error encountered. Please report" << endl;
|
||||
|
@ -3138,13 +3138,13 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table,
|
|||
|
||||
int last_arg_max_lag = 0;
|
||||
VariableNode *last_aux_var = NULL;
|
||||
for (map<int, expr_t>::reverse_iterator rit = it->second.rbegin();
|
||||
for (auto rit = it->second.rbegin();
|
||||
rit != it->second.rend(); rit++)
|
||||
{
|
||||
expr_t argsubst = dynamic_cast<UnaryOpNode *>(rit->second)->
|
||||
get_arg()->substituteDiff(static_datatree, diff_table, subst_table, neweqs);
|
||||
int symb_id;
|
||||
VariableNode *vn = dynamic_cast<VariableNode *>(argsubst);
|
||||
auto *vn = dynamic_cast<VariableNode *>(argsubst);
|
||||
if (rit == it->second.rbegin())
|
||||
{
|
||||
if (vn != NULL)
|
||||
|
@ -3198,8 +3198,8 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
|
|||
if (sit != subst_table.end())
|
||||
return const_cast<VariableNode *>(sit->second);
|
||||
|
||||
UnaryOpNode *sthis = dynamic_cast<UnaryOpNode *>(this->toStatic(static_datatree));
|
||||
diff_table_t::iterator it = nodes.find(sthis);
|
||||
auto *sthis = dynamic_cast<UnaryOpNode *>(this->toStatic(static_datatree));
|
||||
auto it = nodes.find(sthis);
|
||||
if (it == nodes.end())
|
||||
{
|
||||
expr_t argsubst = arg->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs);
|
||||
|
@ -3207,12 +3207,12 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
|
|||
}
|
||||
|
||||
VariableNode *aux_var = NULL;
|
||||
for (map<int, expr_t>::reverse_iterator rit = it->second.rbegin();
|
||||
for (auto rit = it->second.rbegin();
|
||||
rit != it->second.rend(); rit++)
|
||||
{
|
||||
if (rit == it->second.rbegin())
|
||||
{
|
||||
VariableNode *vn = dynamic_cast<VariableNode *>(const_cast<UnaryOpNode *>(this)->get_arg());
|
||||
auto *vn = dynamic_cast<VariableNode *>(const_cast<UnaryOpNode *>(this)->get_arg());
|
||||
int symb_id = datatree.symbol_table.addUnaryOpAuxiliaryVar(this->idx, const_cast<UnaryOpNode *>(this),
|
||||
vn->get_symb_id(), vn->get_lag());
|
||||
aux_var = datatree.AddVariable(symb_id, 0);
|
||||
|
@ -3221,7 +3221,7 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
|
|||
}
|
||||
else
|
||||
{
|
||||
VariableNode *vn = dynamic_cast<VariableNode *>(dynamic_cast<UnaryOpNode *>(rit->second)->get_arg());
|
||||
auto *vn = dynamic_cast<VariableNode *>(dynamic_cast<UnaryOpNode *>(rit->second)->get_arg());
|
||||
subst_table[rit->second] = dynamic_cast<VariableNode *>(aux_var->decreaseLeadsLags(-vn->get_lag()));
|
||||
}
|
||||
}
|
||||
|
@ -3304,7 +3304,7 @@ UnaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNo
|
|||
{
|
||||
if (op_code == oExpectation)
|
||||
{
|
||||
subst_table_t::iterator it = subst_table.find(const_cast<UnaryOpNode *>(this));
|
||||
auto it = subst_table.find(const_cast<UnaryOpNode *>(this));
|
||||
if (it != subst_table.end())
|
||||
return const_cast<VariableNode *>(it->second);
|
||||
|
||||
|
@ -3636,7 +3636,7 @@ BinaryOpNode::computeDerivative(int deriv_id)
|
|||
int
|
||||
BinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
// A temporary term behaves as a variable
|
||||
if (it != temporary_terms.end())
|
||||
return 100;
|
||||
|
@ -3677,7 +3677,7 @@ BinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t
|
|||
int
|
||||
BinaryOpNode::precedenceJson(const temporary_terms_t &temporary_terms) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
// A temporary term behaves as a variable
|
||||
if (it != temporary_terms.end())
|
||||
return 100;
|
||||
|
@ -3802,7 +3802,7 @@ BinaryOpNode::computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &
|
|||
bool is_matlab, NodeTreeReference tr) const
|
||||
{
|
||||
expr_t this2 = const_cast<BinaryOpNode *>(this);
|
||||
map<expr_t, pair<int, NodeTreeReference > >::iterator it = reference_count.find(this2);
|
||||
auto it = reference_count.find(this2);
|
||||
if (it == reference_count.end())
|
||||
{
|
||||
// If this node has never been encountered, set its ref count to one,
|
||||
|
@ -3832,7 +3832,7 @@ BinaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count,
|
|||
int equation) const
|
||||
{
|
||||
expr_t this2 = const_cast<BinaryOpNode *>(this);
|
||||
map<expr_t, int>::iterator it = reference_count.find(this2);
|
||||
auto it = reference_count.find(this2);
|
||||
if (it == reference_count.end())
|
||||
{
|
||||
reference_count[this2] = 1;
|
||||
|
@ -3924,18 +3924,18 @@ BinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
|||
const deriv_node_temp_terms_t &tef_terms) const
|
||||
{
|
||||
// If current node is a temporary term
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
if (dynamic)
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDT_ fldt(ii->second);
|
||||
fldt.write(CompileCode, instruction_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDST_ fldst(ii->second);
|
||||
fldst.write(CompileCode, instruction_number);
|
||||
}
|
||||
|
@ -3955,7 +3955,7 @@ BinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
|||
void
|
||||
BinaryOpNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
temporary_terms_inuse.insert(idx);
|
||||
else
|
||||
|
@ -3979,7 +3979,7 @@ BinaryOpNode::writeJsonOutput(ostream &output,
|
|||
const bool isdynamic) const
|
||||
{
|
||||
// If current node is a temporary term
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
output << "T" << idx;
|
||||
|
@ -4022,7 +4022,7 @@ BinaryOpNode::writeJsonOutput(ostream &output,
|
|||
|
||||
// If left argument has a lower precedence, or if current and left argument are both power operators,
|
||||
// add parenthesis around left argument
|
||||
BinaryOpNode *barg1 = dynamic_cast<BinaryOpNode *>(arg1);
|
||||
auto *barg1 = dynamic_cast<BinaryOpNode *>(arg1);
|
||||
if (arg1->precedenceJson(temporary_terms) < prec
|
||||
|| (op_code == oPower && barg1 != NULL && barg1->op_code == oPower))
|
||||
{
|
||||
|
@ -4086,7 +4086,7 @@ BinaryOpNode::writeJsonOutput(ostream &output,
|
|||
- it is a power operator and current operator is also a power operator
|
||||
- it is a minus operator with same precedence than current operator
|
||||
- it is a divide operator with same precedence than current operator */
|
||||
BinaryOpNode *barg2 = dynamic_cast<BinaryOpNode *>(arg2);
|
||||
auto *barg2 = dynamic_cast<BinaryOpNode *>(arg2);
|
||||
int arg2_prec = arg2->precedenceJson(temporary_terms);
|
||||
if (arg2_prec < prec
|
||||
|| (op_code == oPower && barg2 != NULL && barg2->op_code == oPower)
|
||||
|
@ -4165,7 +4165,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
else
|
||||
{
|
||||
// If left argument has a lower precedence, or if current and left argument are both power operators, add parenthesis around left argument
|
||||
BinaryOpNode *barg1 = dynamic_cast<BinaryOpNode *>(arg1);
|
||||
auto *barg1 = dynamic_cast<BinaryOpNode *>(arg1);
|
||||
if (arg1->precedence(output_type, temporary_terms) < prec
|
||||
|| (op_code == oPower && barg1 != NULL && barg1->op_code == oPower))
|
||||
{
|
||||
|
@ -4255,7 +4255,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
- it is a power operator and current operator is also a power operator
|
||||
- it is a minus operator with same precedence than current operator
|
||||
- it is a divide operator with same precedence than current operator */
|
||||
BinaryOpNode *barg2 = dynamic_cast<BinaryOpNode *>(arg2);
|
||||
auto *barg2 = dynamic_cast<BinaryOpNode *>(arg2);
|
||||
int arg2_prec = arg2->precedence(output_type, temporary_terms);
|
||||
if (arg2_prec < prec
|
||||
|| (op_code == oPower && barg2 != NULL && barg2->op_code == oPower && !IS_LATEX(output_type))
|
||||
|
@ -5030,11 +5030,11 @@ BinaryOpNode::walkPacParametersHelper(const expr_t arg1, const expr_t arg2,
|
|||
ar_params_and_vars.insert(make_pair(*(params.begin()), *(endogs.begin())));
|
||||
else if (endogs.size() >= 2)
|
||||
{
|
||||
BinaryOpNode *testarg2 = dynamic_cast<BinaryOpNode *>(arg2);
|
||||
auto *testarg2 = dynamic_cast<BinaryOpNode *>(arg2);
|
||||
if (testarg2 != NULL && testarg2->get_op_code() == oMinus)
|
||||
{
|
||||
VariableNode *test_arg1 = dynamic_cast<VariableNode *>(testarg2->get_arg1());
|
||||
VariableNode *test_arg2 = dynamic_cast<VariableNode *>(testarg2->get_arg2());
|
||||
auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->get_arg1());
|
||||
auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->get_arg2());
|
||||
if (test_arg1 != NULL && test_arg2 != NULL && lhs.first != -1)
|
||||
{
|
||||
test_arg1->collectDynamicVariables(eEndogenous, endogs);
|
||||
|
@ -5232,7 +5232,7 @@ TrinaryOpNode::computeDerivative(int deriv_id)
|
|||
int
|
||||
TrinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||
// A temporary term behaves as a variable
|
||||
if (it != temporary_terms.end())
|
||||
return 100;
|
||||
|
@ -5305,7 +5305,7 @@ TrinaryOpNode::computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> >
|
|||
bool is_matlab, NodeTreeReference tr) const
|
||||
{
|
||||
expr_t this2 = const_cast<TrinaryOpNode *>(this);
|
||||
map<expr_t, pair<int, NodeTreeReference > >::iterator it = reference_count.find(this2);
|
||||
auto it = reference_count.find(this2);
|
||||
if (it == reference_count.end())
|
||||
{
|
||||
// If this node has never been encountered, set its ref count to one,
|
||||
|
@ -5334,7 +5334,7 @@ TrinaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count,
|
|||
int equation) const
|
||||
{
|
||||
expr_t this2 = const_cast<TrinaryOpNode *>(this);
|
||||
map<expr_t, int>::iterator it = reference_count.find(this2);
|
||||
auto it = reference_count.find(this2);
|
||||
if (it == reference_count.end())
|
||||
{
|
||||
reference_count[this2] = 1;
|
||||
|
@ -5385,18 +5385,18 @@ TrinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
|||
const deriv_node_temp_terms_t &tef_terms) const
|
||||
{
|
||||
// If current node is a temporary term
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
if (dynamic)
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDT_ fldt(ii->second);
|
||||
fldt.write(CompileCode, instruction_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDST_ fldst(ii->second);
|
||||
fldst.write(CompileCode, instruction_number);
|
||||
}
|
||||
|
@ -5412,7 +5412,7 @@ TrinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
|||
void
|
||||
TrinaryOpNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
temporary_terms_inuse.insert(idx);
|
||||
else
|
||||
|
@ -5438,7 +5438,7 @@ TrinaryOpNode::writeJsonOutput(ostream &output,
|
|||
const bool isdynamic) const
|
||||
{
|
||||
// If current node is a temporary term
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
output << "T" << idx;
|
||||
|
@ -6045,7 +6045,7 @@ AbstractExternalFunctionNode::collectDynamicVariables(SymbolType type_arg, set<p
|
|||
void
|
||||
AbstractExternalFunctionNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<AbstractExternalFunctionNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<AbstractExternalFunctionNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
temporary_terms_inuse.insert(idx);
|
||||
else
|
||||
|
@ -6284,7 +6284,7 @@ AbstractExternalFunctionNode::differentiateForwardVars(const vector<string> &sub
|
|||
bool
|
||||
AbstractExternalFunctionNode::alreadyWrittenAsTefTerm(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const
|
||||
{
|
||||
deriv_node_temp_terms_t::const_iterator it = tef_terms.find(make_pair(the_symb_id, arguments));
|
||||
auto it = tef_terms.find(make_pair(the_symb_id, arguments));
|
||||
if (it != tef_terms.end())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -6293,7 +6293,7 @@ AbstractExternalFunctionNode::alreadyWrittenAsTefTerm(int the_symb_id, const der
|
|||
int
|
||||
AbstractExternalFunctionNode::getIndxInTefTerms(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const throw (UnknownFunctionNameAndArgs)
|
||||
{
|
||||
deriv_node_temp_terms_t::const_iterator it = tef_terms.find(make_pair(the_symb_id, arguments));
|
||||
auto it = tef_terms.find(make_pair(the_symb_id, arguments));
|
||||
if (it != tef_terms.end())
|
||||
return it->second;
|
||||
throw UnknownFunctionNameAndArgs();
|
||||
|
@ -6463,7 +6463,7 @@ AbstractExternalFunctionNode::writeExternalFunctionArguments(ostream &output, Ex
|
|||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||
const deriv_node_temp_terms_t &tef_terms) const
|
||||
{
|
||||
for (vector<expr_t>::const_iterator it = arguments.begin();
|
||||
for (auto it = arguments.begin();
|
||||
it != arguments.end(); it++)
|
||||
{
|
||||
if (it != arguments.begin())
|
||||
|
@ -6479,7 +6479,7 @@ AbstractExternalFunctionNode::writeJsonExternalFunctionArguments(ostream &output
|
|||
const deriv_node_temp_terms_t &tef_terms,
|
||||
const bool isdynamic) const
|
||||
{
|
||||
for (vector<expr_t>::const_iterator it = arguments.begin();
|
||||
for (auto it = arguments.begin();
|
||||
it != arguments.end(); it++)
|
||||
{
|
||||
if (it != arguments.begin())
|
||||
|
@ -6563,18 +6563,18 @@ ExternalFunctionNode::compile(ostream &CompileCode, unsigned int &instruction_nu
|
|||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||
const deriv_node_temp_terms_t &tef_terms) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
if (dynamic)
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDT_ fldt(ii->second);
|
||||
fldt.write(CompileCode, instruction_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDST_ fldst(ii->second);
|
||||
fldst.write(CompileCode, instruction_number);
|
||||
}
|
||||
|
@ -6649,7 +6649,7 @@ ExternalFunctionNode::writeJsonOutput(ostream &output,
|
|||
const deriv_node_temp_terms_t &tef_terms,
|
||||
const bool isdynamic) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
output << "T" << idx;
|
||||
|
@ -6886,7 +6886,7 @@ FirstDerivExternalFunctionNode::writeJsonOutput(ostream &output,
|
|||
const bool isdynamic) const
|
||||
{
|
||||
// If current node is a temporary term
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
output << "T" << idx;
|
||||
|
@ -6953,18 +6953,18 @@ FirstDerivExternalFunctionNode::compile(ostream &CompileCode, unsigned int &inst
|
|||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||
const deriv_node_temp_terms_t &tef_terms) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
if (dynamic)
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDT_ fldt(ii->second);
|
||||
fldt.write(CompileCode, instruction_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
map_idx_t::const_iterator ii = map_idx.find(idx);
|
||||
auto ii = map_idx.find(idx);
|
||||
FLDST_ fldst(ii->second);
|
||||
fldst.write(CompileCode, instruction_number);
|
||||
}
|
||||
|
@ -7267,7 +7267,7 @@ SecondDerivExternalFunctionNode::writeJsonOutput(ostream &output,
|
|||
const bool isdynamic) const
|
||||
{
|
||||
// If current node is a temporary term
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<SecondDerivExternalFunctionNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<SecondDerivExternalFunctionNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
{
|
||||
output << "T" << idx;
|
||||
|
@ -7722,7 +7722,7 @@ VarExpectationNode::containsExternalFunction() const
|
|||
double
|
||||
VarExpectationNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException)
|
||||
{
|
||||
eval_context_t::const_iterator it = eval_context.find(symb_id);
|
||||
auto it = eval_context.find(symb_id);
|
||||
if (it == eval_context.end())
|
||||
throw EvalException();
|
||||
|
||||
|
@ -7755,7 +7755,7 @@ VarExpectationNode::collectDynamicVariables(SymbolType type_arg, set<pair<int, i
|
|||
void
|
||||
VarExpectationNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VarExpectationNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<VarExpectationNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
temporary_terms_inuse.insert(idx);
|
||||
}
|
||||
|
@ -8019,11 +8019,11 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
<< datatree.symbol_table.getTypeSpecificID(growth_param_index) + 1 << ";" << endl;
|
||||
|
||||
output << "M_.pac." << model_name << ".ec.params = ";
|
||||
set<pair<int, pair<int, int> > >::const_iterator it = ec_params_and_vars.begin();
|
||||
auto it = ec_params_and_vars.begin();
|
||||
output << datatree.symbol_table.getTypeSpecificID(it->first) + 1
|
||||
<< ";" << endl
|
||||
<< "M_.pac." << model_name << ".ec.vars = [";
|
||||
for (set<pair<int, pair<int, int> > >::const_iterator it = ec_params_and_vars.begin();
|
||||
for (auto it = ec_params_and_vars.begin();
|
||||
it != ec_params_and_vars.end(); it++)
|
||||
{
|
||||
if (it != ec_params_and_vars.begin())
|
||||
|
@ -8032,7 +8032,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "M_.pac." << model_name << ".ar.params = [";
|
||||
for (set<pair<int, pair<int, int> > >::const_iterator it = ar_params_and_vars.begin();
|
||||
for (auto it = ar_params_and_vars.begin();
|
||||
it != ar_params_and_vars.end(); it++)
|
||||
{
|
||||
if (it != ar_params_and_vars.begin())
|
||||
|
@ -8041,7 +8041,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "M_.pac." << model_name << ".ar.vars = [";
|
||||
for (set<pair<int, pair<int, int> > >::const_iterator it = ar_params_and_vars.begin();
|
||||
for (auto it = ar_params_and_vars.begin();
|
||||
it != ar_params_and_vars.end(); it++)
|
||||
{
|
||||
if (it != ar_params_and_vars.begin())
|
||||
|
@ -8050,7 +8050,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "M_.pac." << model_name << ".ar.lags = [";
|
||||
for (set<pair<int, pair<int, int> > >::const_iterator it = ar_params_and_vars.begin();
|
||||
for (auto it = ar_params_and_vars.begin();
|
||||
it != ar_params_and_vars.end(); it++)
|
||||
{
|
||||
if (it != ar_params_and_vars.begin())
|
||||
|
@ -8059,7 +8059,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "M_.pac." << model_name << ".h0_param_indices = [";
|
||||
for (vector<int>::const_iterator it = h0_indices.begin();
|
||||
for (auto it = h0_indices.begin();
|
||||
it != h0_indices.end(); it++)
|
||||
{
|
||||
if (it != h0_indices.begin())
|
||||
|
@ -8068,7 +8068,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
}
|
||||
output << "];" << endl
|
||||
<< "M_.pac." << model_name << ".h1_param_indices = [";
|
||||
for (vector<int>::const_iterator it = h1_indices.begin();
|
||||
for (auto it = h1_indices.begin();
|
||||
it != h1_indices.end(); it++)
|
||||
{
|
||||
if (it != h1_indices.begin())
|
||||
|
@ -8196,7 +8196,7 @@ PacExpectationNode::collectDynamicVariables(SymbolType type_arg, set<pair<int, i
|
|||
void
|
||||
PacExpectationNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
|
||||
{
|
||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<PacExpectationNode *>(this));
|
||||
auto it = temporary_terms.find(const_cast<PacExpectationNode *>(this));
|
||||
if (it != temporary_terms.end())
|
||||
temporary_terms_inuse.insert(idx);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
inline bool
|
||||
ExternalFunctionsTable::exists(int symb_id) const
|
||||
{
|
||||
external_function_table_type::const_iterator iter = externalFunctionTable.find(symb_id);
|
||||
auto iter = externalFunctionTable.find(symb_id);
|
||||
return (iter != externalFunctionTable.end());
|
||||
}
|
||||
|
||||
|
|
|
@ -61,15 +61,15 @@ ModFile::evalAllExpressions(bool warn_uninit, const bool nopreprocessoroutput)
|
|||
// Loop over all statements, and fill global eval context if relevant
|
||||
for (vector<Statement *>::const_iterator it = statements.begin(); it != statements.end(); it++)
|
||||
{
|
||||
InitParamStatement *ips = dynamic_cast<InitParamStatement *>(*it);
|
||||
auto *ips = dynamic_cast<InitParamStatement *>(*it);
|
||||
if (ips)
|
||||
ips->fillEvalContext(global_eval_context);
|
||||
|
||||
InitOrEndValStatement *ies = dynamic_cast<InitOrEndValStatement *>(*it);
|
||||
auto *ies = dynamic_cast<InitOrEndValStatement *>(*it);
|
||||
if (ies)
|
||||
ies->fillEvalContext(global_eval_context);
|
||||
|
||||
LoadParamsAndSteadyStateStatement *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(*it);
|
||||
auto *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(*it);
|
||||
if (lpass)
|
||||
lpass->fillEvalContext(global_eval_context);
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ ModFile::checkPass(bool nostrict, bool stochastic)
|
|||
if (parameters_intersect.size() > 0)
|
||||
{
|
||||
cerr << "ERROR: some estimated parameters (";
|
||||
for (set<int>::const_iterator it = parameters_intersect.begin();
|
||||
for (auto it = parameters_intersect.begin();
|
||||
it != parameters_intersect.end();)
|
||||
{
|
||||
cerr << symbol_table.getName(*it);
|
||||
|
@ -381,7 +381,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
|
|||
for (vector<Statement *>::const_iterator it = statements.begin();
|
||||
it != statements.end(); it++)
|
||||
{
|
||||
VarModelStatement *vms = dynamic_cast<VarModelStatement *>(*it);
|
||||
auto *vms = dynamic_cast<VarModelStatement *>(*it);
|
||||
if (vms != NULL)
|
||||
{
|
||||
string var_model_name;
|
||||
|
@ -403,7 +403,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
|
|||
make_pair(diff, orig_diff_var)),
|
||||
make_pair(make_pair(max_lag, nonstationary), eqnumber));
|
||||
}
|
||||
PacModelStatement *pms = dynamic_cast<PacModelStatement *>(*it);
|
||||
auto *pms = dynamic_cast<PacModelStatement *>(*it);
|
||||
if (pms != NULL)
|
||||
{
|
||||
pair<string, pair<string, pair<string, pair<int, map<string, int> > > > >
|
||||
|
@ -462,7 +462,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
|
|||
StaticModel *planner_objective = NULL;
|
||||
for (auto & statement : statements)
|
||||
{
|
||||
PlannerObjectiveStatement *pos = dynamic_cast<PlannerObjectiveStatement *>(statement);
|
||||
auto *pos = dynamic_cast<PlannerObjectiveStatement *>(statement);
|
||||
if (pos != NULL)
|
||||
planner_objective = pos->getPlannerObjective();
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
|
|||
for (vector<Statement *>::const_iterator it = statements.begin();
|
||||
it != statements.end(); it++)
|
||||
{
|
||||
VarModelStatement *vms = dynamic_cast<VarModelStatement *>(*it);
|
||||
auto *vms = dynamic_cast<VarModelStatement *>(*it);
|
||||
if (vms != NULL)
|
||||
{
|
||||
string var_model_name;
|
||||
|
@ -597,7 +597,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
|
|||
if (mod_file_struct.ramsey_policy_present)
|
||||
for (auto & statement : statements)
|
||||
{
|
||||
RamseyPolicyStatement *rps = dynamic_cast<RamseyPolicyStatement *>(statement);
|
||||
auto *rps = dynamic_cast<RamseyPolicyStatement *>(statement);
|
||||
if (rps != NULL)
|
||||
rps->checkRamseyPolicyList();
|
||||
}
|
||||
|
@ -988,7 +988,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
|
|||
|
||||
/* Special treatment for initval block: insert initial values for the
|
||||
auxiliary variables and initialize exo det */
|
||||
InitValStatement *ivs = dynamic_cast<InitValStatement *>(statement);
|
||||
auto *ivs = dynamic_cast<InitValStatement *>(statement);
|
||||
if (ivs != NULL)
|
||||
{
|
||||
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
|
||||
|
@ -996,17 +996,17 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
|
|||
}
|
||||
|
||||
// Special treatment for endval block: insert initial values for the auxiliary variables
|
||||
EndValStatement *evs = dynamic_cast<EndValStatement *>(statement);
|
||||
auto *evs = dynamic_cast<EndValStatement *>(statement);
|
||||
if (evs != NULL)
|
||||
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
|
||||
|
||||
// Special treatment for load params and steady state statement: insert initial values for the auxiliary variables
|
||||
LoadParamsAndSteadyStateStatement *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(statement);
|
||||
auto *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(statement);
|
||||
if (lpass && !no_static)
|
||||
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
|
||||
|
||||
// Special treatement for Var Models
|
||||
VarModelStatement *vms = dynamic_cast<VarModelStatement *>(statement);
|
||||
auto *vms = dynamic_cast<VarModelStatement *>(statement);
|
||||
if (vms != NULL)
|
||||
vms->createVarModelMFunction(mOutputFile, dynamic_model.getVarExpectationFunctionsToWrite());
|
||||
}
|
||||
|
@ -1489,7 +1489,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
|
|||
if (!statements.empty())
|
||||
{
|
||||
output << ", \"statements\": [";
|
||||
for (vector<Statement *>::const_iterator it = statements.begin();
|
||||
for (auto it = statements.begin();
|
||||
it != statements.end(); it++)
|
||||
{
|
||||
if (it != statements.begin())
|
||||
|
|
|
@ -234,7 +234,7 @@ ModelTree::computeNormalizedEquations(multimap<int, int> &endo2eqs) const
|
|||
{
|
||||
for (size_t i = 0; i < equations.size(); i++)
|
||||
{
|
||||
VariableNode *lhs = dynamic_cast<VariableNode *>(equations[i]->get_arg1());
|
||||
auto *lhs = dynamic_cast<VariableNode *>(equations[i]->get_arg1());
|
||||
if (lhs == NULL)
|
||||
continue;
|
||||
|
||||
|
@ -450,13 +450,13 @@ ModelTree::equationTypeDetermination(const map<pair<int, pair<int, int> >, expr_
|
|||
eq_node = equations[eq];
|
||||
lhs = eq_node->get_arg1();
|
||||
Equation_Simulation_Type = E_SOLVE;
|
||||
map<pair<int, pair<int, int> >, expr_t>::const_iterator derivative = first_order_endo_derivatives.find(make_pair(eq, make_pair(var, 0)));
|
||||
auto derivative = first_order_endo_derivatives.find(make_pair(eq, make_pair(var, 0)));
|
||||
pair<bool, expr_t> res;
|
||||
if (derivative != first_order_endo_derivatives.end())
|
||||
{
|
||||
set<pair<int, int> > result;
|
||||
derivative->second->collectEndogenous(result);
|
||||
set<pair<int, int> >::const_iterator d_endo_variable = result.find(make_pair(var, 0));
|
||||
auto d_endo_variable = result.find(make_pair(var, 0));
|
||||
//Determine whether the equation could be evaluated rather than to be solved
|
||||
if (lhs->isVariableNodeEqualTo(eEndogenous, Index_Var_IM[i], 0) && derivative->second->isNumConstNodeEqualTo(1))
|
||||
{
|
||||
|
@ -836,7 +836,7 @@ ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_j
|
|||
{
|
||||
int curr_variable = it.first;
|
||||
int curr_lag = it.second;
|
||||
vector<int>::const_iterator it1 = find(variable_reordered.begin()+first_count_equ, variable_reordered.begin()+(first_count_equ+Blck_Size), curr_variable);
|
||||
auto it1 = find(variable_reordered.begin()+first_count_equ, variable_reordered.begin()+(first_count_equ+Blck_Size), curr_variable);
|
||||
if (it1 != variable_reordered.begin()+(first_count_equ+Blck_Size))
|
||||
if (dynamic_jacobian.find(make_pair(curr_lag, make_pair(equation_reordered[count_equ], curr_variable))) != dynamic_jacobian.end())
|
||||
{
|
||||
|
@ -891,7 +891,7 @@ ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_j
|
|||
{
|
||||
for (int j = first_equation; j < first_equation+c_Size; j++)
|
||||
{
|
||||
dynamic_jacob_map_t::const_iterator it = dynamic_jacobian.find(make_pair(-1, make_pair(equation_reordered[eq], variable_reordered[j])));
|
||||
auto it = dynamic_jacobian.find(make_pair(-1, make_pair(equation_reordered[eq], variable_reordered[j])));
|
||||
if (it != dynamic_jacobian.end())
|
||||
is_lag = true;
|
||||
it = dynamic_jacobian.find(make_pair(+1, make_pair(equation_reordered[eq], variable_reordered[j])));
|
||||
|
@ -1025,7 +1025,7 @@ ModelTree::writeDerivative(ostream &output, int eq, int symb_id, int lag,
|
|||
ExprNodeOutputType output_type,
|
||||
const temporary_terms_t &temporary_terms) const
|
||||
{
|
||||
first_derivatives_t::const_iterator it = first_derivatives.find(make_pair(eq, getDerivID(symb_id, lag)));
|
||||
auto it = first_derivatives.find(make_pair(eq, getDerivID(symb_id, lag)));
|
||||
if (it != first_derivatives.end())
|
||||
(it->second)->writeOutput(output, output_type, temporary_terms, {});
|
||||
else
|
||||
|
@ -1221,7 +1221,7 @@ ModelTree::writeTemporaryTerms(const temporary_terms_t &tt,
|
|||
{
|
||||
// Local var used to keep track of temp nodes already written
|
||||
temporary_terms_t tt2 = ttm1;
|
||||
for (temporary_terms_t::const_iterator it = tt.begin();
|
||||
for (auto it = tt.begin();
|
||||
it != tt.end(); it++)
|
||||
{
|
||||
if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
|
||||
|
@ -1278,7 +1278,7 @@ ModelTree::writeJsonTemporaryTerms(const temporary_terms_t &tt, const temporary_
|
|||
wrote_term = false;
|
||||
output << "]"
|
||||
<< ", \"temporary_terms_" << concat << "\": [";
|
||||
for (temporary_terms_t::const_iterator it = tt.begin();
|
||||
for (auto it = tt.begin();
|
||||
it != tt.end(); it++)
|
||||
if (ttm1.find(*it) == ttm1.end())
|
||||
{
|
||||
|
@ -1733,7 +1733,7 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
|
|||
void
|
||||
ModelTree::addEquation(expr_t eq, int lineno)
|
||||
{
|
||||
BinaryOpNode *beq = dynamic_cast<BinaryOpNode *>(eq);
|
||||
auto *beq = dynamic_cast<BinaryOpNode *>(eq);
|
||||
assert(beq != NULL && beq->get_op_code() == oEqual);
|
||||
|
||||
equations.push_back(beq);
|
||||
|
@ -1752,7 +1752,7 @@ ModelTree::addEquation(expr_t eq, int lineno, const vector<pair<string, string>
|
|||
void
|
||||
ModelTree::addAuxEquation(expr_t eq)
|
||||
{
|
||||
BinaryOpNode *beq = dynamic_cast<BinaryOpNode *>(eq);
|
||||
auto *beq = dynamic_cast<BinaryOpNode *>(eq);
|
||||
assert(beq != NULL && beq->get_op_code() == oEqual);
|
||||
|
||||
aux_equations.push_back(beq);
|
||||
|
|
|
@ -33,7 +33,7 @@ NumericalConstants::AddNonNegativeConstant(const string &iConst)
|
|||
if (iter != numConstantsIndex.end())
|
||||
return iter->second;
|
||||
|
||||
int id = (int) mNumericalConstants.size();
|
||||
auto id = (int) mNumericalConstants.size();
|
||||
mNumericalConstants.push_back(iConst);
|
||||
numConstantsIndex[iConst] = id;
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ InitOrEndValStatement::writeInitValues(ostream &output) const
|
|||
void
|
||||
InitOrEndValStatement::writeJsonInitValues(ostream &output) const
|
||||
{
|
||||
for (init_values_t::const_iterator it = init_values.begin();
|
||||
for (auto it = init_values.begin();
|
||||
it != init_values.end(); it++)
|
||||
{
|
||||
if (it != init_values.begin())
|
||||
|
@ -414,7 +414,7 @@ void
|
|||
HistValStatement::writeJsonOutput(ostream &output) const
|
||||
{
|
||||
output << "{\"statementName\": \"hist_val\", \"vals\": [";
|
||||
for (hist_values_t::const_iterator it = hist_values.begin();
|
||||
for (auto it = hist_values.begin();
|
||||
it != hist_values.end(); it++)
|
||||
{
|
||||
if (it != hist_values.begin())
|
||||
|
@ -510,7 +510,7 @@ HomotopyStatement::writeJsonOutput(ostream &output) const
|
|||
{
|
||||
output << "{\"statementName\": \"homotopy\", "
|
||||
<< "\"values\": [";
|
||||
for (homotopy_values_t::const_iterator it = homotopy_values.begin();
|
||||
for (auto it = homotopy_values.begin();
|
||||
it != homotopy_values.end(); it++)
|
||||
{
|
||||
if (it != homotopy_values.begin())
|
||||
|
@ -617,7 +617,7 @@ LoadParamsAndSteadyStateStatement::writeJsonOutput(ostream &output) const
|
|||
{
|
||||
output << "{\"statementName\": \"load_params_and_steady_state\""
|
||||
<< "\"values\": [";
|
||||
for (map<int, string>::const_iterator it = content.begin();
|
||||
for (auto it = content.begin();
|
||||
it != content.end(); it++)
|
||||
{
|
||||
if (it != content.begin())
|
||||
|
|
|
@ -426,7 +426,7 @@ ParsingDriver::declare_or_change_type(SymbolType new_type, string *name)
|
|||
mod_file->symbol_table.changeType(symb_id, new_type);
|
||||
|
||||
// change in equations in ModelTree
|
||||
DynamicModel *dm = new DynamicModel(mod_file->symbol_table,
|
||||
auto *dm = new DynamicModel(mod_file->symbol_table,
|
||||
mod_file->num_constants,
|
||||
mod_file->external_functions_table);
|
||||
mod_file->dynamic_model.updateAfterVariableChange(*dm);
|
||||
|
@ -434,7 +434,7 @@ ParsingDriver::declare_or_change_type(SymbolType new_type, string *name)
|
|||
|
||||
// remove error messages
|
||||
undeclared_model_vars.erase(*name);
|
||||
for (vector<pair<string, string> >::iterator it = undeclared_model_variable_errors.begin();
|
||||
for (auto it = undeclared_model_variable_errors.begin();
|
||||
it != undeclared_model_variable_errors.end();)
|
||||
if (it->first == *name)
|
||||
it = undeclared_model_variable_errors.erase(it);
|
||||
|
@ -593,7 +593,7 @@ void
|
|||
ParsingDriver::add_VAR_exclusion_restriction(string *lagstr)
|
||||
{
|
||||
int lag = atoi(lagstr->c_str());
|
||||
map<int, map<int, SymbolList> >::iterator it = exclusion_restrictions.find(lag);
|
||||
auto it = exclusion_restrictions.find(lag);
|
||||
if (it == exclusion_restrictions.end())
|
||||
exclusion_restrictions[lag] = exclusion_restriction;
|
||||
else
|
||||
|
@ -1250,7 +1250,7 @@ ParsingDriver::combine_lag_and_restriction(string *lag)
|
|||
|
||||
for (map<int, vector<int> >::const_iterator it = svar_equation_restrictions.begin();
|
||||
it != svar_equation_restrictions.end(); it++)
|
||||
for (vector<int>::const_iterator it1 = it->second.begin();
|
||||
for (auto it1 = it->second.begin();
|
||||
it1 != it->second.end(); it1++)
|
||||
{
|
||||
SvarIdentificationStatement::svar_identification_restriction new_restriction;
|
||||
|
@ -2869,7 +2869,7 @@ ParsingDriver::add_diff(expr_t arg1)
|
|||
expr_t
|
||||
ParsingDriver::add_adl(expr_t arg1, string *name, string *lag)
|
||||
{
|
||||
vector<int> *lags = new vector<int>();
|
||||
auto *lags = new vector<int>();
|
||||
for (int i = 1; i <= atoi(lag->c_str()); i++)
|
||||
lags->push_back(i);
|
||||
|
||||
|
@ -3126,8 +3126,8 @@ ParsingDriver::is_there_one_integer_argument() const
|
|||
if (stack_external_function_args.top().size() != 1)
|
||||
return make_pair(false, 0);
|
||||
|
||||
NumConstNode *numNode = dynamic_cast<NumConstNode *>(stack_external_function_args.top().front());
|
||||
UnaryOpNode *unaryNode = dynamic_cast<UnaryOpNode *>(stack_external_function_args.top().front());
|
||||
auto *numNode = dynamic_cast<NumConstNode *>(stack_external_function_args.top().front());
|
||||
auto *unaryNode = dynamic_cast<UnaryOpNode *>(stack_external_function_args.top().front());
|
||||
|
||||
if (numNode == NULL && unaryNode == NULL)
|
||||
return make_pair(false, 0);
|
||||
|
|
|
@ -71,14 +71,14 @@ void
|
|||
AbstractShocksStatement::writeJsonDetShocks(ostream &output) const
|
||||
{
|
||||
output << "\"deterministic_shocks\": [";
|
||||
for (det_shocks_t::const_iterator it = det_shocks.begin();
|
||||
for (auto it = det_shocks.begin();
|
||||
it != det_shocks.end(); it++)
|
||||
{
|
||||
if (it != det_shocks.begin())
|
||||
output << ", ";
|
||||
output << "{\"var\": \"" << symbol_table.getName(it->first) << "\", "
|
||||
<< "\"values\": [";
|
||||
for (vector<DetShockElement>::const_iterator it1 = it->second.begin();
|
||||
for (auto it1 = it->second.begin();
|
||||
it1 != it->second.end(); it1++)
|
||||
{
|
||||
if (it1 != it->second.begin())
|
||||
|
@ -165,7 +165,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
|
|||
writeJsonDetShocks(output);
|
||||
}
|
||||
output<< ", \"variance\": [";
|
||||
for (var_and_std_shocks_t::const_iterator it = var_shocks.begin(); it != var_shocks.end(); it++)
|
||||
for (auto it = var_shocks.begin(); it != var_shocks.end(); it++)
|
||||
{
|
||||
if (it != var_shocks.begin())
|
||||
output << ", ";
|
||||
|
@ -176,7 +176,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
|
|||
}
|
||||
output << "]"
|
||||
<< ", \"stderr\": [";
|
||||
for (var_and_std_shocks_t::const_iterator it = std_shocks.begin(); it != std_shocks.end(); it++)
|
||||
for (auto it = std_shocks.begin(); it != std_shocks.end(); it++)
|
||||
{
|
||||
if (it != std_shocks.begin())
|
||||
output << ", ";
|
||||
|
@ -187,7 +187,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
|
|||
}
|
||||
output << "]"
|
||||
<< ", \"covariance\": [";
|
||||
for (covar_and_corr_shocks_t::const_iterator it = covar_shocks.begin(); it != covar_shocks.end(); it++)
|
||||
for (auto it = covar_shocks.begin(); it != covar_shocks.end(); it++)
|
||||
{
|
||||
if (it != covar_shocks.begin())
|
||||
output << ", ";
|
||||
|
@ -200,7 +200,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
|
|||
}
|
||||
output << "]"
|
||||
<< ", \"correlation\": [";
|
||||
for (covar_and_corr_shocks_t::const_iterator it = corr_shocks.begin(); it != corr_shocks.end(); it++)
|
||||
for (auto it = corr_shocks.begin(); it != corr_shocks.end(); it++)
|
||||
{
|
||||
if (it != corr_shocks.begin())
|
||||
output << ", ";
|
||||
|
@ -468,7 +468,7 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
|
|||
<< "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl;
|
||||
|
||||
int k = 1;
|
||||
for (AbstractShocksStatement::det_shocks_t::const_iterator it = paths.begin();
|
||||
for (auto it = paths.begin();
|
||||
it != paths.end(); it++, k++)
|
||||
{
|
||||
if (it == paths.begin())
|
||||
|
@ -513,7 +513,7 @@ MomentCalibration::writeJsonOutput(ostream &output) const
|
|||
{
|
||||
output << "{\"statementName\": \"moment_calibration\""
|
||||
<< ", \"moment_calibration_criteria\": [";
|
||||
for (constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); it++)
|
||||
for (auto it = constraints.begin(); it != constraints.end(); it++)
|
||||
{
|
||||
if (it != constraints.begin())
|
||||
output << ", ";
|
||||
|
@ -563,7 +563,7 @@ IrfCalibration::writeJsonOutput(ostream &output) const
|
|||
}
|
||||
|
||||
output << ", \"irf_restrictions\": [";
|
||||
for (constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); it++)
|
||||
for (auto it = constraints.begin(); it != constraints.end(); it++)
|
||||
{
|
||||
if (it != constraints.begin())
|
||||
output << ", ";
|
||||
|
@ -588,9 +588,9 @@ ShockGroupsStatement::writeOutput(ostream &output, const string &basename, bool
|
|||
{
|
||||
int i = 1;
|
||||
bool unique_label = true;
|
||||
for (vector<Group>::const_iterator it = shock_groups.begin(); it != shock_groups.end(); it++, unique_label = true)
|
||||
for (auto it = shock_groups.begin(); it != shock_groups.end(); it++, unique_label = true)
|
||||
{
|
||||
for (vector<Group>::const_iterator it1 = it+1; it1 != shock_groups.end(); it1++)
|
||||
for (auto it1 = it+1; it1 != shock_groups.end(); it1++)
|
||||
if (it->name == it1->name)
|
||||
{
|
||||
unique_label = false;
|
||||
|
|
|
@ -165,7 +165,7 @@ OptionsList::writeOutput(ostream &output) const
|
|||
if (vector_int_option.second.size() > 1)
|
||||
{
|
||||
output << "[";
|
||||
for (vector<int>::const_iterator viit = vector_int_option.second.begin();
|
||||
for (auto viit = vector_int_option.second.begin();
|
||||
viit != vector_int_option.second.end(); viit++)
|
||||
output << *viit << ";";
|
||||
output << "];" << endl;
|
||||
|
@ -180,7 +180,7 @@ OptionsList::writeOutput(ostream &output) const
|
|||
if (vector_str_option.second.size() > 1)
|
||||
{
|
||||
output << "{";
|
||||
for (vector<string>::const_iterator viit = vector_str_option.second.begin();
|
||||
for (auto viit = vector_str_option.second.begin();
|
||||
viit != vector_str_option.second.end(); viit++)
|
||||
output << "'" << *viit << "';";
|
||||
output << "};" << endl;
|
||||
|
@ -226,7 +226,7 @@ OptionsList::writeOutput(ostream &output, const string &option_group) const
|
|||
if (vector_int_option.second.size() > 1)
|
||||
{
|
||||
output << "[";
|
||||
for (vector<int>::const_iterator viit = vector_int_option.second.begin();
|
||||
for (auto viit = vector_int_option.second.begin();
|
||||
viit != vector_int_option.second.end(); viit++)
|
||||
output << *viit << ";";
|
||||
output << "];" << endl;
|
||||
|
@ -241,7 +241,7 @@ OptionsList::writeOutput(ostream &output, const string &option_group) const
|
|||
if (vector_str_option.second.size() > 1)
|
||||
{
|
||||
output << "{";
|
||||
for (vector<string>::const_iterator viit = vector_str_option.second.begin();
|
||||
for (auto viit = vector_str_option.second.begin();
|
||||
viit != vector_str_option.second.end(); viit++)
|
||||
output << "'" << *viit << "';";
|
||||
output << "};" << endl;
|
||||
|
@ -258,7 +258,7 @@ OptionsList::writeJsonOutput(ostream &output) const
|
|||
return;
|
||||
|
||||
output << "\"options\": {";
|
||||
for (num_options_t::const_iterator it = num_options.begin();
|
||||
for (auto it = num_options.begin();
|
||||
it != num_options.end();)
|
||||
{
|
||||
output << "\""<< it->first << "\": " << it->second;
|
||||
|
@ -272,7 +272,7 @@ OptionsList::writeJsonOutput(ostream &output) const
|
|||
output << ", ";
|
||||
}
|
||||
|
||||
for (paired_num_options_t::const_iterator it = paired_num_options.begin();
|
||||
for (auto it = paired_num_options.begin();
|
||||
it != paired_num_options.end();)
|
||||
{
|
||||
output << "\""<< it->first << "\": [" << it->second.first << " " << it->second.second << "]";
|
||||
|
@ -285,7 +285,7 @@ OptionsList::writeJsonOutput(ostream &output) const
|
|||
output << ", ";
|
||||
}
|
||||
|
||||
for (string_options_t::const_iterator it = string_options.begin();
|
||||
for (auto it = string_options.begin();
|
||||
it != string_options.end();)
|
||||
{
|
||||
output << "\""<< it->first << "\": \"" << it->second << "\"";
|
||||
|
@ -297,7 +297,7 @@ OptionsList::writeJsonOutput(ostream &output) const
|
|||
output << ", ";
|
||||
}
|
||||
|
||||
for (date_options_t::const_iterator it = date_options.begin();
|
||||
for (auto it = date_options.begin();
|
||||
it != date_options.end();)
|
||||
{
|
||||
output << "\""<< it->first << "\": \"" << it->second << "\"";
|
||||
|
@ -308,7 +308,7 @@ OptionsList::writeJsonOutput(ostream &output) const
|
|||
output << ", ";
|
||||
}
|
||||
|
||||
for (symbol_list_options_t::const_iterator it = symbol_list_options.begin();
|
||||
for (auto it = symbol_list_options.begin();
|
||||
it != symbol_list_options.end(); it++)
|
||||
{
|
||||
output << "\""<< it->first << "\":";
|
||||
|
@ -319,13 +319,13 @@ OptionsList::writeJsonOutput(ostream &output) const
|
|||
output << ", ";
|
||||
}
|
||||
|
||||
for (vec_int_options_t::const_iterator it = vector_int_options.begin();
|
||||
for (auto it = vector_int_options.begin();
|
||||
it != vector_int_options.end();)
|
||||
{
|
||||
output << "\""<< it->first << "\": [";
|
||||
if (it->second.size() > 1)
|
||||
{
|
||||
for (vector<int>::const_iterator viit = it->second.begin();
|
||||
for (auto viit = it->second.begin();
|
||||
viit != it->second.end();)
|
||||
{
|
||||
output << *viit;
|
||||
|
@ -343,13 +343,13 @@ OptionsList::writeJsonOutput(ostream &output) const
|
|||
}
|
||||
|
||||
|
||||
for (vec_str_options_t::const_iterator it = vector_str_options.begin();
|
||||
for (auto it = vector_str_options.begin();
|
||||
it != vector_str_options.end();)
|
||||
{
|
||||
output << "\""<< it->first << "\": [";
|
||||
if (it->second.size() > 1)
|
||||
{
|
||||
for (vector<string>::const_iterator viit = it->second.begin();
|
||||
for (auto viit = it->second.begin();
|
||||
viit != it->second.end();)
|
||||
{
|
||||
output << "\"" << *viit << "\"";
|
||||
|
|
|
@ -46,7 +46,7 @@ StaticModel::StaticModel(SymbolTable &symbol_table_arg,
|
|||
void
|
||||
StaticModel::compileDerivative(ofstream &code_file, unsigned int &instruction_number, int eq, int symb_id, map_idx_t &map_idx, temporary_terms_t temporary_terms) const
|
||||
{
|
||||
first_derivatives_t::const_iterator it = first_derivatives.find(make_pair(eq, getDerivID(symbol_table.getID(eEndogenous, symb_id), 0)));
|
||||
auto it = first_derivatives.find(make_pair(eq, getDerivID(symbol_table.getID(eEndogenous, symb_id), 0)));
|
||||
if (it != first_derivatives.end())
|
||||
(it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
||||
else
|
||||
|
@ -59,7 +59,7 @@ StaticModel::compileDerivative(ofstream &code_file, unsigned int &instruction_nu
|
|||
void
|
||||
StaticModel::compileChainRuleDerivative(ofstream &code_file, unsigned int &instruction_number, int eqr, int varr, int lag, map_idx_t &map_idx, temporary_terms_t temporary_terms) const
|
||||
{
|
||||
map<pair<int, pair<int, int> >, expr_t>::const_iterator it = first_chain_rule_derivatives.find(make_pair(eqr, make_pair(varr, lag)));
|
||||
auto it = first_chain_rule_derivatives.find(make_pair(eqr, make_pair(varr, lag)));
|
||||
if (it != first_chain_rule_derivatives.end())
|
||||
(it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
||||
else
|
||||
|
@ -175,7 +175,7 @@ StaticModel::computeTemporaryTermsOrdered()
|
|||
id->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||
}
|
||||
for (int i = 0; i < (int) getBlockSize(block); i++)
|
||||
for (temporary_terms_t::const_iterator it = v_temporary_terms[block][i].begin();
|
||||
for (auto it = v_temporary_terms[block][i].begin();
|
||||
it != v_temporary_terms[block][i].end(); it++)
|
||||
(*it)->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||
v_temporary_terms_inuse[block] = temporary_terms_in_use;
|
||||
|
@ -373,7 +373,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &static_basename) const
|
|||
case SOLVE_FORWARD_SIMPLE:
|
||||
case SOLVE_BACKWARD_COMPLETE:
|
||||
case SOLVE_FORWARD_COMPLETE:
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
{
|
||||
unsigned int eq = it->first.first;
|
||||
unsigned int var = it->first.second;
|
||||
|
@ -746,7 +746,7 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
|
|||
case SOLVE_BACKWARD_COMPLETE:
|
||||
case SOLVE_FORWARD_COMPLETE:
|
||||
count_u = feedback_variables.size();
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
{
|
||||
unsigned int eq = it->first.first;
|
||||
unsigned int var = it->first.second;
|
||||
|
@ -842,7 +842,7 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
|
|||
{
|
||||
if (v_temporary_terms_local[block].size())
|
||||
{
|
||||
for (temporary_terms_t::const_iterator it = v_temporary_terms_local[block][i].begin();
|
||||
for (auto it = v_temporary_terms_local[block][i].begin();
|
||||
it != v_temporary_terms_local[block][i].end(); it++)
|
||||
{
|
||||
if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
|
||||
|
@ -940,7 +940,7 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
|
|||
case SOLVE_BACKWARD_COMPLETE:
|
||||
case SOLVE_FORWARD_COMPLETE:
|
||||
count_u = feedback_variables.size();
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
|
||||
{
|
||||
unsigned int eq = it->first.first;
|
||||
unsigned int var = it->first.second;
|
||||
|
@ -991,7 +991,7 @@ StaticModel::Write_Inf_To_Bin_File_Block(const string &static_basename, const st
|
|||
unsigned int block_size = getBlockSize(num);
|
||||
unsigned int block_mfs = getBlockMfs(num);
|
||||
unsigned int block_recursive = block_size - block_mfs;
|
||||
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[num].begin(); it != (blocks_derivatives[num]).end(); it++)
|
||||
for (auto it = blocks_derivatives[num].begin(); it != (blocks_derivatives[num]).end(); it++)
|
||||
{
|
||||
unsigned int eq = it->first.first;
|
||||
unsigned int var = it->first.second;
|
||||
|
@ -2538,7 +2538,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
|||
}
|
||||
|
||||
int i = 1;
|
||||
for (second_derivatives_t::const_iterator it = residuals_params_second_derivatives.begin();
|
||||
for (auto it = residuals_params_second_derivatives.begin();
|
||||
it != residuals_params_second_derivatives.end(); ++it, i++)
|
||||
{
|
||||
int eq = it->first.first;
|
||||
|
@ -2562,7 +2562,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
|||
}
|
||||
|
||||
i = 1;
|
||||
for (third_derivatives_t::const_iterator it = jacobian_params_second_derivatives.begin();
|
||||
for (auto it = jacobian_params_second_derivatives.begin();
|
||||
it != jacobian_params_second_derivatives.end(); ++it, i++)
|
||||
{
|
||||
int eq = it->first.first;
|
||||
|
@ -2590,7 +2590,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
|||
}
|
||||
|
||||
i = 1;
|
||||
for (third_derivatives_t::const_iterator it = hessian_params_derivatives.begin();
|
||||
for (auto it = hessian_params_derivatives.begin();
|
||||
it != hessian_params_derivatives.end(); ++it, i++)
|
||||
{
|
||||
int eq = it->first.first;
|
||||
|
@ -2761,7 +2761,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
|
|||
<< " \"nrows\": " << nrows
|
||||
<< ", \"ncols\": " << JacobianColsNbr
|
||||
<< ", \"entries\": [";
|
||||
for (first_derivatives_t::const_iterator it = first_derivatives.begin();
|
||||
for (auto it = first_derivatives.begin();
|
||||
it != first_derivatives.end(); it++)
|
||||
{
|
||||
if (it != first_derivatives.begin())
|
||||
|
@ -2799,7 +2799,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
|
|||
<< " \"nrows\": " << equations.size()
|
||||
<< ", \"ncols\": " << g2ncols
|
||||
<< ", \"entries\": [";
|
||||
for (second_derivatives_t::const_iterator it = second_derivatives.begin();
|
||||
for (auto it = second_derivatives.begin();
|
||||
it != second_derivatives.end(); it++)
|
||||
{
|
||||
if (it != second_derivatives.begin())
|
||||
|
@ -2845,7 +2845,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
|
|||
<< " \"nrows\": " << equations.size()
|
||||
<< ", \"ncols\": " << hessianColsNbr * JacobianColsNbr
|
||||
<< ", \"entries\": [";
|
||||
for (third_derivatives_t::const_iterator it = third_derivatives.begin();
|
||||
for (auto it = third_derivatives.begin();
|
||||
it != third_derivatives.end(); it++)
|
||||
{
|
||||
if (it != third_derivatives.begin())
|
||||
|
@ -2874,7 +2874,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
|
|||
cols.insert(id3 * hessianColsNbr + id2 * JacobianColsNbr + id1);
|
||||
|
||||
third_derivatives_output << ", \"col\": [";
|
||||
for (set<int>::iterator it2 = cols.begin(); it2 != cols.end(); it2++)
|
||||
for (auto it2 = cols.begin(); it2 != cols.end(); it2++)
|
||||
{
|
||||
if (it2 != cols.begin())
|
||||
third_derivatives_output << ", ";
|
||||
|
@ -2933,7 +2933,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< " \"neqs\": " << equations.size()
|
||||
<< ", \"nparamcols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (first_derivatives_t::const_iterator it = residuals_params_derivatives.begin();
|
||||
for (auto it = residuals_params_derivatives.begin();
|
||||
it != residuals_params_derivatives.end(); it++)
|
||||
{
|
||||
if (it != residuals_params_derivatives.begin())
|
||||
|
@ -2965,7 +2965,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< ", \"nvarcols\": " << symbol_table.endo_nbr()
|
||||
<< ", \"nparamcols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (second_derivatives_t::const_iterator it = jacobian_params_derivatives.begin();
|
||||
for (auto it = jacobian_params_derivatives.begin();
|
||||
it != jacobian_params_derivatives.end(); it++)
|
||||
{
|
||||
if (it != jacobian_params_derivatives.begin())
|
||||
|
@ -3001,7 +3001,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< ", \"nparam1cols\": " << symbol_table.param_nbr()
|
||||
<< ", \"nparam2cols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (second_derivatives_t::const_iterator it = residuals_params_second_derivatives.begin();
|
||||
for (auto it = residuals_params_second_derivatives.begin();
|
||||
it != residuals_params_second_derivatives.end(); ++it)
|
||||
{
|
||||
if (it != residuals_params_second_derivatives.begin())
|
||||
|
@ -3038,7 +3038,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< ", \"nparam1cols\": " << symbol_table.param_nbr()
|
||||
<< ", \"nparam2cols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (third_derivatives_t::const_iterator it = jacobian_params_second_derivatives.begin();
|
||||
for (auto it = jacobian_params_second_derivatives.begin();
|
||||
it != jacobian_params_second_derivatives.end(); ++it)
|
||||
{
|
||||
if (it != jacobian_params_second_derivatives.begin())
|
||||
|
@ -3079,7 +3079,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
<< ", \"nvar2cols\": " << symbol_table.endo_nbr()
|
||||
<< ", \"nparamcols\": " << symbol_table.param_nbr()
|
||||
<< ", \"entries\": [";
|
||||
for (third_derivatives_t::const_iterator it = hessian_params_derivatives.begin();
|
||||
for (auto it = hessian_params_derivatives.begin();
|
||||
it != hessian_params_derivatives.end(); ++it)
|
||||
{
|
||||
if (it != hessian_params_derivatives.begin())
|
||||
|
|
|
@ -134,7 +134,7 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
|
|||
<< "\\footnotesize" << endl;
|
||||
|
||||
for (const auto & it : def_table)
|
||||
for (vector<int>::const_iterator it1 = it.first.begin(); it1 != it.first.end(); it1++)
|
||||
for (auto it1 = it.first.begin(); it1 != it.first.end(); it1++)
|
||||
{
|
||||
int id = *it1;
|
||||
expr_t value = it.second;
|
||||
|
@ -193,7 +193,7 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model
|
|||
output << "[";
|
||||
for (size_t j = 0; j < symb_ids.size(); j++)
|
||||
{
|
||||
variable_node_map_t::const_iterator it = variable_node_map.find(make_pair(symb_ids[j], 0));
|
||||
auto it = variable_node_map.find(make_pair(symb_ids[j], 0));
|
||||
assert(it != variable_node_map.end());
|
||||
dynamic_cast<ExprNode *>(it->second)->writeOutput(output, output_type);
|
||||
if (j < symb_ids.size()-1)
|
||||
|
@ -254,7 +254,7 @@ SteadyStateModel::writeSteadyStateFileC(const string &basename, bool ramsey_mode
|
|||
output << " ";
|
||||
if (symb_ids.size() > 1)
|
||||
std::cout << "Error: in C, multiple returns are not permitted in steady_state_model" << std::endl;
|
||||
variable_node_map_t::const_iterator it = variable_node_map.find(make_pair(symb_ids[0], 0));
|
||||
auto it = variable_node_map.find(make_pair(symb_ids[0], 0));
|
||||
assert(it != variable_node_map.end());
|
||||
if (it->second->get_type() == eModFileLocalVariable)
|
||||
output << "double ";
|
||||
|
@ -290,7 +290,7 @@ SteadyStateModel::writeJsonSteadyStateFile(ostream &output, bool transformComput
|
|||
{
|
||||
if (j != 0)
|
||||
output << ",";
|
||||
variable_node_map_t::const_iterator it =
|
||||
auto it =
|
||||
variable_node_map.find(make_pair(symb_ids[j], 0));
|
||||
assert(it != variable_node_map.end());
|
||||
output << "\"";
|
||||
|
|
|
@ -29,7 +29,7 @@ void
|
|||
SymbolList::writeOutput(const string &varname, ostream &output) const
|
||||
{
|
||||
output << varname << " = {";
|
||||
for (vector<string>::const_iterator it = symbols.begin();
|
||||
for (auto it = symbols.begin();
|
||||
it != symbols.end(); ++it)
|
||||
{
|
||||
if (it != symbols.begin())
|
||||
|
@ -43,7 +43,7 @@ void
|
|||
SymbolList::writeJsonOutput(ostream &output) const
|
||||
{
|
||||
output << "\"symbol_list\": [";
|
||||
for (vector<string>::const_iterator it = symbols.begin();
|
||||
for (auto it = symbols.begin();
|
||||
it != symbols.end(); ++it)
|
||||
{
|
||||
if (it != symbols.begin())
|
||||
|
|
|
@ -198,7 +198,7 @@ SymbolTable::getPartitionsForType(enum SymbolType st) const throw (UnknownSymbol
|
|||
map<string, map<int, string> > partitions;
|
||||
for (const auto & it : partition_value_map)
|
||||
if (getType(it.first) == st)
|
||||
for (map<string, string>::const_iterator it1 = it.second.begin();
|
||||
for (auto it1 = it.second.begin();
|
||||
it1 != it.second.end(); it1++)
|
||||
{
|
||||
if (partitions.find(it1->first) == partitions.end())
|
||||
|
@ -393,7 +393,7 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
|
|||
{
|
||||
int ic = 1;
|
||||
output << "options_.varobs = cell(" << observedVariablesNbr() << ", 1);" << endl;
|
||||
for (vector<int>::const_iterator it = varobs.begin();
|
||||
for (auto it = varobs.begin();
|
||||
it != varobs.end(); it++, ic++)
|
||||
output << "options_.varobs(" << ic << ") = {'" << getName(*it) << "'};" << endl;
|
||||
|
||||
|
@ -407,7 +407,7 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
|
|||
{
|
||||
int ic = 1;
|
||||
output << "options_.varexobs = cell(1);" << endl;
|
||||
for (vector<int>::const_iterator it = varexobs.begin();
|
||||
for (auto it = varexobs.begin();
|
||||
it != varexobs.end(); it++, ic++)
|
||||
output << "options_.varexobs(" << ic << ") = {'" << getName(*it) << "'};" << endl;
|
||||
|
||||
|
@ -498,7 +498,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
|
|||
if (predeterminedNbr() > 0)
|
||||
{
|
||||
output << "int predetermined_variables[" << predeterminedNbr() << "] = {";
|
||||
for (set<int>::const_iterator it = predetermined_variables.begin();
|
||||
for (auto it = predetermined_variables.begin();
|
||||
it != predetermined_variables.end(); it++)
|
||||
{
|
||||
if (it != predetermined_variables.begin())
|
||||
|
@ -512,7 +512,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
|
|||
if (observedVariablesNbr() > 0)
|
||||
{
|
||||
output << "int varobs[" << observedVariablesNbr() << "] = {";
|
||||
for (vector<int>::const_iterator it = varobs.begin();
|
||||
for (auto it = varobs.begin();
|
||||
it != varobs.end(); it++)
|
||||
{
|
||||
if (it != varobs.begin())
|
||||
|
@ -526,7 +526,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
|
|||
if (observedExogenousVariablesNbr() > 0)
|
||||
{
|
||||
output << "int varexobs[" << observedExogenousVariablesNbr() << "] = {";
|
||||
for (vector<int>::const_iterator it = varexobs.begin();
|
||||
for (auto it = varexobs.begin();
|
||||
it != varexobs.end(); it++)
|
||||
{
|
||||
if (it != varexobs.begin())
|
||||
|
@ -926,7 +926,7 @@ SymbolTable::isObservedVariable(int symb_id) const
|
|||
int
|
||||
SymbolTable::getObservedVariableIndex(int symb_id) const
|
||||
{
|
||||
vector<int>::const_iterator it = find(varobs.begin(), varobs.end(), symb_id);
|
||||
auto it = find(varobs.begin(), varobs.end(), symb_id);
|
||||
assert(it != varobs.end());
|
||||
return (int) (it - varobs.begin());
|
||||
}
|
||||
|
@ -954,7 +954,7 @@ SymbolTable::isObservedExogenousVariable(int symb_id) const
|
|||
int
|
||||
SymbolTable::getObservedExogenousVariableIndex(int symb_id) const
|
||||
{
|
||||
vector<int>::const_iterator it = find(varexobs.begin(), varexobs.end(), symb_id);
|
||||
auto it = find(varexobs.begin(), varexobs.end(), symb_id);
|
||||
assert(it != varexobs.end());
|
||||
return (int) (it - varexobs.begin());
|
||||
}
|
||||
|
|
|
@ -404,7 +404,7 @@ SymbolTable::validateSymbID(int symb_id) const throw (UnknownSymbolIDException)
|
|||
inline bool
|
||||
SymbolTable::exists(const string &name) const
|
||||
{
|
||||
symbol_table_type::const_iterator iter = symbol_table.find(name);
|
||||
auto iter = symbol_table.find(name);
|
||||
return (iter != symbol_table.end());
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ SymbolTable::getType(const string &name) const throw (UnknownSymbolNameException
|
|||
inline int
|
||||
SymbolTable::getID(const string &name) const throw (UnknownSymbolNameException)
|
||||
{
|
||||
symbol_table_type::const_iterator iter = symbol_table.find(name);
|
||||
auto iter = symbol_table.find(name);
|
||||
if (iter != symbol_table.end())
|
||||
return iter->second;
|
||||
else
|
||||
|
|
|
@ -98,7 +98,7 @@ MacroDriver::set_variable(const string &name, const MacroValue *value)
|
|||
const MacroValue *
|
||||
MacroDriver::get_variable(const string &name) const throw (UnknownVariable)
|
||||
{
|
||||
map<string, const MacroValue *>::const_iterator it = env.find(name);
|
||||
auto it = env.find(name);
|
||||
if (it == env.end())
|
||||
throw UnknownVariable(name);
|
||||
return it->second;
|
||||
|
@ -107,8 +107,8 @@ MacroDriver::get_variable(const string &name) const throw (UnknownVariable)
|
|||
void
|
||||
MacroDriver::init_loop(const string &name, const MacroValue *value) throw (MacroValue::TypeError)
|
||||
{
|
||||
const ArrayMV<int> *mv1 = dynamic_cast<const ArrayMV<int> *>(value);
|
||||
const ArrayMV<string> *mv2 = dynamic_cast<const ArrayMV<string> *>(value);
|
||||
const auto *mv1 = dynamic_cast<const ArrayMV<int> *>(value);
|
||||
const auto *mv2 = dynamic_cast<const ArrayMV<string> *>(value);
|
||||
if (!mv1 && !mv2)
|
||||
throw MacroValue::TypeError("Argument of @#for loop must be an array expression");
|
||||
loop_stack.push(make_pair(name, make_pair(value, 0)));
|
||||
|
@ -124,7 +124,7 @@ MacroDriver::iter_loop()
|
|||
const MacroValue *mv = loop_stack.top().second.first;
|
||||
string name = loop_stack.top().first;
|
||||
|
||||
const ArrayMV<int> *mv1 = dynamic_cast<const ArrayMV<int> *>(mv);
|
||||
const auto *mv1 = dynamic_cast<const ArrayMV<int> *>(mv);
|
||||
if (mv1)
|
||||
{
|
||||
if (i >= (int) mv1->values.size())
|
||||
|
@ -140,7 +140,7 @@ MacroDriver::iter_loop()
|
|||
}
|
||||
else
|
||||
{
|
||||
const ArrayMV<string> *mv2 = dynamic_cast<const ArrayMV<string> *>(mv);
|
||||
const auto *mv2 = dynamic_cast<const ArrayMV<string> *>(mv);
|
||||
if (i >= (int) mv2->values.size())
|
||||
{
|
||||
loop_stack.pop();
|
||||
|
@ -157,7 +157,7 @@ MacroDriver::iter_loop()
|
|||
void
|
||||
MacroDriver::begin_if(const MacroValue *value) throw (MacroValue::TypeError)
|
||||
{
|
||||
const IntMV *ival = dynamic_cast<const IntMV *>(value);
|
||||
const auto *ival = dynamic_cast<const IntMV *>(value);
|
||||
if (!ival)
|
||||
throw MacroValue::TypeError("Argument of @#if must be an integer");
|
||||
last_if = (bool) ival->value;
|
||||
|
@ -194,7 +194,7 @@ MacroDriver::begin_ifndef(const string &name)
|
|||
void
|
||||
MacroDriver::echo(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError)
|
||||
{
|
||||
const StringMV *sval = dynamic_cast<const StringMV *>(value);
|
||||
const auto *sval = dynamic_cast<const StringMV *>(value);
|
||||
if (!sval)
|
||||
throw MacroValue::TypeError("Argument of @#echo must be a string");
|
||||
|
||||
|
@ -204,7 +204,7 @@ MacroDriver::echo(const Macro::parser::location_type &l, const MacroValue *value
|
|||
void
|
||||
MacroDriver::error(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError)
|
||||
{
|
||||
const StringMV *sval = dynamic_cast<const StringMV *>(value);
|
||||
const auto *sval = dynamic_cast<const StringMV *>(value);
|
||||
if (!sval)
|
||||
throw MacroValue::TypeError("Argument of @#error must be a string");
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ IntMV::~IntMV()
|
|||
const MacroValue *
|
||||
IntMV::operator+(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of + operator");
|
||||
return new IntMV(driver, value + mv2->value);
|
||||
|
@ -164,7 +164,7 @@ IntMV::operator+() const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator-(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of - operator");
|
||||
return new IntMV(driver, value - mv2->value);
|
||||
|
@ -179,7 +179,7 @@ IntMV::operator-() const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator*(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of * operator");
|
||||
return new IntMV(driver, value * mv2->value);
|
||||
|
@ -188,7 +188,7 @@ IntMV::operator*(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator/(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of / operator");
|
||||
return new IntMV(driver, value / mv2->value);
|
||||
|
@ -197,7 +197,7 @@ IntMV::operator/(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator<(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of < operator");
|
||||
return new IntMV(driver, value < mv2->value);
|
||||
|
@ -206,7 +206,7 @@ IntMV::operator<(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator>(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of > operator");
|
||||
return new IntMV(driver, value > mv2->value);
|
||||
|
@ -215,7 +215,7 @@ IntMV::operator>(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator<=(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of <= operator");
|
||||
return new IntMV(driver, value <= mv2->value);
|
||||
|
@ -224,7 +224,7 @@ IntMV::operator<=(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator>=(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of >= operator");
|
||||
return new IntMV(driver, value >= mv2->value);
|
||||
|
@ -233,7 +233,7 @@ IntMV::operator>=(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator==(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
return new IntMV(driver, 0);
|
||||
else
|
||||
|
@ -243,7 +243,7 @@ IntMV::operator==(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator!=(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
return new IntMV(driver, 1);
|
||||
else
|
||||
|
@ -253,7 +253,7 @@ IntMV::operator!=(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator&&(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of && operator");
|
||||
return new IntMV(driver, value && mv2->value);
|
||||
|
@ -262,7 +262,7 @@ IntMV::operator&&(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::operator||(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of || operator");
|
||||
return new IntMV(driver, value || mv2->value);
|
||||
|
@ -299,7 +299,7 @@ IntMV::toArray() const
|
|||
const MacroValue *
|
||||
IntMV::append(const MacroValue *array) const throw (TypeError)
|
||||
{
|
||||
const ArrayMV<int> *array2 = dynamic_cast<const ArrayMV<int> *>(array);
|
||||
const auto *array2 = dynamic_cast<const ArrayMV<int> *>(array);
|
||||
if (array2 == NULL)
|
||||
throw TypeError("Type mismatch for append operation");
|
||||
|
||||
|
@ -311,7 +311,7 @@ IntMV::append(const MacroValue *array) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::in(const MacroValue *array) const throw (TypeError)
|
||||
{
|
||||
const ArrayMV<int> *array2 = dynamic_cast<const ArrayMV<int> *>(array);
|
||||
const auto *array2 = dynamic_cast<const ArrayMV<int> *>(array);
|
||||
if (array2 == NULL)
|
||||
throw TypeError("Type mismatch for 'in' operator");
|
||||
|
||||
|
@ -329,8 +329,8 @@ IntMV::in(const MacroValue *array) const throw (TypeError)
|
|||
const MacroValue *
|
||||
IntMV::new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError)
|
||||
{
|
||||
const IntMV *mv1i = dynamic_cast<const IntMV *>(mv1);
|
||||
const IntMV *mv2i = dynamic_cast<const IntMV *>(mv2);
|
||||
const auto *mv1i = dynamic_cast<const IntMV *>(mv1);
|
||||
const auto *mv2i = dynamic_cast<const IntMV *>(mv2);
|
||||
if (mv1i == NULL || mv2i == NULL)
|
||||
throw TypeError("Arguments of range operator (:) must be integers");
|
||||
|
||||
|
@ -355,7 +355,7 @@ StringMV::~StringMV()
|
|||
const MacroValue *
|
||||
StringMV::operator+(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const StringMV *mv2 = dynamic_cast<const StringMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const StringMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of + operator");
|
||||
return new StringMV(driver, value + mv2->value);
|
||||
|
@ -364,7 +364,7 @@ StringMV::operator+(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
StringMV::operator==(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const StringMV *mv2 = dynamic_cast<const StringMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const StringMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
return new IntMV(driver, 0);
|
||||
else
|
||||
|
@ -374,7 +374,7 @@ StringMV::operator==(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
StringMV::operator!=(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const StringMV *mv2 = dynamic_cast<const StringMV *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const StringMV *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
return new IntMV(driver, 1);
|
||||
else
|
||||
|
@ -384,7 +384,7 @@ StringMV::operator!=(const MacroValue &mv) const throw (TypeError)
|
|||
const MacroValue *
|
||||
StringMV::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError)
|
||||
{
|
||||
const ArrayMV<int> *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Expression inside [] must be an integer array");
|
||||
string result;
|
||||
|
@ -421,7 +421,7 @@ StringMV::toArray() const
|
|||
const MacroValue *
|
||||
StringMV::append(const MacroValue *array) const throw (TypeError)
|
||||
{
|
||||
const ArrayMV<string> *array2 = dynamic_cast<const ArrayMV<string> *>(array);
|
||||
const auto *array2 = dynamic_cast<const ArrayMV<string> *>(array);
|
||||
if (array2 == NULL)
|
||||
throw TypeError("Type mismatch for append operation");
|
||||
|
||||
|
@ -433,7 +433,7 @@ StringMV::append(const MacroValue *array) const throw (TypeError)
|
|||
const MacroValue *
|
||||
StringMV::in(const MacroValue *array) const throw (TypeError)
|
||||
{
|
||||
const ArrayMV<string> *array2 = dynamic_cast<const ArrayMV<string> *>(array);
|
||||
const auto *array2 = dynamic_cast<const ArrayMV<string> *>(array);
|
||||
if (array2 == NULL)
|
||||
throw TypeError("Type mismatch for 'in' operator");
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ template<typename T>
|
|||
const MacroValue *
|
||||
ArrayMV<T>::operator+(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const ArrayMV<T> *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of + operator");
|
||||
|
||||
|
@ -266,14 +266,14 @@ template<typename T>
|
|||
const MacroValue *
|
||||
ArrayMV<T>::operator-(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const ArrayMV<T> *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Type mismatch for operands of - operator");
|
||||
|
||||
/* Highly inefficient algorithm for computing set difference
|
||||
(but vector<T> is not suited for that...) */
|
||||
vector<T> new_values;
|
||||
for (typename vector<T>::const_iterator it = values.begin();
|
||||
for (auto it = values.begin();
|
||||
it != values.end(); it++)
|
||||
{
|
||||
typename vector<T>::const_iterator it2;
|
||||
|
@ -291,7 +291,7 @@ template<typename T>
|
|||
const MacroValue *
|
||||
ArrayMV<T>::operator==(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const ArrayMV<T> *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
return new IntMV(driver, 0);
|
||||
else
|
||||
|
@ -302,7 +302,7 @@ template<typename T>
|
|||
const MacroValue *
|
||||
ArrayMV<T>::operator!=(const MacroValue &mv) const throw (TypeError)
|
||||
{
|
||||
const ArrayMV<T> *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
return new IntMV(driver, 1);
|
||||
else
|
||||
|
@ -313,7 +313,7 @@ template<typename T>
|
|||
const MacroValue *
|
||||
ArrayMV<T>::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError)
|
||||
{
|
||||
const ArrayMV<int> *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv);
|
||||
const auto *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv);
|
||||
if (mv2 == NULL)
|
||||
throw TypeError("Expression inside [] must be an integer array");
|
||||
vector<T> result;
|
||||
|
@ -335,7 +335,7 @@ string
|
|||
ArrayMV<T>::toString() const
|
||||
{
|
||||
ostringstream ss;
|
||||
for (typename vector<T>::const_iterator it = values.begin();
|
||||
for (auto it = values.begin();
|
||||
it != values.end(); it++)
|
||||
ss << *it;
|
||||
return ss.str();
|
||||
|
@ -348,7 +348,7 @@ ArrayMV<T>::print() const
|
|||
bool printStrArr = false;
|
||||
try
|
||||
{
|
||||
typename vector<T>::const_iterator it = values.begin();
|
||||
auto it = values.begin();
|
||||
boost::lexical_cast<int>(*it);
|
||||
}
|
||||
catch (boost::bad_lexical_cast &)
|
||||
|
@ -360,7 +360,7 @@ ArrayMV<T>::print() const
|
|||
ss << "{";
|
||||
else
|
||||
ss << "[";
|
||||
for (typename vector<T>::const_iterator it = values.begin();
|
||||
for (auto it = values.begin();
|
||||
it != values.end(); it++)
|
||||
{
|
||||
if (it != values.begin())
|
||||
|
|
Loading…
Reference in New Issue