Add several types of auxiliary variables to M_.mapping
In practice, only those auxiliary variables which do not have an orig_symb_id will be listed (in addition to unary ops, due to an implementation bug).pac-components
parent
2282d4773c
commit
a210a8fd59
|
@ -4546,19 +4546,17 @@ DynamicModel::ParamUsedWithLeadLag() const
|
|||
}
|
||||
|
||||
void
|
||||
DynamicModel::createVariableMapping(int orig_eq_nbr)
|
||||
DynamicModel::createVariableMapping()
|
||||
{
|
||||
for (int ii = 0; ii < orig_eq_nbr; ii++)
|
||||
for (size_t ii = 0; ii < equations.size(); ii++)
|
||||
{
|
||||
set<int> eqvars;
|
||||
equations[ii]->collectVariables(SymbolType::endogenous, eqvars);
|
||||
equations[ii]->collectVariables(SymbolType::exogenous, eqvars);
|
||||
for (auto eqvar : eqvars)
|
||||
{
|
||||
eqvar = symbol_table.getUltimateOrigSymbID(eqvar);
|
||||
if (eqvar >= 0 && !symbol_table.isAuxiliaryVariable(eqvar))
|
||||
variableMapping[eqvar].emplace(ii);
|
||||
}
|
||||
if (int orig_symb_id = symbol_table.getUltimateOrigSymbID(eqvar);
|
||||
orig_symb_id >= 0)
|
||||
variableMapping[orig_symb_id].emplace(ii);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ public:
|
|||
void writeDynamicJacobianNonZeroElts(const string &basename) const;
|
||||
|
||||
//! Creates mapping for variables and equations they are present in
|
||||
void createVariableMapping(int orig_eq_nbr);
|
||||
void createVariableMapping();
|
||||
|
||||
//! Expands equation tags with default equation names (available "name" tag or LHS variable or equation ID)
|
||||
void expandEqTags();
|
||||
|
|
|
@ -559,9 +559,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, bool
|
|||
}
|
||||
// And finally perform the substitutions
|
||||
dynamic_model.substituteVarExpectation(var_expectation_subst_table);
|
||||
dynamic_model.createVariableMapping(mod_file_struct.orig_eq_nbr +
|
||||
(mod_file_struct.ramsey_model_present ?
|
||||
mod_file_struct.ramsey_eq_nbr : 0));
|
||||
dynamic_model.createVariableMapping();
|
||||
|
||||
/* Create auxiliary vars for leads and lags greater than 2, on both endos and
|
||||
exos. The transformation is not exactly the same on stochastic and
|
||||
|
|
Loading…
Reference in New Issue