Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
ExpressionMul Class Reference

Detailed Description

Symbolic expression representing a multiplication of powers.

\[ c_0 \cdot \prod b_i^{e_i} \]

where \( c_0 \) is a constant and \( b_i \) and \( e_i \) are symbolic expressions.

Internally this class maintains a member variable constant_ representing \( c_0 \) and another member variable base_to_exponent_map_ representing a mapping from a base, \( b_i \) to its exponentiation \( e_i \).

#include <drake/common/symbolic/expression/expression_cell.h>

Public Member Functions

 ExpressionMul (double constant, std::map< Expression, Expression > base_to_exponent_map)
 Constructs ExpressionMul from constant and base_to_exponent_map.
 ~ExpressionMul () override
void HashAppendDetail (DelegatingHasher *) const override
 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.
Variables GetVariables () const override
 Collects variables in expression.
bool EqualTo (const ExpressionCell &e) const override
 Checks structural equality.
bool Less (const ExpressionCell &e) const override
 Provides lexicographical ordering between expressions.
double Evaluate (const Environment &env) const override
 Evaluates under a given environment (by default, an empty environment).
Expression Expand () const override
 Expands out products and positive integer powers in expression.
Expression EvaluatePartial (const Environment &env) const override
 Returns an Expression obtained by replacing all occurrences of the variables in env in the current expression cell with the corresponding values in env.
Expression Substitute (const Substitution &s) const override
 Returns an Expression obtained by replacing all occurrences of the variables in s in the current expression cell with the corresponding expressions in s.
Expression Differentiate (const Variable &x) const override
 Differentiates this symbolic expression with respect to the variable var.
std::ostream & Display (std::ostream &os) const override
 Outputs string representation of expression into output stream os.
double get_constant () const
 Returns constant term.
const std::map< Expression, Expression > & get_base_to_exponent_map () const
 Returns map from a term to its coefficient.
Public Member Functions inherited from ExpressionCell
virtual ~ExpressionCell ()
std::atomic< int > & use_count () const
 Returns the intrusive use count (ala boost::intrusive_ptr).
ExpressionKind get_kind () const
 Returns expression kind.
bool is_polynomial () const
 Checks if this symbolic expression is convertible to Polynomial.
bool is_expanded () const
 Checks if this symbolic expression is already expanded.
void set_expanded ()
 Sets this symbolic expression as already expanded.
 ExpressionCell (const ExpressionCell &)=delete
ExpressionCelloperator= (const ExpressionCell &)=delete
 ExpressionCell (ExpressionCell &&)=delete
ExpressionCelloperator= (ExpressionCell &&)=delete

Additional Inherited Members

Protected Member Functions inherited from ExpressionCell
 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.

Constructor & Destructor Documentation

◆ ExpressionMul()

ExpressionMul ( double constant,
std::map< Expression, Expression > base_to_exponent_map )

Constructs ExpressionMul from constant and base_to_exponent_map.

◆ ~ExpressionMul()

~ExpressionMul ( )
override

Member Function Documentation

◆ Differentiate()

Expression Differentiate ( const Variable & x) const
nodiscardoverridevirtual

Differentiates this symbolic expression with respect to the variable var.

Exceptions
std::exceptionif it is not differentiable.

Implements ExpressionCell.

◆ Display()

std::ostream & Display ( std::ostream & os) const
overridevirtual

Outputs string representation of expression into output stream os.

Implements ExpressionCell.

◆ EqualTo()

bool EqualTo ( const ExpressionCell & c) const
nodiscardoverridevirtual

Checks structural equality.

Implements ExpressionCell.

◆ Evaluate()

double Evaluate ( const Environment & env) const
nodiscardoverridevirtual

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

Exceptions
std::exceptionif NaN is detected during evaluation.

Implements ExpressionCell.

◆ EvaluatePartial()

Expression EvaluatePartial ( const Environment & env) const
nodiscardoverridevirtual

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.

Implements ExpressionCell.

◆ Expand()

Expression Expand ( ) const
nodiscardoverridevirtual

Expands out products and positive integer powers in expression.

Exceptions
std::exceptionif NaN is detected during expansion.

Implements ExpressionCell.

◆ get_base_to_exponent_map()

const std::map< Expression, Expression > & get_base_to_exponent_map ( ) const
nodiscard

Returns map from a term to its coefficient.

◆ get_constant()

double get_constant ( ) const
nodiscard

Returns constant term.

◆ GetVariables()

Variables GetVariables ( ) const
nodiscardoverridevirtual

Collects variables in expression.

Implements ExpressionCell.

◆ HashAppendDetail()

void HashAppendDetail ( DelegatingHasher * ) const
overridevirtual

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.

Implements ExpressionCell.

◆ Less()

bool Less ( const ExpressionCell & c) const
nodiscardoverridevirtual

Provides lexicographical ordering between expressions.

Implements ExpressionCell.

◆ Substitute()

Expression Substitute ( const Substitution & s) const
nodiscardoverridevirtual

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.

Implements ExpressionCell.


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