Add a method to Expr.

(Split out from earlier "Eigen library integration" commit)
pull/1159/head
EvilSpirit 2021-06-24 11:29:24 -05:00 committed by phkahler
parent 3ba40230dd
commit aec46b608e
2 changed files with 6 additions and 0 deletions

View File

@ -430,6 +430,11 @@ bool Expr::DependsOn(hParam p) const {
bool Expr::Tol(double a, double b) {
return fabs(a - b) < 0.001;
}
bool Expr::IsZeroConst() const {
return op == Op::CONSTANT && EXACT(v == 0.0);
}
Expr *Expr::FoldConstants() {
Expr *n = AllocExpr();
*n = *this;

View File

@ -73,6 +73,7 @@ public:
void ParamsUsedList(List<hParam> *list) const;
bool DependsOn(hParam p) const;
static bool Tol(double a, double b);
bool IsZeroConst() const;
Expr *FoldConstants();
void Substitute(hParam oldh, hParam newh);