further simplifications related to AR matrices

parent f1d1c1e1
Pipeline #982 passed with stage
in 1 minute and 30 seconds
......@@ -5872,21 +5872,10 @@ BinaryOpNode::fillAutoregressiveRow(int eqn, const vector<int> &lhs, map<tuple<i
}
if (vid >= 0)
{
int vidineq = vid;
while (datatree.symbol_table.isAuxiliaryVariable(vid))
try
{
vid = datatree.symbol_table.getOrigSymbIdForAuxVar(vid);
}
catch (...)
{
break;
}
if (vidineq != vid)
if (datatree.symbol_table.isDiffAuxiliaryVariable(vid))
{
vid = datatree.symbol_table.getOrigSymbIdForDiffAuxVar(vidineq);
lag = -datatree.symbol_table.getOrigLeadLagForDiffAuxVar(vidineq);
lag = -datatree.symbol_table.getOrigLeadLagForDiffAuxVar(vid);
vid = datatree.symbol_table.getOrigSymbIdForDiffAuxVar(vid);
}
if (find(lhs.begin(), lhs.end(), vid) == lhs.end())
......
......@@ -1091,6 +1091,18 @@ SymbolTable::isAuxiliaryVariableButNotMultiplier(int symb_id) const
return false;
}
bool
SymbolTable::isDiffAuxiliaryVariable(int symb_id) const
{
for (const auto & aux_var : aux_vars)
if (aux_var.get_symb_id() == symb_id &&
(aux_var.get_type() == AuxVarType::diff
|| aux_var.get_type() == AuxVarType::diffLag
|| aux_var.get_type() == AuxVarType::diffLead))
return true;
return false;
}
set<int>
SymbolTable::getOrigEndogenous() const
{
......
......@@ -408,6 +408,8 @@ public:
bool isAuxiliaryVariable(int symb_id) const;
//! Is a given symbol an auxiliary variable but not a Lagrange multiplier
bool isAuxiliaryVariableButNotMultiplier(int symb_id) const;
//! Is a given symbol a diff, diff lead, or diff lag auxiliary variable
bool isDiffAuxiliaryVariable(int symb_id) const;
//! Get list of endogenous variables without aux vars
set <int> getOrigEndogenous() const;
};
......
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