Drake
Drake C++ Documentation
ExpressionCell Class Referenceabstract

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.

#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
 
ExpressionCelloperator= (const ExpressionCell &)=delete
 
 ExpressionCell (ExpressionCell &&)=delete
 
ExpressionCelloperator= (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...
 

Constructor & Destructor Documentation

◆ ExpressionCell() [1/3]

ExpressionCell ( const ExpressionCell )
delete

◆ ExpressionCell() [2/3]

ExpressionCell ( ExpressionCell &&  )
delete

◆ ~ExpressionCell()

virtual ~ExpressionCell ( )
virtual

◆ ExpressionCell() [3/3]

ExpressionCell ( ExpressionKind  k,
bool  is_poly,
bool  is_expanded 
)
protected

Constructs ExpressionCell of kind k with is_poly and is_expanded, with a use_count of zero.

Member Function Documentation

◆ Differentiate()

◆ Display()

◆ EqualTo()

virtual bool EqualTo ( const ExpressionCell c) const
pure virtual

◆ Evaluate()

virtual double Evaluate ( const Environment env) const
pure virtual

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

Exceptions
std::exceptionif NaN is detected during evaluation.

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

◆ EvaluatePartial()

virtual Expression EvaluatePartial ( const Environment env) const
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.

Exceptions
std::exceptionif 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.

◆ Expand()

◆ get_kind()

ExpressionKind get_kind ( ) const

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, ExpressionVar, BinaryExpressionCell, and UnaryExpressionCell.

◆ is_expanded()

bool is_expanded ( ) const

Checks if this symbolic expression is already expanded.

◆ is_polynomial()

bool is_polynomial ( ) const

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 &&  )
delete

◆ operator=() [2/2]

ExpressionCell& operator= ( const ExpressionCell )
delete

◆ set_expanded()

void set_expanded ( )

Sets this symbolic expression as already expanded.

◆ 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::exceptionif 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.

◆ use_count()

std::atomic<int>& use_count ( ) const

Returns the intrusive use count (ala boost::intrusive_ptr).


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