Drake
ExpressionCell Class Referenceabstract

Represents an abstract class which is the base of concrete symbolic-expression classes. More...

#include <drake/common/symbolic_expression_cell.h>

Public Member Functions

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...
 
virtual Polynomiald ToPolynomial () const =0
 Returns a Polynomial representing this expression. 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 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...
 

Protected Member Functions

 ExpressionCell ()=default
 Default constructor. More...
 
 ExpressionCell (ExpressionCell &&e)=default
 Move-constructs an ExpressionCell from an rvalue. More...
 
 ExpressionCell (const ExpressionCell &e)=default
 Copy-constructs an ExpressionCell from an lvalue. More...
 
ExpressionCelloperator= (ExpressionCell &&e)=delete
 Move-assigns (DELETED). More...
 
ExpressionCelloperator= (const ExpressionCell &e)=delete
 Copy-assigns (DELETED). More...
 
 ExpressionCell (ExpressionKind k, bool is_poly)
 Constructs ExpressionCell of kind k with is_poly . More...
 
virtual ~ExpressionCell ()=default
 Default destructor. More...
 

Detailed Description

Represents an abstract class which is the base of concrete symbolic-expression classes.

Note
It provides virtual function, ExpressionCell::Display, because operator<< is not allowed to be a virtual function.

Constructor & Destructor Documentation

◆ ExpressionCell() [1/4]

ExpressionCell ( )
protecteddefault

Default constructor.

◆ ExpressionCell() [2/4]

ExpressionCell ( ExpressionCell &&  e)
protecteddefault

Move-constructs an ExpressionCell from an rvalue.

◆ ExpressionCell() [3/4]

ExpressionCell ( const ExpressionCell e)
protecteddefault

Copy-constructs an ExpressionCell from an lvalue.

◆ ExpressionCell() [4/4]

ExpressionCell ( ExpressionKind  k,
bool  is_poly 
)
protected

Constructs ExpressionCell of kind k with is_poly .

◆ ~ExpressionCell()

virtual ~ExpressionCell ( )
protectedvirtualdefault

Default destructor.

Member Function Documentation

◆ Differentiate()

◆ Display()

◆ EqualTo()

◆ Evaluate()

virtual double Evaluate ( const Environment env) const
pure virtual

Evaluates under a given environment (by default, an empty environment).

Exceptions
std::runtime_errorif NaN is detected during evaluation.

Implemented in ExpressionUninterpretedFunction, ExpressionIfThenElse, ExpressionMul, ExpressionAdd, ExpressionNaN, ExpressionConstant, ExpressionVar, BinaryExpressionCell, and UnaryExpressionCell.

◆ Expand()

◆ get_kind()

ExpressionKind get_kind ( ) const
inline

Returns expression kind.

◆ GetVariables()

virtual Variables GetVariables ( ) const
pure virtual

◆ HashAppendDetail()

virtual void HashAppendDetail ( DelegatingHasher ) const
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, ExpressionConstant, ExpressionVar, BinaryExpressionCell, and UnaryExpressionCell.

◆ is_polynomial()

bool is_polynomial ( ) const
inline

Checks if this symbolic expression is convertible to Polynomial.

◆ Less()

virtual bool Less ( const ExpressionCell c) const
pure virtual

◆ operator=() [1/2]

ExpressionCell& operator= ( ExpressionCell &&  e)
protecteddelete

Move-assigns (DELETED).

◆ operator=() [2/2]

ExpressionCell& operator= ( const ExpressionCell e)
protecteddelete

Copy-assigns (DELETED).

◆ Substitute()

virtual Expression Substitute ( const Substitution s) const
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.

Exceptions
std::runtime_errorif 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, ExpressionConstant, and ExpressionVar.

◆ ToPolynomial()


The documentation for this class was generated from the following files: