From 00d276b5090b3405f564bc5ff5f44e4b6d775058 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Thu, 5 Jul 2018 16:58:11 +0200 Subject: [PATCH] using node comparison w constant lags obviates need for static model --- src/DynamicModel.cc | 18 ++++++------- src/DynamicModel.hh | 6 ++--- src/ExprNode.cc | 62 ++++++++++++++++++++++----------------------- src/ExprNode.hh | 36 +++++++++++++------------- src/ModFile.cc | 7 +++-- 5 files changed, 64 insertions(+), 65 deletions(-) diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index b88d7d25..e2e0dfe4 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -5339,24 +5339,24 @@ DynamicModel::findPacExpectationEquationNumbers(vector<int> &eqnumbers) const } void -DynamicModel::substituteUnaryOps(StaticModel &static_model) +DynamicModel::substituteUnaryOps() { vector<int> eqnumbers(equations.size()); iota(eqnumbers.begin(), eqnumbers.end(), 0); - substituteUnaryOps(static_model, eqnumbers); + substituteUnaryOps(eqnumbers); } void -DynamicModel::substituteUnaryOps(StaticModel &static_model, set<string> &var_model_eqtags) +DynamicModel::substituteUnaryOps(set<string> &var_model_eqtags) { vector<int> eqnumbers; getEquationNumbersFromTags(eqnumbers, var_model_eqtags); findPacExpectationEquationNumbers(eqnumbers); - substituteUnaryOps(static_model, eqnumbers); + substituteUnaryOps(eqnumbers); } void -DynamicModel::substituteUnaryOps(StaticModel &static_model, vector<int> &eqnumbers) +DynamicModel::substituteUnaryOps(vector<int> &eqnumbers) { unary_op_aux_var_table_t nodes; @@ -5368,22 +5368,22 @@ DynamicModel::substituteUnaryOps(StaticModel &static_model, vector<int> &eqnumbe // Only substitute unary ops in model local variables that appear in VAR equations for (auto & it : local_variables_table) if (used_local_vars.find(it.first) != used_local_vars.end()) - it.second->findUnaryOpNodesForAuxVarCreation(static_model, nodes); + it.second->findUnaryOpNodesForAuxVarCreation(nodes); for (int eqnumber : eqnumbers) - equations[eqnumber]->findUnaryOpNodesForAuxVarCreation(static_model, nodes); + equations[eqnumber]->findUnaryOpNodesForAuxVarCreation(nodes); // Substitute in model local variables ExprNode::subst_table_t subst_table; vector<BinaryOpNode *> neweqs; for (auto & it : local_variables_table) - it.second = it.second->substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs); + it.second = it.second->substituteUnaryOpNodes(nodes, subst_table, neweqs); // Substitute in equations for (auto & equation : equations) { auto *substeq = dynamic_cast<BinaryOpNode *>(equation-> - substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs)); + substituteUnaryOpNodes(nodes, subst_table, neweqs)); assert(substeq != nullptr); equation = substeq; } diff --git a/src/DynamicModel.hh b/src/DynamicModel.hh index ee96cf9d..f7f35ab8 100644 --- a/src/DynamicModel.hh +++ b/src/DynamicModel.hh @@ -423,13 +423,13 @@ public: void substituteAdl(); //! Creates aux vars for all unary operators - void substituteUnaryOps(StaticModel &static_model); + void substituteUnaryOps(); //! Creates aux vars for certain unary operators: originally implemented for support of VARs - void substituteUnaryOps(StaticModel &static_model, set<string> &eq_tags); + void substituteUnaryOps(set<string> &eq_tags); //! Creates aux vars for certain unary operators: originally implemented for support of VARs - void substituteUnaryOps(StaticModel &static_model, vector<int> &eqnumbers); + void substituteUnaryOps(vector<int> &eqnumbers); //! Substitutes diff operator void substituteDiff(StaticModel &static_model, ExprNode::subst_table_t &diff_subst_table); diff --git a/src/ExprNode.cc b/src/ExprNode.cc index 5f628e4a..fd972341 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -553,7 +553,7 @@ NumConstNode::findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) } void -NumConstNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const +NumConstNode::findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const { } @@ -564,7 +564,7 @@ NumConstNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table } expr_t -NumConstNode::substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const +NumConstNode::substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const { return const_cast<NumConstNode *>(this); } @@ -1453,7 +1453,7 @@ VariableNode::findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) } void -VariableNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const +VariableNode::findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const { } @@ -1465,7 +1465,7 @@ VariableNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table } expr_t -VariableNode::substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const +VariableNode::substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const { return const_cast<VariableNode *>(this); } @@ -3090,9 +3090,9 @@ UnaryOpNode::createAuxVarForUnaryOpNode() const } void -UnaryOpNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const +UnaryOpNode::findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const { - arg->findUnaryOpNodesForAuxVarCreation(static_datatree, nodes); + arg->findUnaryOpNodesForAuxVarCreation(nodes); if (!this->createAuxVarForUnaryOpNode()) return; @@ -3219,13 +3219,13 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, } expr_t -UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const +UnaryOpNode::substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const { subst_table_t::const_iterator sit = subst_table.find(this); if (sit != subst_table.end()) return const_cast<VariableNode *>(sit->second); - expr_t argsubst = arg->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs); + expr_t argsubst = arg->substituteUnaryOpNodes(nodes, subst_table, neweqs); int arg_max_lag = this->maxLag(); UnaryOpNode *base_uon = nullptr; @@ -3251,7 +3251,7 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_ else { int symb_id; - argsubst = base_uon->get_arg()->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs); + argsubst = base_uon->get_arg()->substituteUnaryOpNodes(nodes, subst_table, neweqs); auto *vn = dynamic_cast<VariableNode *>(argsubst); if (vn == nullptr) symb_id = datatree.symbol_table.addUnaryOpAuxiliaryVar(this->idx, const_cast<UnaryOpNode *>(this)); @@ -4956,10 +4956,10 @@ BinaryOpNode::substituteAdl() const } void -BinaryOpNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const +BinaryOpNode::findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const { - arg1->findUnaryOpNodesForAuxVarCreation(static_datatree, nodes); - arg2->findUnaryOpNodesForAuxVarCreation(static_datatree, nodes); + arg1->findUnaryOpNodesForAuxVarCreation(nodes); + arg2->findUnaryOpNodesForAuxVarCreation(nodes); } void @@ -4979,10 +4979,10 @@ BinaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table } expr_t -BinaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const +BinaryOpNode::substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const { - expr_t arg1subst = arg1->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs); - expr_t arg2subst = arg2->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs); + expr_t arg1subst = arg1->substituteUnaryOpNodes(nodes, subst_table, neweqs); + expr_t arg2subst = arg2->substituteUnaryOpNodes(nodes, subst_table, neweqs); return buildSimilarBinaryOpNode(arg1subst, arg2subst, datatree); } @@ -5895,11 +5895,11 @@ TrinaryOpNode::findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table } void -TrinaryOpNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const +TrinaryOpNode::findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const { - arg1->findUnaryOpNodesForAuxVarCreation(static_datatree, nodes); - arg2->findUnaryOpNodesForAuxVarCreation(static_datatree, nodes); - arg3->findUnaryOpNodesForAuxVarCreation(static_datatree, nodes); + arg1->findUnaryOpNodesForAuxVarCreation(nodes); + arg2->findUnaryOpNodesForAuxVarCreation(nodes); + arg3->findUnaryOpNodesForAuxVarCreation(nodes); } expr_t @@ -5913,11 +5913,11 @@ TrinaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_tabl } expr_t -TrinaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const +TrinaryOpNode::substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const { - expr_t arg1subst = arg1->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs); - expr_t arg2subst = arg2->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs); - expr_t arg3subst = arg3->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs); + expr_t arg1subst = arg1->substituteUnaryOpNodes(nodes, subst_table, neweqs); + expr_t arg2subst = arg2->substituteUnaryOpNodes(nodes, subst_table, neweqs); + expr_t arg3subst = arg3->substituteUnaryOpNodes(nodes, subst_table, neweqs); return buildSimilarTrinaryOpNode(arg1subst, arg2subst, arg3subst, datatree); } @@ -6348,10 +6348,10 @@ AbstractExternalFunctionNode::findDiffNodes(DataTree &static_datatree, diff_tabl } void -AbstractExternalFunctionNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const +AbstractExternalFunctionNode::findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const { for (auto argument : arguments) - argument->findUnaryOpNodesForAuxVarCreation(static_datatree, nodes); + argument->findUnaryOpNodesForAuxVarCreation(nodes); } expr_t @@ -6365,11 +6365,11 @@ AbstractExternalFunctionNode::substituteDiff(DataTree &static_datatree, diff_tab } expr_t -AbstractExternalFunctionNode::substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const +AbstractExternalFunctionNode::substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const { vector<expr_t> arguments_subst; for (auto argument : arguments) - arguments_subst.push_back(argument->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs)); + arguments_subst.push_back(argument->substituteUnaryOpNodes(nodes, subst_table, neweqs)); return buildSimilarExternalFunctionNode(arguments_subst, datatree); } @@ -7962,7 +7962,7 @@ VarExpectationNode::findDiffNodes(DataTree &static_datatree, diff_table_t &diff_ } void -VarExpectationNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const +VarExpectationNode::findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const { } @@ -7974,7 +7974,7 @@ VarExpectationNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff } expr_t -VarExpectationNode::substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const +VarExpectationNode::substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const { return const_cast<VarExpectationNode *>(this); } @@ -8439,7 +8439,7 @@ PacExpectationNode::findDiffNodes(DataTree &static_datatree, diff_table_t &diff_ } void -PacExpectationNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const +PacExpectationNode::findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const { } @@ -8451,7 +8451,7 @@ PacExpectationNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff } expr_t -PacExpectationNode::substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const +PacExpectationNode::substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const { return const_cast<PacExpectationNode *>(this); } diff --git a/src/ExprNode.hh b/src/ExprNode.hh index ae31f44f..a7bfe4bf 100644 --- a/src/ExprNode.hh +++ b/src/ExprNode.hh @@ -508,9 +508,9 @@ class ExprNode //! Substitute diff operator virtual void findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) const = 0; - virtual void findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const = 0; + virtual void findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const = 0; virtual expr_t substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0; - virtual expr_t substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0; + virtual expr_t substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0; //! Substitute pac_expectation operator virtual expr_t substitutePacExpectation(map<const PacExpectationNode *, const BinaryOpNode *> &subst_table) = 0; @@ -613,9 +613,9 @@ public: expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const override; expr_t substituteAdl() const override; void findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) const override; - void findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const override; + void findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const override; expr_t substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; - expr_t substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; + expr_t substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; expr_t substitutePacExpectation(map<const PacExpectationNode *, const BinaryOpNode *> &subst_table) override; expr_t decreaseLeadsLagsPredeterminedVariables() const override; expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; @@ -705,9 +705,9 @@ public: expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const override; expr_t substituteAdl() const override; void findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) const override; - void findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const override; + void findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const override; expr_t substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; - expr_t substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; + expr_t substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; expr_t substitutePacExpectation(map<const PacExpectationNode *, const BinaryOpNode *> &subst_table) override; expr_t decreaseLeadsLagsPredeterminedVariables() const override; expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; @@ -846,9 +846,9 @@ public: expr_t substituteAdl() const override; void findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) const override; bool createAuxVarForUnaryOpNode() const; - void findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const override; + void findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const override; expr_t substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; - expr_t substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; + expr_t substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; expr_t substitutePacExpectation(map<const PacExpectationNode *, const BinaryOpNode *> &subst_table) override; expr_t decreaseLeadsLagsPredeterminedVariables() const override; expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; @@ -983,9 +983,9 @@ public: expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const override; expr_t substituteAdl() const override; void findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) const override; - void findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const override; + void findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const override; expr_t substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; - expr_t substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; + expr_t substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; expr_t substitutePacExpectation(map<const PacExpectationNode *, const BinaryOpNode *> &subst_table) override; expr_t decreaseLeadsLagsPredeterminedVariables() const override; expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; @@ -1111,9 +1111,9 @@ public: expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const override; expr_t substituteAdl() const override; void findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) const override; - void findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const override; + void findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const override; expr_t substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; - expr_t substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; + expr_t substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; expr_t substitutePacExpectation(map<const PacExpectationNode *, const BinaryOpNode *> &subst_table) override; expr_t decreaseLeadsLagsPredeterminedVariables() const override; expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; @@ -1227,9 +1227,9 @@ public: expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const override; expr_t substituteAdl() const override; void findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) const override; - void findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const override; + void findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const override; expr_t substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; - expr_t substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; + expr_t substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; expr_t substitutePacExpectation(map<const PacExpectationNode *, const BinaryOpNode *> &subst_table) override; virtual expr_t buildSimilarExternalFunctionNode(vector<expr_t> &alt_args, DataTree &alt_datatree) const = 0; expr_t decreaseLeadsLagsPredeterminedVariables() const override; @@ -1446,9 +1446,9 @@ public: expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const override; expr_t substituteAdl() const override; void findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) const override; - void findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const override; + void findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const override; expr_t substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; - expr_t substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; + expr_t substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; expr_t substitutePacExpectation(map<const PacExpectationNode *, const BinaryOpNode *> &subst_table) override; pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t>>> &List_of_Op_RHS) const override; void compile(ostream &CompileCode, unsigned int &instruction_number, @@ -1533,9 +1533,9 @@ public: expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const override; expr_t substituteAdl() const override; void findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table) const override; - void findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, unary_op_aux_var_table_t &nodes) const override; + void findUnaryOpNodesForAuxVarCreation(unary_op_aux_var_table_t &nodes) const override; expr_t substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; - expr_t substituteUnaryOpNodes(DataTree &static_datatree, unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; + expr_t substituteUnaryOpNodes(unary_op_aux_var_table_t &nodes, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const override; expr_t substitutePacExpectation(map<const PacExpectationNode *, const BinaryOpNode *> &subst_table) override; pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t>>> &List_of_Op_RHS) const override; void compile(ostream &CompileCode, unsigned int &instruction_number, diff --git a/src/ModFile.cc b/src/ModFile.cc index 18e657b3..92c75860 100644 --- a/src/ModFile.cc +++ b/src/ModFile.cc @@ -364,11 +364,11 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const } if (transform_unary_ops) - dynamic_model.substituteUnaryOps(diff_static_model); + dynamic_model.substituteUnaryOps(); else // substitute only those unary ops that appear in VAR equations // NB: equation tags are stored at parsing time in `substitute_unary_ops_in_equation_tags` - dynamic_model.substituteUnaryOps(diff_static_model, substitute_unary_ops_in_equation_tags); + dynamic_model.substituteUnaryOps(substitute_unary_ops_in_equation_tags); // Create auxiliary variable and equations for Diff operators that appear in VAR equations ExprNode::subst_table_t diff_subst_table; @@ -377,8 +377,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const // Var Model map<string, vector<string>> var_model_eq_tags; map<string, pair<SymbolList, int>> var_model_info_var_expectation; - map<string, tuple<vector<int>, vector<expr_t>, vector<bool>, vector<int>, int, vector<bool>, vector<int>>> - var_model_info_pac_expectation; + map<string, tuple<vector<int>, vector<expr_t>, vector<bool>, vector<int>, int, vector<bool>, vector<int>>> var_model_info_pac_expectation; for (auto & statement : statements) { int max_lag; -- GitLab