diff --git a/src/ExprNode.hh b/src/ExprNode.hh index 83f32744f6625e5bd76c12637fac1044c7357f0e..17bf0405dd333105956e19cd3a0ed9a475d21d9d 100644 --- a/src/ExprNode.hh +++ b/src/ExprNode.hh @@ -632,7 +632,9 @@ public: parameter in a term, param_id == -1. Can throw a MatchFailureException. if `variable_obligatory_in_each_term` is true, then every part of the linear combination must contain a variable; - otherwise, if `variable_obligatory_in_each_term`, then any linear combination of constant/variable/param is matched + otherwise, if `variable_obligatory_in_each_term` is false, then any linear + combination of constant/variable/param is matched (and variable_id == -1 + for terms without a variable). */ vector<tuple<int, int, int, double>> matchLinearCombinationOfVariables(bool variable_obligatory_in_each_term = true) const; diff --git a/src/SubModel.cc b/src/SubModel.cc index dbfaf0e1cc118f95109528efbd1a3b0b523e2eb7..28b09016c2dfd2b17b073fcc4e696510512a0d1a 100644 --- a/src/SubModel.cc +++ b/src/SubModel.cc @@ -830,14 +830,8 @@ PacModelTable::transformPass(ExprNode::subst_table_t &diff_subst_table, } catch (ExprNode::MatchFailureException &e) { - auto gv = dynamic_cast<const VariableNode *>(growth[name]); - if (gv) - growth_info[name].emplace_back(gv->symb_id, gv->lag, -1, 1); - else - { - cerr << "Pac growth must be a linear combination of variables" << endl; - exit(EXIT_FAILURE); - } + cerr << "ERROR: PAC growth must be a linear combination of variables" << endl; + exit(EXIT_FAILURE); } // Collect some information about PAC models diff --git a/src/SubModel.hh b/src/SubModel.hh index f3a7921e08d7a92c37c7e2ae7d990c883ee8eb1a..d45f29c707e392f041899c933f4b50ca9b74dc1d 100644 --- a/src/SubModel.hh +++ b/src/SubModel.hh @@ -199,6 +199,9 @@ private: map<string, string> discount; // The growth expressions belong to the main dynamic_model from the ModFile instance map<string, expr_t> growth, original_growth; + /* Information about the structure of growth expressions (which must be a + linear combination of variables). + Each tuple represents a term: (endo_id, lag, param_id, constant) */ map<string, vector<tuple<int, int, int, double>>> growth_info; /* Stores the name of the PAC equation associated to the model.