Verified Commit f88682d6 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

pac: output model type in M_.pac.(model_name)

parent 5e1521f4
Pipeline #851 passed with stage
in 1 minute and 27 seconds
......@@ -3657,6 +3657,8 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
if (growth_param_index >= 0)
output << modstruct << "pac." << it.first << ".growth_neutrality_param_index = "
<< symbol_table.getTypeSpecificID(growth_param_index) + 1 << ";" << endl;
output << modstruct << "pac." << it.first << ".auxiliary_model_type = '" << get<2>(it.second) << "';" << endl;
}
for (auto & pit : pac_equation_info)
......@@ -4606,6 +4608,7 @@ void
DynamicModel::fillPacModelInfo(const string &pac_model_name,
vector<int> lhs,
int max_lag,
string aux_model_type,
const map<pair<string, string>, pair<string, int>> &eqtag_and_lag,
const vector<bool> &nonstationary,
int growth_symb_id, int growth_lag)
......@@ -4675,7 +4678,7 @@ DynamicModel::fillPacModelInfo(const string &pac_model_name,
pac_expectation_substitution[make_pair(pac_model_name, eqtag)] = subExpr;
}
pac_model_info[pac_model_name] = make_tuple(move(lhs), growth_param_index);
pac_model_info[pac_model_name] = make_tuple(move(lhs), growth_param_index, move(aux_model_type));
  • As for make_pair, you can get rid of make_tuple and just write:

      pac_model_info[pac_model_name] = { move(lhs), growth_param_index, move(aux_model_type) };
Please register or sign in to reply
}
void
......
......@@ -346,6 +346,7 @@ public:
void fillPacModelInfo(const string &pac_model_name,
vector<int> lhs,
int max_lag,
string aux_model_type,
const map<pair<string, string>, pair<string, int>> &eqtag_and_lag,
const vector<bool> &nonstationary,
int growth_symb_id, int growth_lag);
......@@ -476,8 +477,8 @@ public:
map<pair<string, string>, expr_t> pac_expectation_substitution;
//! Store info about pac models:
//! pac_model_name -> (lhsvars, growth_param_index)
map<string, pair<vector<int>, int>> pac_model_info;
//! pac_model_name -> (lhsvars, growth_param_index, aux_model_type)
map<string, tuple<vector<int>, int, string>> pac_model_info;
//! Store info about pac models specific to the equation they appear in
//! (pac_model_name, standardized_eqtag) ->
......
......@@ -421,8 +421,10 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
int max_lag;
vector<int> lhs;
vector<bool> nonstationary;
string aux_model_type = "";
  • No need to initialize a string to "", it is already empty when using the default constructor.

Please register or sign in to reply
if (trend_component_model_table.isExistingTrendComponentModelName(pms->aux_model_name))
{
aux_model_type = "trend_component";
max_lag = trend_component_model_table.getMaxLag(pms->aux_model_name) + 1;
lhs = dynamic_model.getUndiffLHSForPac(pms->aux_model_name, diff_subst_table);
// All lhs variables in a trend component model are nonstationary
......@@ -430,6 +432,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
}
else if (var_model_table.isExistingVarModelName(pms->aux_model_name))
{
aux_model_type = "var";
max_lag = var_model_table.getMaxLag(pms->aux_model_name);
lhs = var_model_table.getLhs(pms->aux_model_name);
// nonstationary variables in a VAR are those that are in diff
......@@ -449,7 +452,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
dynamic_model.addPacModelConsistentExpectationEquation(pms->name, symbol_table.getID(pms->discount),
eqtag_and_lag, diff_subst_table);
else
dynamic_model.fillPacModelInfo(pms->name, lhs, max_lag,
dynamic_model.fillPacModelInfo(pms->name, lhs, max_lag, aux_model_type,
eqtag_and_lag, nonstationary, pms->growth_symb_id, pms->growth_lag);
dynamic_model.substitutePacExpectation(pms->name);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment