Use NumConstNode* type for DataTree constants (previously they were just expr_t)

var-models
Sébastien Villemot 2021-07-16 12:08:18 +02:00 committed by Stéphane Adjemian (Ryûk)
parent 15d7432105
commit 5498ce98ee
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
3 changed files with 5 additions and 4 deletions

View File

@ -119,7 +119,7 @@ DataTree::operator=(const DataTree &d)
return *this;
}
expr_t
NumConstNode *
DataTree::AddNonNegativeConstant(const string &value)
{
int id = num_constants.AddNonNegativeConstant(value);

View File

@ -140,7 +140,8 @@ public:
DataTree &operator=(DataTree &&) = delete;
//! Some predefined constants
expr_t Zero, One, Two, Three, MinusOne, NaN, Infinity, MinusInfinity, Pi;
NumConstNode *Zero, *One, *Two, *Three, *NaN, *Infinity, *Pi;
expr_t MinusOne, MinusInfinity;
//! Raised when a local parameter is declared twice
class LocalVariableException
@ -158,7 +159,7 @@ public:
inline expr_t AddPossiblyNegativeConstant(double val);
//! Adds a non-negative numerical constant (possibly Inf or NaN)
expr_t AddNonNegativeConstant(const string &value);
NumConstNode *AddNonNegativeConstant(const string &value);
//! Adds a variable
VariableNode *AddVariable(int symb_id, int lag = 0);
//! Gets a variable

View File

@ -578,7 +578,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, bool
/* Create auxiliary parameters and the expression to be substituted into
the var_expectations statement */
auto subst_expr = dynamic_model.Zero;
expr_t subst_expr = dynamic_model.Zero;
for (int lag = 0; lag < max_lag; lag++)
for (auto variable : lhs)
{