simplify updating of RHS variables for trend component and var models
parent
16f10d954f
commit
d5d6e8beb0
|
@ -3455,6 +3455,37 @@ DynamicModel::runTrendTest(const eval_context_t &eval_context)
|
|||
testTrendDerivativesEqualToZero(eval_context);
|
||||
}
|
||||
|
||||
void
|
||||
DynamicModel::updateVarAndTrendModelRhs() const
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
map<string, vector<int>> eqnums;
|
||||
if (i == 0)
|
||||
eqnums = var_model_table.getEqNums();
|
||||
else if (i == 1)
|
||||
eqnums = trend_component_model_table.getEqNums();
|
||||
|
||||
map<string, vector<set<pair<int, int>>>> rhsr;
|
||||
for (const auto & it : eqnums)
|
||||
{
|
||||
vector<set<pair<int, int>>> rhs;
|
||||
for (auto eqn : it.second)
|
||||
{
|
||||
set<pair<int, int>> rhs_set;
|
||||
equations[eqn]->get_arg2()->collectDynamicVariables(SymbolType::endogenous, rhs_set);
|
||||
rhs.push_back(rhs_set);
|
||||
}
|
||||
rhsr[it.first] = rhs;
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
var_model_table.setRhs(rhsr);
|
||||
else if (i == 1)
|
||||
trend_component_model_table.setRhs(rhsr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DynamicModel::fillVarModelTable() const
|
||||
{
|
||||
|
|
|
@ -312,6 +312,10 @@ public:
|
|||
void fillVarModelTable() const;
|
||||
void fillVarModelTableFromOrigModel(StaticModel &static_model) const;
|
||||
|
||||
//! Update the rhs references in the var model and trend component tables
|
||||
//! after substitution of auxiliary variables
|
||||
void updateVarAndTrendModelRhs() const;
|
||||
|
||||
//! Add aux equations (and aux variables) for variables declared in var_model
|
||||
//! at max order if they don't already exist
|
||||
void addEquationsForVar();
|
||||
|
|
|
@ -580,8 +580,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
|
|||
dynamic_model.substituteEndoLagGreaterThanTwo(true);
|
||||
}
|
||||
|
||||
dynamic_model.fillVarModelTable();
|
||||
dynamic_model.fillTrendComponentModelTable();
|
||||
dynamic_model.updateVarAndTrendModelRhs();
|
||||
|
||||
if (differentiate_forward_vars)
|
||||
dynamic_model.differentiateForwardVars(differentiate_forward_vars_subset);
|
||||
|
|
Loading…
Reference in New Issue