Represents an abstract class which is the base of concrete symbolic-expression classes.
#include <drake/common/symbolic/expression/expression_cell.h>
Public Member Functions | |
virtual | ~ExpressionCell () |
std::atomic< int > & | use_count () const |
Returns the intrusive use count (ala boost::intrusive_ptr). More... | |
ExpressionKind | get_kind () const |
Returns expression kind. More... | |
virtual void | HashAppendDetail (DelegatingHasher *) const =0 |
Sends all hash-relevant bytes for this ExpressionCell type into the given hasher, per the hash_append generic hashing concept – except for get_kind(), because Expression already sends that. More... | |
virtual Variables | GetVariables () const =0 |
Collects variables in expression. More... | |
virtual bool | EqualTo (const ExpressionCell &c) const =0 |
Checks structural equality. More... | |
virtual bool | Less (const ExpressionCell &c) const =0 |
Provides lexicographical ordering between expressions. More... | |
bool | is_polynomial () const |
Checks if this symbolic expression is convertible to Polynomial. More... | |
bool | is_expanded () const |
Checks if this symbolic expression is already expanded. More... | |
void | set_expanded () |
Sets this symbolic expression as already expanded. More... | |
virtual double | Evaluate (const Environment &env) const =0 |
Evaluates under a given environment (by default, an empty environment). More... | |
virtual Expression | Expand () const =0 |
Expands out products and positive integer powers in expression. More... | |
virtual Expression | EvaluatePartial (const Environment &env) const =0 |
Returns an Expression obtained by replacing all occurrences of the variables in env in the current expression cell with the corresponding values in env . More... | |
virtual Expression | Substitute (const Substitution &s) const =0 |
Returns an Expression obtained by replacing all occurrences of the variables in s in the current expression cell with the corresponding expressions in s . More... | |
virtual Expression | Differentiate (const Variable &x) const =0 |
Differentiates this symbolic expression with respect to the variable var . More... | |
virtual std::ostream & | Display (std::ostream &os) const =0 |
Outputs string representation of expression into output stream os . More... | |
Does not allow copy, move, or assignment | |
ExpressionCell (const ExpressionCell &)=delete | |
ExpressionCell & | operator= (const ExpressionCell &)=delete |
ExpressionCell (ExpressionCell &&)=delete | |
ExpressionCell & | operator= (ExpressionCell &&)=delete |
Protected Member Functions | |
ExpressionCell (ExpressionKind k, bool is_poly, bool is_expanded) | |
Constructs ExpressionCell of kind k with is_poly and is_expanded , with a use_count of zero. More... | |
|
delete |
|
delete |
|
virtual |
|
protected |
Constructs ExpressionCell of kind k
with is_poly
and is_expanded
, with a use_count
of zero.
|
pure virtual |
Differentiates this symbolic expression with respect to the variable var
.
std::exception | if it is not differentiable. |
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionFloor, ExpressionCeiling, ExpressionMax, ExpressionMin, ExpressionTanh, ExpressionCosh, ExpressionSinh, ExpressionAtan2, ExpressionAtan, ExpressionAcos, ExpressionAsin, ExpressionTan, ExpressionCos, ExpressionSin, ExpressionPow, ExpressionSqrt, ExpressionExp, ExpressionAbs, ExpressionLog, ExpressionDiv, ExpressionMul, ExpressionAdd, ExpressionNaN, and ExpressionVar.
|
pure virtual |
Outputs string representation of expression into output stream os
.
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionFloor, ExpressionCeiling, ExpressionMax, ExpressionMin, ExpressionTanh, ExpressionCosh, ExpressionSinh, ExpressionAtan2, ExpressionAtan, ExpressionAcos, ExpressionAsin, ExpressionTan, ExpressionCos, ExpressionSin, ExpressionPow, ExpressionSqrt, ExpressionExp, ExpressionAbs, ExpressionLog, ExpressionDiv, ExpressionMul, ExpressionAdd, ExpressionNaN, and ExpressionVar.
|
pure virtual |
Checks structural equality.
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionMul, ExpressionAdd, ExpressionNaN, ExpressionVar, BinaryExpressionCell, and UnaryExpressionCell.
|
pure virtual |
Evaluates under a given environment (by default, an empty environment).
std::exception | if NaN is detected during evaluation. |
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionMul, ExpressionAdd, ExpressionNaN, ExpressionVar, BinaryExpressionCell, and UnaryExpressionCell.
|
pure virtual |
Returns an Expression obtained by replacing all occurrences of the variables in env
in the current expression cell with the corresponding values in env
.
std::exception | if NaN is detected during substitution. |
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionFloor, ExpressionCeiling, ExpressionMax, ExpressionMin, ExpressionTanh, ExpressionCosh, ExpressionSinh, ExpressionAtan2, ExpressionAtan, ExpressionAcos, ExpressionAsin, ExpressionTan, ExpressionCos, ExpressionSin, ExpressionPow, ExpressionSqrt, ExpressionExp, ExpressionAbs, ExpressionLog, ExpressionDiv, ExpressionMul, ExpressionAdd, ExpressionNaN, and ExpressionVar.
|
pure virtual |
Expands out products and positive integer powers in expression.
std::exception | if NaN is detected during expansion. |
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionFloor, ExpressionCeiling, ExpressionMax, ExpressionMin, ExpressionTanh, ExpressionCosh, ExpressionSinh, ExpressionAtan2, ExpressionAtan, ExpressionAcos, ExpressionAsin, ExpressionTan, ExpressionCos, ExpressionSin, ExpressionPow, ExpressionSqrt, ExpressionExp, ExpressionAbs, ExpressionLog, ExpressionDiv, ExpressionMul, ExpressionAdd, ExpressionNaN, and ExpressionVar.
ExpressionKind get_kind | ( | ) | const |
Returns expression kind.
|
pure virtual |
Collects variables in expression.
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionMul, ExpressionAdd, ExpressionNaN, ExpressionVar, BinaryExpressionCell, and UnaryExpressionCell.
|
pure virtual |
Sends all hash-relevant bytes for this ExpressionCell type into the given hasher, per the hash_append generic hashing concept – except for get_kind(), because Expression already sends that.
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionMul, ExpressionAdd, ExpressionNaN, ExpressionVar, BinaryExpressionCell, and UnaryExpressionCell.
bool is_expanded | ( | ) | const |
Checks if this symbolic expression is already expanded.
bool is_polynomial | ( | ) | const |
Checks if this symbolic expression is convertible to Polynomial.
|
pure virtual |
Provides lexicographical ordering between expressions.
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionMul, ExpressionAdd, ExpressionNaN, ExpressionVar, BinaryExpressionCell, and UnaryExpressionCell.
|
delete |
|
delete |
void set_expanded | ( | ) |
Sets this symbolic expression as already expanded.
|
pure virtual |
Returns an Expression obtained by replacing all occurrences of the variables in s
in the current expression cell with the corresponding expressions in s
.
std::exception | if NaN is detected during substitution. |
Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionFloor, ExpressionCeiling, ExpressionMax, ExpressionMin, ExpressionTanh, ExpressionCosh, ExpressionSinh, ExpressionAtan2, ExpressionAtan, ExpressionAcos, ExpressionAsin, ExpressionTan, ExpressionCos, ExpressionSin, ExpressionPow, ExpressionSqrt, ExpressionExp, ExpressionAbs, ExpressionLog, ExpressionDiv, ExpressionMul, ExpressionAdd, ExpressionNaN, and ExpressionVar.
std::atomic<int>& use_count | ( | ) | const |
Returns the intrusive use count (ala boost::intrusive_ptr).