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>

Inheritance diagram for ExpressionCell:
[legend]

Public Member Functions

ExpressionKind get_kind () const
 Returns expression kind. More...
 
size_t get_hash () const
 Returns hash value. 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, size_t hash, bool is_poly)
 Constructs ExpressionCell of kind k with hash and 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 ( )
protecteddefault

Default constructor.

Here is the caller graph for this function:

ExpressionCell ( ExpressionCell &&  e)
protecteddefault

Move-constructs an ExpressionCell from an rvalue.

ExpressionCell ( const ExpressionCell e)
protecteddefault

Copy-constructs an ExpressionCell from an lvalue.

ExpressionCell ( ExpressionKind  k,
size_t  hash,
bool  is_poly 
)
protected

Constructs ExpressionCell of kind k with hash and is_poly .

Here is the call graph for this function:

virtual ~ExpressionCell ( )
protectedvirtualdefault

Default destructor.

Here is the caller graph for this function:

Member Function Documentation

virtual Expression Differentiate ( const Variable x) const
pure virtual

Differentiates this symbolic expression with respect to the variable var.

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

Here is the caller graph for this function:

virtual std::ostream& Display ( std::ostream &  os) const
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, ExpressionConstant, and ExpressionVar.

Here is the caller graph for this function:

virtual bool EqualTo ( const ExpressionCell c) const
pure virtual

Checks structural equality.

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

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

virtual Expression Expand ( ) const
pure virtual

Expands out products and positive integer powers in expression.

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

Here is the caller graph for this function:

size_t get_hash ( ) const
inline

Returns hash value.

Here is the call graph for this function:

ExpressionKind get_kind ( ) const
inline

Returns expression kind.

Here is the caller graph for this function:

virtual Variables GetVariables ( ) const
pure virtual

Collects variables in expression.

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

Here is the caller graph for this function:

bool is_polynomial ( ) const
inline

Checks if this symbolic expression is convertible to Polynomial.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool Less ( const ExpressionCell c) const
pure virtual

Provides lexicographical ordering between expressions.

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

Here is the caller graph for this function:

ExpressionCell& operator= ( ExpressionCell &&  e)
protecteddelete

Move-assigns (DELETED).

Here is the caller graph for this function:

ExpressionCell& operator= ( const ExpressionCell e)
protecteddelete

Copy-assigns (DELETED).

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.

Here is the caller graph for this function:

virtual Polynomiald ToPolynomial ( ) const
pure virtual

Returns a Polynomial representing this expression.

Note that the ID of a variable is preserved in this translation.

Precondition
is_polynomial() is true.

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.

Here is the caller graph for this function:


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