replace make_pair and make_tuple
parent
b09b50472b
commit
469a328cfc
|
@ -57,7 +57,7 @@ DynamicModel::copyHelper(const DynamicModel &m)
|
|||
first_chain_rule_derivatives[it.first] = f(it.second);
|
||||
|
||||
for (const auto &it : m.equation_type_and_normalized_equation)
|
||||
equation_type_and_normalized_equation.push_back(make_pair(it.first, f(it.second)));
|
||||
equation_type_and_normalized_equation.push_back({it.first, f(it.second)});
|
||||
|
||||
for (const auto &it : m.blocks_derivatives)
|
||||
{
|
||||
|
@ -3634,7 +3634,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
|
|||
{
|
||||
if (for_writing.find(it.first.first) == for_writing.end())
|
||||
for_writing.insert(pair<string,vector<pair<string,string>> >(it.first.first, vector<pair<string,string>>()));
|
||||
for_writing[it.first.first].push_back(make_pair(it.first.second, it.second.first));
|
||||
for_writing[it.first.first].push_back({it.first.second, it.second.first});
|
||||
}
|
||||
|
||||
for (auto & it : for_writing)
|
||||
|
@ -4436,10 +4436,10 @@ DynamicModel::walkPacParameters(const string &name, map<pair<string, string>, pa
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
string eq = "eq" + to_string(i++);
|
||||
pac_equation_info[make_pair(name, eq)] = make_tuple(lhs, optim_share_index,
|
||||
ar_params_and_vars, ec_params_and_vars,
|
||||
non_optim_vars_params_and_constants);
|
||||
eqtag_and_lag[make_pair(name, eqtag)] = make_pair(eq, 0);
|
||||
pac_equation_info[{name, eq}] = {lhs, optim_share_index,
|
||||
ar_params_and_vars, ec_params_and_vars,
|
||||
non_optim_vars_params_and_constants};
|
||||
eqtag_and_lag[{name, eqtag}] = {eq, 0};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4467,8 +4467,8 @@ DynamicModel::getPacMaxLag(const string &pac_model_name, map<pair<string, string
|
|||
eqtag = tag.second.second;
|
||||
break;
|
||||
}
|
||||
string eq = eqtag_and_lag[make_pair(pac_model_name, eqtag)].first;
|
||||
eqtag_and_lag[make_pair(pac_model_name, eqtag)] = make_pair(eq, equation->PacMaxLag((*(endogs.begin())).first));
|
||||
string eq = eqtag_and_lag[{pac_model_name, eqtag}].first;
|
||||
eqtag_and_lag[{pac_model_name, eqtag}] = {eq, equation->PacMaxLag((*(endogs.begin())).first)};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4530,7 +4530,7 @@ DynamicModel::addPacModelConsistentExpectationEquation(const string & name, int
|
|||
{
|
||||
int alpha_i_symb_id = symbol_table.addSymbol("mce_alpha_" + append_to_name + "_" + to_string(i),
|
||||
SymbolType::parameter);
|
||||
pac_mce_alpha_symb_ids[make_pair(name, standard_eqtag)].push_back(alpha_i_symb_id);
|
||||
pac_mce_alpha_symb_ids[{name, standard_eqtag}].push_back(alpha_i_symb_id);
|
||||
A = AddPlus(A, AddVariable(alpha_i_symb_id));
|
||||
fp = AddPlus(fp,
|
||||
AddTimes(AddTimes(AddVariable(alpha_i_symb_id),
|
||||
|
@ -4598,8 +4598,8 @@ DynamicModel::addPacModelConsistentExpectationEquation(const string & name, int
|
|||
addEquation(AddEqual(AddVariable(mce_z1_symb_id),
|
||||
AddMinus(AddTimes(A, AddMinus((expr_t) target_base_diff_node, fs)), fp)), -1);
|
||||
neqs++;
|
||||
pac_mce_z1_symb_ids[make_pair(name, standard_eqtag)] = mce_z1_symb_id;
|
||||
pac_expectation_substitution[make_pair(name, eqtag)] = AddVariable(mce_z1_symb_id);
|
||||
pac_mce_z1_symb_ids[{name, standard_eqtag}] = mce_z1_symb_id;
|
||||
pac_expectation_substitution[{name, eqtag}] = AddVariable(mce_z1_symb_id);
|
||||
}
|
||||
cout << "Pac Model Consistent Expectation: added " << neqs << " auxiliary variables and equations." << endl;
|
||||
}
|
||||
|
@ -4649,7 +4649,7 @@ DynamicModel::fillPacModelInfo(const string &pac_model_name,
|
|||
<< "_var_" << symbol_table.getName(lhsit)
|
||||
<< "_lag_" << i;
|
||||
int new_param_symb_id = symbol_table.addSymbol(param_name_h0.str(), SymbolType::parameter);
|
||||
pac_h0_indices[make_pair(pac_model_name, standard_eqtag)].push_back(new_param_symb_id);
|
||||
pac_h0_indices[{pac_model_name, standard_eqtag}].push_back(new_param_symb_id);
|
||||
subExpr = AddPlus(subExpr,
|
||||
AddTimes(AddVariable(new_param_symb_id),
|
||||
AddVariable(lhsit, -i)));
|
||||
|
@ -4665,7 +4665,7 @@ DynamicModel::fillPacModelInfo(const string &pac_model_name,
|
|||
<< "_var_" << symbol_table.getName(lhsit)
|
||||
<< "_lag_" << i;
|
||||
int new_param_symb_id = symbol_table.addSymbol(param_name_h1.str(), SymbolType::parameter);
|
||||
pac_h1_indices[make_pair(pac_model_name, standard_eqtag)].push_back(new_param_symb_id);
|
||||
pac_h1_indices[{pac_model_name, standard_eqtag}].push_back(new_param_symb_id);
|
||||
subExpr = AddPlus(subExpr,
|
||||
AddTimes(AddVariable(new_param_symb_id),
|
||||
AddVariable(lhsit, -i)));
|
||||
|
@ -4676,9 +4676,9 @@ DynamicModel::fillPacModelInfo(const string &pac_model_name,
|
|||
AddTimes(AddVariable(growth_param_index),
|
||||
AddVariable(growth_symb_id, growth_lag)));
|
||||
|
||||
pac_expectation_substitution[make_pair(pac_model_name, eqtag)] = subExpr;
|
||||
pac_expectation_substitution[{pac_model_name, eqtag}] = subExpr;
|
||||
}
|
||||
pac_model_info[pac_model_name] = make_tuple(move(lhs), growth_param_index, move(aux_model_type));
|
||||
pac_model_info[pac_model_name] = {move(lhs), growth_param_index, move(aux_model_type)};
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -5772,12 +5772,12 @@ BinaryOpNode::fillAutoregressiveRowHelper(expr_t arg1, expr_t arg2,
|
|||
if (find(lhs.begin(), lhs.end(), lhs_symb_id) == lhs.end())
|
||||
return;
|
||||
|
||||
if (AR.find(make_tuple(eqn, -lag, lhs_symb_id)) != AR.end())
|
||||
if (AR.find({eqn, -lag, lhs_symb_id}) != AR.end())
|
||||
{
|
||||
cerr << "BinaryOpNode::fillAutoregressiveRowHelper: Error filling AR matrix: lag/symb_id encountered more than once in equtaion" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
AR[make_tuple(eqn, -lag, lhs_symb_id)] = arg1;
|
||||
AR[{eqn, -lag, lhs_symb_id}] = arg1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -5875,21 +5875,21 @@ BinaryOpNode::fillErrorCorrectionRowHelper(expr_t arg1, expr_t arg2,
|
|||
else
|
||||
return;
|
||||
|
||||
if (A0.find(make_tuple(eqn, -A0_max_lag, A0_colidx)) != A0.end())
|
||||
if (A0.find({eqn, -A0_max_lag, A0_colidx}) != A0.end())
|
||||
{
|
||||
cerr << "BinaryOpNode::fillErrorCorrectionRowHelper: Error filling A0 matrix: "
|
||||
<< "lag/symb_id encountered more than once in equtaion" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (A0star.find(make_tuple(eqn, -A0star_max_lag, A0star_colidx)) != A0star.end())
|
||||
if (A0star.find({eqn, -A0star_max_lag, A0star_colidx}) != A0star.end())
|
||||
{
|
||||
cerr << "BinaryOpNode::fillErrorCorrectionRowHelper: Error filling A0star matrix: "
|
||||
<< "lag/symb_id encountered more than once in equtaion" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
A0[make_tuple(eqn, -A0_max_lag, A0_colidx)] = arg1;
|
||||
A0star[make_tuple(eqn, -A0star_max_lag, A0star_colidx)] = arg1;
|
||||
A0[{eqn, -A0_max_lag, A0_colidx}] = arg1;
|
||||
A0star[{eqn, -A0star_max_lag, A0star_colidx}] = arg1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5926,13 +5926,13 @@ BinaryOpNode::fillErrorCorrectionRowHelper(expr_t arg1, expr_t arg2,
|
|||
else
|
||||
return;
|
||||
|
||||
if (A0.find(make_tuple(eqn, -max_lag, colidx)) != A0.end())
|
||||
if (A0.find({eqn, -max_lag, colidx}) != A0.end())
|
||||
{
|
||||
cerr << "BinaryOpNode::fillErrorCorrectionRowHelper: Error filling A0 matrix: "
|
||||
<< "lag/symb_id encountered more than once in equtaion" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
A0[make_tuple(eqn, -max_lag, colidx)] = arg1;
|
||||
A0[{eqn, -max_lag, colidx}] = arg1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9624,7 +9624,7 @@ ExprNode::matchVariableTimesConstantTimesParam() const
|
|||
matchVTCTPHelper(variable_id, lag, param_id, constant, false);
|
||||
if (variable_id == -1)
|
||||
throw MatchFailureException{"No variable in this expression"};
|
||||
return make_tuple(variable_id, lag, param_id, constant);
|
||||
return {variable_id, lag, param_id, constant};
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2018 Dynare Team
|
||||
* Copyright (C) 2010-2019 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -36,7 +36,7 @@ SteadyStateModel::SteadyStateModel(const SteadyStateModel &m) :
|
|||
static_model {m.static_model}
|
||||
{
|
||||
for (const auto &it : m.def_table)
|
||||
def_table.push_back(make_pair(it.first, it.second->clone(*this)));
|
||||
def_table.push_back({it.first, it.second->clone(*this)});
|
||||
}
|
||||
|
||||
SteadyStateModel &
|
||||
|
@ -48,7 +48,7 @@ SteadyStateModel::operator=(const SteadyStateModel &m)
|
|||
|
||||
def_table.clear();
|
||||
for (const auto &it : m.def_table)
|
||||
def_table.push_back(make_pair(it.first, it.second->clone(*this)));
|
||||
def_table.push_back({it.first, it.second->clone(*this)});
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ Epilogue::Epilogue(const Epilogue &m) :
|
|||
DynamicModel {m}
|
||||
{
|
||||
for (const auto &it : m.def_table)
|
||||
def_table.push_back(make_pair(it.first, it.second->clone(*this)));
|
||||
def_table.push_back({it.first, it.second->clone(*this)});
|
||||
}
|
||||
|
||||
Epilogue &
|
||||
|
@ -308,7 +308,7 @@ Epilogue::operator=(const Epilogue &m)
|
|||
|
||||
def_table.clear();
|
||||
for (const auto &it : m.def_table)
|
||||
def_table.push_back(make_pair(it.first, it.second->clone(*this)));
|
||||
def_table.push_back({it.first, it.second->clone(*this)});
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ ModelTree::copyHelper(const ModelTree &m)
|
|||
for (const auto & it : m.trend_symbols_map)
|
||||
trend_symbols_map[it.first] = f(it.second);
|
||||
for (const auto & it : m.nonstationary_symbols_map)
|
||||
nonstationary_symbols_map[it.first] = make_pair(it.second.first, f(it.second.second));
|
||||
nonstationary_symbols_map[it.first] = {it.second.first, f(it.second.second)};
|
||||
}
|
||||
|
||||
ModelTree::ModelTree(SymbolTable &symbol_table_arg,
|
||||
|
@ -500,7 +500,7 @@ ModelTree::select_non_linear_equations_and_variables(vector<bool> is_equation_li
|
|||
}
|
||||
cout.flush();
|
||||
int nb_endo = is_equation_linear.size();
|
||||
vector<pair<int, int>> blocks(1, make_pair(i, i));
|
||||
vector<pair<int, int>> blocks(1, {i, i});
|
||||
inv_equation_reordered.resize(nb_endo);
|
||||
inv_variable_reordered.resize(nb_endo);
|
||||
for (int i = 0; i < nb_endo; i++)
|
||||
|
|
|
@ -1493,7 +1493,7 @@ ParsingDriver::var_model()
|
|||
error("You cannot pass the order option when passing equation tags to the var_model statement");
|
||||
}
|
||||
|
||||
mod_file->var_model_table.addVarModel(name, eqtags, make_pair(symbol_list, order));
|
||||
mod_file->var_model_table.addVarModel(name, eqtags, {symbol_list, order});
|
||||
symbol_list.clear();
|
||||
options_list.clear();
|
||||
var_map[its->second] = symbol_list.getSymbols();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2018 Dynare Team
|
||||
* Copyright (C) 2003-2019 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -55,7 +55,7 @@ StaticModel::copyHelper(const StaticModel &m)
|
|||
first_chain_rule_derivatives[it.first] = f(it.second);
|
||||
|
||||
for (const auto &it : m.equation_type_and_normalized_equation)
|
||||
equation_type_and_normalized_equation.push_back(make_pair(it.first, f(it.second)));
|
||||
equation_type_and_normalized_equation.push_back({it.first, f(it.second)});
|
||||
|
||||
for (const auto &it : m.blocks_derivatives)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue