Drake
Drake C++ Documentation
Expression Class Reference

Detailed Description

Represents a symbolic form of an expression.

Its syntax tree is as follows:

    E := Var | Constant | E + ... + E | E * ... * E | E / E | log(E)
       | abs(E) | exp(E) | sqrt(E) | pow(E, E) | sin(E) | cos(E) | tan(E)
       | asin(E) | acos(E) | atan(E) | atan2(E, E) | sinh(E) | cosh(E) | tanh(E)
       | min(E, E) | max(E, E) | ceil(E) | floor(E) | if_then_else(F, E, E)
       | NaN | uninterpreted_function(name, {v_1, ..., v_n})

In the implementation, Expression directly stores Constant values inline, but in all other cases stores a shared pointer to a const ExpressionCell class that is a super-class of different kinds of symbolic expressions (i.e., ExpressionAdd, ExpressionMul, ExpressionLog, ExpressionSin), which makes it efficient to copy, move, and assign to an Expression.

Note
-E is represented as -1 * E internally.
A subtraction E1 - E2 is represented as E1 + (-1 * E2) internally.

The following simple simplifications are implemented:

    E + 0             ->  E
    0 + E             ->  E
    E - 0             ->  E
    E - E             ->  0
    E * 1             ->  E
    1 * E             ->  E
    E * 0             ->  0
    0 * E             ->  0
    E / 1             ->  E
    E / E             ->  1
    pow(E, 0)         ->  1
    pow(E, 1)         ->  E
    E * E             ->  E^2 (= pow(E, 2))
    sqrt(E * E)       ->  |E| (= abs(E))
    sqrt(E) * sqrt(E) -> E

Constant folding is implemented:

    E(c1) + E(c2)  ->  E(c1 + c2)    // c1, c2 are constants
    E(c1) - E(c2)  ->  E(c1 - c2)
    E(c1) * E(c2)  ->  E(c1 * c2)
    E(c1) / E(c2)  ->  E(c1 / c2)
    f(E(c))        ->  E(f(c))       // c is a constant, f is a math function

For the math functions which are only defined over a restricted domain (namely, log, sqrt, pow, asin, acos), we check the domain of argument(s), and throw std::domain_error exception if a function is not well-defined for a given argument(s).

Relational operators over expressions (==, !=, <, >, <=, >=) return symbolic::Formula instead of bool. Those operations are declared in formula.h file. To check structural equality between two expressions a separate function, Expression::EqualTo, is provided.

Regarding the arithmetic of an Expression when operating on NaNs, we have the following rules:

  1. NaN values are extremely rare during typical computations. Because they are difficult to handle symbolically, we will round that up to "must never occur". We allow the user to form ExpressionNaN cells in a symbolic tree. For example, the user can initialize an Expression to NaN and then overwrite it later. However, evaluating a tree that has NaN in its evaluated sub-trees is an error (see rule (3) below).
  2. It's still valid for code to check isnan in order to fail-fast. So we provide isnan(const Expression&) for the common case of non-NaN value returning False. This way, code can fail-fast with double yet still compile with Expression.
  3. If there are expressions that embed separate cases (if_then_else), some of the sub-expressions may be not used in evaluation when they are in the not-taken case (for NaN reasons or any other reason). Bad values within those not-taken branches does not cause exceptions.
  4. The isnan check is different than if_then_else. In the latter, the ExpressionNaN is within a dead sub-expression branch. In the former, it appears in an evaluated trunk. That goes against rule (1) where a NaN anywhere in a computation (other than dead code) is an error.

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

Public Member Functions

 ~Expression ()=default
 
 Expression ()=default
 Default constructor. More...
 
 Expression (double constant)
 Constructs a constant. More...
 
 Expression (const Variable &var)
 Constructs an expression from var. More...
 
ExpressionKind get_kind () const
 Returns expression kind. More...
 
Variables GetVariables () const
 Collects variables in expression. More...
 
bool EqualTo (const Expression &e) const
 Checks structural equality. More...
 
bool Less (const Expression &e) const
 Provides lexicographical ordering between expressions. More...
 
bool is_polynomial () const
 Checks if this symbolic expression is convertible to Polynomial. More...
 
double Evaluate (const Environment &env=Environment{}, RandomGenerator *random_generator=nullptr) const
 Evaluates using a given environment (by default, an empty environment) and a random number generator. More...
 
double Evaluate (RandomGenerator *random_generator) const
 Evaluates using an empty environment and a random number generator. More...
 
Expression EvaluatePartial (const Environment &env) const
 Partially evaluates this expression using an environment env. More...
 
bool is_expanded () const
 Returns true if this symbolic expression is already expanded. More...
 
Expression Expand () const
 Expands out products and positive integer powers in expression. More...
 
Expression Substitute (const Variable &var, const Expression &e) const
 Returns a copy of this expression replacing all occurrences of var with e. More...
 
Expression Substitute (const Substitution &s) const
 Returns a copy of this expression replacing all occurrences of the variables in s with corresponding expressions in s. More...
 
Expression Differentiate (const Variable &x) const
 Differentiates this symbolic expression with respect to the variable var. More...
 
RowVectorX< ExpressionJacobian (const Eigen::Ref< const VectorX< Variable >> &vars) const
 Let f be this Expression, computes a row vector of derivatives, [∂f/∂vars(0), ... More...
 
std::string to_string () const
 Returns string representation of Expression. More...
 
Expressionoperator++ ()
 Provides prefix increment operator (i.e. More...
 
Expression operator++ (int)
 Provides postfix increment operator (i.e. More...
 
Expressionoperator-- ()
 Provides prefix decrement operator (i.e. More...
 
Expression operator-- (int)
 Provides postfix decrement operator (i.e. More...
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 Expression (const Expression &)=default
 
Expressionoperator= (const Expression &)=default
 
 Expression (Expression &&)=default
 
Expressionoperator= (Expression &&)=default
 

Static Public Member Functions

static Expression Zero ()
 Returns zero. More...
 
static Expression One ()
 Returns one. More...
 
static Expression Pi ()
 Returns Pi, the ratio of a circle’s circumference to its diameter. More...
 
static Expression E ()
 Return e, the base of natural logarithms. More...
 
static Expression NaN ()
 Returns NaN (Not-a-Number). More...
 

Friends

class ExpressionAddFactory
 
class ExpressionMulFactory
 
template<bool >
struct internal::Gemm
 
template<class HashAlgorithm >
void hash_append (HashAlgorithm &hasher, const Expression &item) noexcept
 Implements the hash_append generic hashing concept. More...
 
Expression operator+ (Expression lhs, const Expression &rhs)
 
Expressionoperator+= (Expression &lhs, const Expression &rhs)
 
Expression operator+ (const Expression &e)
 Provides unary plus operator. More...
 
Expression operator- (Expression lhs, const Expression &rhs)
 
Expressionoperator-= (Expression &lhs, const Expression &rhs)
 
Expression operator- (const Expression &e)
 Provides unary minus operator. More...
 
Expression operator * (Expression lhs, const Expression &rhs)
 
Expressionoperator *= (Expression &lhs, const Expression &rhs)
 
Expression operator/ (Expression lhs, const Expression &rhs)
 
Expressionoperator/= (Expression &lhs, const Expression &rhs)
 
Expression log (const Expression &e)
 
Expression abs (const Expression &e)
 
Expression exp (const Expression &e)
 
Expression sqrt (const Expression &e)
 
Expression pow (const Expression &e1, const Expression &e2)
 
Expression sin (const Expression &e)
 
Expression cos (const Expression &e)
 
Expression tan (const Expression &e)
 
Expression asin (const Expression &e)
 
Expression acos (const Expression &e)
 
Expression atan (const Expression &e)
 
Expression atan2 (const Expression &e1, const Expression &e2)
 
Expression sinh (const Expression &e)
 
Expression cosh (const Expression &e)
 
Expression tanh (const Expression &e)
 
Expression min (const Expression &e1, const Expression &e2)
 
Expression max (const Expression &e1, const Expression &e2)
 
Expression clamp (const Expression &v, const Expression &lo, const Expression &hi)
 
Expression ceil (const Expression &e)
 
Expression floor (const Expression &e)
 
Expression if_then_else (const Formula &f_cond, const Expression &e_then, const Expression &e_else)
 Constructs if-then-else expression. More...
 
Expression uninterpreted_function (std::string name, std::vector< Expression > arguments)
 Constructs an uninterpreted-function expression with name and arguments. More...
 
std::ostream & operator<< (std::ostream &os, const Expression &e)
 
void swap (Expression &a, Expression &b)
 
bool is_constant (const Expression &e)
 Checks if e is a constant expression. More...
 
bool is_constant (const Expression &e, double value)
 Checks if e is a constant expression representing v. More...
 
bool is_nan (const Expression &e)
 Checks if e is NaN. More...
 
bool is_variable (const Expression &e)
 Checks if e is a variable expression. More...
 
bool is_addition (const Expression &e)
 Checks if e is an addition expression. More...
 
bool is_multiplication (const Expression &e)
 Checks if e is a multiplication expression. More...
 
bool is_division (const Expression &e)
 Checks if e is a division expression. More...
 
bool is_log (const Expression &e)
 Checks if e is a log expression. More...
 
bool is_abs (const Expression &e)
 Checks if e is an abs expression. More...
 
bool is_exp (const Expression &e)
 Checks if e is an exp expression. More...
 
bool is_sqrt (const Expression &e)
 Checks if e is a square-root expression. More...
 
bool is_pow (const Expression &e)
 Checks if e is a power-function expression. More...
 
bool is_sin (const Expression &e)
 Checks if e is a sine expression. More...
 
bool is_cos (const Expression &e)
 Checks if e is a cosine expression. More...
 
bool is_tan (const Expression &e)
 Checks if e is a tangent expression. More...
 
bool is_asin (const Expression &e)
 Checks if e is an arcsine expression. More...
 
bool is_acos (const Expression &e)
 Checks if e is an arccosine expression. More...
 
bool is_atan (const Expression &e)
 Checks if e is an arctangent expression. More...
 
bool is_atan2 (const Expression &e)
 Checks if e is an arctangent2 expression. More...
 
bool is_sinh (const Expression &e)
 Checks if e is a hyperbolic-sine expression. More...
 
bool is_cosh (const Expression &e)
 Checks if e is a hyperbolic-cosine expression. More...
 
bool is_tanh (const Expression &e)
 Checks if e is a hyperbolic-tangent expression. More...
 
bool is_min (const Expression &e)
 Checks if e is a min expression. More...
 
bool is_max (const Expression &e)
 Checks if e is a max expression. More...
 
bool is_ceil (const Expression &e)
 Checks if e is a ceil expression. More...
 
bool is_floor (const Expression &e)
 Checks if e is a floor expression. More...
 
bool is_if_then_else (const Expression &e)
 Checks if e is an if-then-else expression. More...
 
bool is_uninterpreted_function (const Expression &e)
 Checks if e is an uninterpreted-function expression. More...
 
double get_constant_value (const Expression &e)
 Returns the constant value of the constant expression e. More...
 
const ExpressionVarto_variable (const Expression &e)
 
const UnaryExpressionCellto_unary (const Expression &e)
 
const BinaryExpressionCellto_binary (const Expression &e)
 
const ExpressionAddto_addition (const Expression &e)
 
const ExpressionMulto_multiplication (const Expression &e)
 
const ExpressionDivto_division (const Expression &e)
 
const ExpressionLogto_log (const Expression &e)
 
const ExpressionAbsto_abs (const Expression &e)
 
const ExpressionExpto_exp (const Expression &e)
 
const ExpressionSqrtto_sqrt (const Expression &e)
 
const ExpressionPowto_pow (const Expression &e)
 
const ExpressionSinto_sin (const Expression &e)
 
const ExpressionCosto_cos (const Expression &e)
 
const ExpressionTanto_tan (const Expression &e)
 
const ExpressionAsinto_asin (const Expression &e)
 
const ExpressionAcosto_acos (const Expression &e)
 
const ExpressionAtanto_atan (const Expression &e)
 
const ExpressionAtan2to_atan2 (const Expression &e)
 
const ExpressionSinhto_sinh (const Expression &e)
 
const ExpressionCoshto_cosh (const Expression &e)
 
const ExpressionTanhto_tanh (const Expression &e)
 
const ExpressionMinto_min (const Expression &e)
 
const ExpressionMaxto_max (const Expression &e)
 
const ExpressionCeilingto_ceil (const Expression &e)
 
const ExpressionFloorto_floor (const Expression &e)
 
const ExpressionIfThenElseto_if_then_else (const Expression &e)
 
const ExpressionUninterpretedFunctionto_uninterpreted_function (const Expression &e)
 
ExpressionVarto_variable (Expression *e)
 
UnaryExpressionCellto_unary (Expression *e)
 
BinaryExpressionCellto_binary (Expression *e)
 
ExpressionAddto_addition (Expression *e)
 
ExpressionMulto_multiplication (Expression *e)
 
ExpressionDivto_division (Expression *e)
 
ExpressionLogto_log (Expression *e)
 
ExpressionAbsto_abs (Expression *e)
 
ExpressionExpto_exp (Expression *e)
 
ExpressionSqrtto_sqrt (Expression *e)
 
ExpressionPowto_pow (Expression *e)
 
ExpressionSinto_sin (Expression *e)
 
ExpressionCosto_cos (Expression *e)
 
ExpressionTanto_tan (Expression *e)
 
ExpressionAsinto_asin (Expression *e)
 
ExpressionAcosto_acos (Expression *e)
 
ExpressionAtanto_atan (Expression *e)
 
ExpressionAtan2to_atan2 (Expression *e)
 
ExpressionSinhto_sinh (Expression *e)
 
ExpressionCoshto_cosh (Expression *e)
 
ExpressionTanhto_tanh (Expression *e)
 
ExpressionMinto_min (Expression *e)
 
ExpressionMaxto_max (Expression *e)
 
ExpressionCeilingto_ceil (Expression *e)
 
ExpressionFloorto_floor (Expression *e)
 
ExpressionIfThenElseto_if_then_else (Expression *e)
 
ExpressionUninterpretedFunctionto_uninterpreted_function (Expression *e)
 

Constructor & Destructor Documentation

◆ Expression() [1/5]

Expression ( const Expression )
default

◆ Expression() [2/5]

Expression ( Expression &&  )
default

◆ ~Expression()

~Expression ( )
default

◆ Expression() [3/5]

Expression ( )
default

Default constructor.

It constructs Zero().

◆ Expression() [4/5]

Expression ( double  constant)

Constructs a constant.

◆ Expression() [5/5]

Expression ( const Variable var)

Constructs an expression from var.

Precondition
var is not a BOOLEAN variable.

Member Function Documentation

◆ Differentiate()

Expression Differentiate ( const Variable x) const

Differentiates this symbolic expression with respect to the variable var.

Exceptions
std::exceptionif it is not differentiable.

◆ E()

static Expression E ( )
static

Return e, the base of natural logarithms.

◆ EqualTo()

bool EqualTo ( const Expression e) const

Checks structural equality.

Two expressions e1 and e2 are structurally equal when they have the same internal AST(abstract-syntax tree) representation. Please note that we can have two computationally (or extensionally) equivalent expressions which are not structurally equal. For example, consider:

e1 = 2 * (x + y) e2 = 2x + 2y

Obviously, we know that e1 and e2 are evaluated to the same value for all assignments to x and y. However, e1 and e2 are not structurally equal by the definition. Note that e1 is a multiplication expression (is_multiplication(e1) is true) while e2 is an addition expression (is_addition(e2) is true).

One main reason we use structural equality in EqualTo is due to Richardson's Theorem. It states that checking ∀x. E(x) = F(x) is undecidable when we allow sin, asin, log, exp in E and F. Read https://en.wikipedia.org/wiki/Richardson%27s_theorem for details.

Note that for polynomial cases, you can use Expand method and check if two polynomial expressions p1 and p2 are computationally equal. To do so, you check the following:

p1.Expand().EqualTo(p2.Expand())

◆ Evaluate() [1/2]

double Evaluate ( const Environment env = Environment{},
RandomGenerator random_generator = nullptr 
) const

Evaluates using a given environment (by default, an empty environment) and a random number generator.

If there is a random variable in this expression which is unassigned in env, this method uses random_generator to sample a value and use the value to substitute all occurrences of the variable in this expression.

Exceptions
std::exceptionif there exists a non-random variable in this expression whose assignment is not provided by env.
std::exceptionif an unassigned random variable is detected while random_generator is nullptr.
std::exceptionif NaN is detected during evaluation.

◆ Evaluate() [2/2]

double Evaluate ( RandomGenerator random_generator) const

Evaluates using an empty environment and a random number generator.

It uses random_generator to sample values for the random variables in this expression.

See the above overload for the exceptions that it might throw.

◆ EvaluatePartial()

Expression EvaluatePartial ( const Environment env) const

Partially evaluates this expression using an environment env.

Internally, this method promotes env into a substitution (VariableExpression) and call Evaluate::Substitute with it.

Exceptions
std::exceptionif NaN is detected during evaluation.

◆ Expand()

Expression Expand ( ) const

Expands out products and positive integer powers in expression.

For example, (x + 1) * (x - 1) is expanded to x^2 - 1 and (x + y)^2 is expanded to x^2 + 2xy + y^2. Note that Expand applies recursively to sub-expressions. For instance, sin(2 * (x + y)) is expanded to sin(2x + 2y). It also simplifies "division by constant" cases. See "drake/common/test/symbolic_expansion_test.cc" to find the examples.

Exceptions
std::exceptionif NaN is detected during expansion.

◆ get_kind()

ExpressionKind get_kind ( ) const

Returns expression kind.

◆ GetVariables()

Variables GetVariables ( ) const

Collects variables in expression.

◆ is_expanded()

bool is_expanded ( ) const

Returns true if this symbolic expression is already expanded.

Expression::Expand() uses this flag to avoid calling ExpressionCell::Expand() on an pre-expanded expressions. Expression::Expand() also sets this flag before returning the result.

Note
This check is conservative in that false does not always indicate that the expression is not expanded. This is because exact checks can be costly and we want to avoid the exact check at the construction time.

◆ is_polynomial()

bool is_polynomial ( ) const

Checks if this symbolic expression is convertible to Polynomial.

◆ Jacobian()

RowVectorX<Expression> Jacobian ( const Eigen::Ref< const VectorX< Variable >> &  vars) const

Let f be this Expression, computes a row vector of derivatives, [∂f/∂vars(0), ...

, ∂f/∂vars(n-1)] with respect to the variables vars.

◆ Less()

bool Less ( const Expression e) const

Provides lexicographical ordering between expressions.

This function is used as a compare function in map<Expression> and set<Expression> via std::less<drake::symbolic::Expression>.

◆ NaN()

static Expression NaN ( )
static

Returns NaN (Not-a-Number).

◆ One()

static Expression One ( )
static

Returns one.

◆ operator++() [1/2]

Expression& operator++ ( )

Provides prefix increment operator (i.e.

++x).

◆ operator++() [2/2]

Expression operator++ ( int  )

Provides postfix increment operator (i.e.

x++).

◆ operator--() [1/2]

Expression& operator-- ( )

Provides prefix decrement operator (i.e.

–x).

◆ operator--() [2/2]

Expression operator-- ( int  )

Provides postfix decrement operator (i.e.

x–).

◆ operator=() [1/2]

Expression& operator= ( Expression &&  )
default

◆ operator=() [2/2]

Expression& operator= ( const Expression )
default

◆ Pi()

static Expression Pi ( )
static

Returns Pi, the ratio of a circle’s circumference to its diameter.

◆ Substitute() [1/2]

Expression Substitute ( const Variable var,
const Expression e 
) const

Returns a copy of this expression replacing all occurrences of var with e.

Exceptions
std::exceptionif NaN is detected during substitution.

◆ Substitute() [2/2]

Expression Substitute ( const Substitution s) const

Returns a copy of this expression replacing all occurrences of the variables in s with corresponding expressions in s.

Note that the substitutions occur simultaneously. For example, (x / y).Substitute({{x, y}, {y, x}}) gets (y / x).

Exceptions
std::exceptionif NaN is detected during substitution.

◆ to_string()

std::string to_string ( ) const

Returns string representation of Expression.

◆ Zero()

static Expression Zero ( )
static

Returns zero.

Friends And Related Function Documentation

◆ abs

Expression abs ( const Expression e)
friend

◆ acos

Expression acos ( const Expression e)
friend

◆ asin

Expression asin ( const Expression e)
friend

◆ atan

Expression atan ( const Expression e)
friend

◆ atan2

Expression atan2 ( const Expression e1,
const Expression e2 
)
friend

◆ ceil

Expression ceil ( const Expression e)
friend

◆ clamp

Expression clamp ( const Expression v,
const Expression lo,
const Expression hi 
)
friend

◆ cos

Expression cos ( const Expression e)
friend

◆ cosh

Expression cosh ( const Expression e)
friend

◆ exp

Expression exp ( const Expression e)
friend

◆ ExpressionAddFactory

friend class ExpressionAddFactory
friend

◆ ExpressionMulFactory

friend class ExpressionMulFactory
friend

◆ floor

Expression floor ( const Expression e)
friend

◆ get_constant_value

double get_constant_value ( const Expression e)
friend

Returns the constant value of the constant expression e.

Precondition
{e is a constant expression.}

◆ hash_append

void hash_append ( HashAlgorithm &  hasher,
const Expression item 
)
friend

Implements the hash_append generic hashing concept.

◆ if_then_else

Expression if_then_else ( const Formula f_cond,
const Expression e_then,
const Expression e_else 
)
friend

Constructs if-then-else expression.

  if_then_else(cond, expr_then, expr_else)

The value returned by the above if-then-else expression is expr_then if cond is evaluated to true. Otherwise, it returns expr_else.

The semantics is similar to the C++'s conditional expression constructed by its ternary operator, ?:. However, there is a key difference between the C++'s conditional expression and our if_then_else expression in a way the arguments are evaluated during the construction.

  • In case of the C++'s conditional expression, cond ? expr_then : expr_else, the then expression expr_then (respectively, the else expression expr_else) is only evaluated when the conditional expression cond is evaluated to true (respectively, when cond is evaluated to false).
  • In case of the symbolic expression, if_then_else(cond, expr_then, expr_else), however, both arguments expr_then and expr_else are evaluated first and then passed to the if_then_else function.
Note
This function returns an expression and it is different from the C++'s if-then-else statement.
While it is still possible to define min, max, abs math functions using if_then_else expression, it is highly recommended to use the provided native definitions for them because it allows solvers to detect specific math functions and to have a room for special optimizations.
More information about the C++'s conditional expression and ternary operator is available at http://en.cppreference.com/w/cpp/language/operator_other#Conditional_operator.

◆ internal::Gemm

friend struct internal::Gemm
friend

◆ is_abs

bool is_abs ( const Expression e)
friend

Checks if e is an abs expression.

◆ is_acos

bool is_acos ( const Expression e)
friend

Checks if e is an arccosine expression.

◆ is_addition

bool is_addition ( const Expression e)
friend

Checks if e is an addition expression.

◆ is_asin

bool is_asin ( const Expression e)
friend

Checks if e is an arcsine expression.

◆ is_atan

bool is_atan ( const Expression e)
friend

Checks if e is an arctangent expression.

◆ is_atan2

bool is_atan2 ( const Expression e)
friend

Checks if e is an arctangent2 expression.

◆ is_ceil

bool is_ceil ( const Expression e)
friend

Checks if e is a ceil expression.

◆ is_constant [1/2]

bool is_constant ( const Expression e)
friend

Checks if e is a constant expression.

◆ is_constant [2/2]

bool is_constant ( const Expression e,
double  value 
)
friend

Checks if e is a constant expression representing v.

◆ is_cos

bool is_cos ( const Expression e)
friend

Checks if e is a cosine expression.

◆ is_cosh

bool is_cosh ( const Expression e)
friend

Checks if e is a hyperbolic-cosine expression.

◆ is_division

bool is_division ( const Expression e)
friend

Checks if e is a division expression.

◆ is_exp

bool is_exp ( const Expression e)
friend

Checks if e is an exp expression.

◆ is_floor

bool is_floor ( const Expression e)
friend

Checks if e is a floor expression.

◆ is_if_then_else

bool is_if_then_else ( const Expression e)
friend

Checks if e is an if-then-else expression.

◆ is_log

bool is_log ( const Expression e)
friend

Checks if e is a log expression.

◆ is_max

bool is_max ( const Expression e)
friend

Checks if e is a max expression.

◆ is_min

bool is_min ( const Expression e)
friend

Checks if e is a min expression.

◆ is_multiplication

bool is_multiplication ( const Expression e)
friend

Checks if e is a multiplication expression.

◆ is_nan

bool is_nan ( const Expression e)
friend

Checks if e is NaN.

◆ is_pow

bool is_pow ( const Expression e)
friend

Checks if e is a power-function expression.

◆ is_sin

bool is_sin ( const Expression e)
friend

Checks if e is a sine expression.

◆ is_sinh

bool is_sinh ( const Expression e)
friend

Checks if e is a hyperbolic-sine expression.

◆ is_sqrt

bool is_sqrt ( const Expression e)
friend

Checks if e is a square-root expression.

◆ is_tan

bool is_tan ( const Expression e)
friend

Checks if e is a tangent expression.

◆ is_tanh

bool is_tanh ( const Expression e)
friend

Checks if e is a hyperbolic-tangent expression.

◆ is_uninterpreted_function

bool is_uninterpreted_function ( const Expression e)
friend

Checks if e is an uninterpreted-function expression.

◆ is_variable

bool is_variable ( const Expression e)
friend

Checks if e is a variable expression.

◆ log

Expression log ( const Expression e)
friend

◆ max

Expression max ( const Expression e1,
const Expression e2 
)
friend

◆ min

Expression min ( const Expression e1,
const Expression e2 
)
friend

◆ operator *

Expression operator * ( Expression  lhs,
const Expression rhs 
)
friend

◆ operator *=

Expression& operator *= ( Expression lhs,
const Expression rhs 
)
friend

◆ operator+ [1/2]

Expression operator+ ( Expression  lhs,
const Expression rhs 
)
friend

◆ operator+ [2/2]

Expression operator+ ( const Expression e)
friend

Provides unary plus operator.

◆ operator+=

Expression& operator+= ( Expression lhs,
const Expression rhs 
)
friend

◆ operator- [1/2]

Expression operator- ( Expression  lhs,
const Expression rhs 
)
friend

◆ operator- [2/2]

Expression operator- ( const Expression e)
friend

Provides unary minus operator.

◆ operator-=

Expression& operator-= ( Expression lhs,
const Expression rhs 
)
friend

◆ operator/

Expression operator/ ( Expression  lhs,
const Expression rhs 
)
friend

◆ operator/=

Expression& operator/= ( Expression lhs,
const Expression rhs 
)
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Expression e 
)
friend

◆ pow

Expression pow ( const Expression e1,
const Expression e2 
)
friend

◆ sin

Expression sin ( const Expression e)
friend

◆ sinh

Expression sinh ( const Expression e)
friend

◆ sqrt

Expression sqrt ( const Expression e)
friend

◆ swap

void swap ( Expression a,
Expression b 
)
friend

◆ tan

Expression tan ( const Expression e)
friend

◆ tanh

Expression tanh ( const Expression e)
friend

◆ to_abs [1/2]

const ExpressionAbs& to_abs ( const Expression e)
friend

◆ to_abs [2/2]

ExpressionAbs& to_abs ( Expression e)
friend

◆ to_acos [1/2]

const ExpressionAcos& to_acos ( const Expression e)
friend

◆ to_acos [2/2]

ExpressionAcos& to_acos ( Expression e)
friend

◆ to_addition [1/2]

const ExpressionAdd& to_addition ( const Expression e)
friend

◆ to_addition [2/2]

ExpressionAdd& to_addition ( Expression e)
friend

◆ to_asin [1/2]

const ExpressionAsin& to_asin ( const Expression e)
friend

◆ to_asin [2/2]

ExpressionAsin& to_asin ( Expression e)
friend

◆ to_atan [1/2]

const ExpressionAtan& to_atan ( const Expression e)
friend

◆ to_atan [2/2]

ExpressionAtan& to_atan ( Expression e)
friend

◆ to_atan2 [1/2]

const ExpressionAtan2& to_atan2 ( const Expression e)
friend

◆ to_atan2 [2/2]

ExpressionAtan2& to_atan2 ( Expression e)
friend

◆ to_binary [1/2]

const BinaryExpressionCell& to_binary ( const Expression e)
friend

◆ to_binary [2/2]

BinaryExpressionCell& to_binary ( Expression e)
friend

◆ to_ceil [1/2]

const ExpressionCeiling& to_ceil ( const Expression e)
friend

◆ to_ceil [2/2]

ExpressionCeiling& to_ceil ( Expression e)
friend

◆ to_cos [1/2]

const ExpressionCos& to_cos ( const Expression e)
friend

◆ to_cos [2/2]

ExpressionCos& to_cos ( Expression e)
friend

◆ to_cosh [1/2]

const ExpressionCosh& to_cosh ( const Expression e)
friend

◆ to_cosh [2/2]

ExpressionCosh& to_cosh ( Expression e)
friend

◆ to_division [1/2]

const ExpressionDiv& to_division ( const Expression e)
friend

◆ to_division [2/2]

ExpressionDiv& to_division ( Expression e)
friend

◆ to_exp [1/2]

const ExpressionExp& to_exp ( const Expression e)
friend

◆ to_exp [2/2]

ExpressionExp& to_exp ( Expression e)
friend

◆ to_floor [1/2]

const ExpressionFloor& to_floor ( const Expression e)
friend

◆ to_floor [2/2]

ExpressionFloor& to_floor ( Expression e)
friend

◆ to_if_then_else [1/2]

const ExpressionIfThenElse& to_if_then_else ( const Expression e)
friend

◆ to_if_then_else [2/2]

ExpressionIfThenElse& to_if_then_else ( Expression e)
friend

◆ to_log [1/2]

const ExpressionLog& to_log ( const Expression e)
friend

◆ to_log [2/2]

ExpressionLog& to_log ( Expression e)
friend

◆ to_max [1/2]

const ExpressionMax& to_max ( const Expression e)
friend

◆ to_max [2/2]

ExpressionMax& to_max ( Expression e)
friend

◆ to_min [1/2]

const ExpressionMin& to_min ( const Expression e)
friend

◆ to_min [2/2]

ExpressionMin& to_min ( Expression e)
friend

◆ to_multiplication [1/2]

const ExpressionMul& to_multiplication ( const Expression e)
friend

◆ to_multiplication [2/2]

ExpressionMul& to_multiplication ( Expression e)
friend

◆ to_pow [1/2]

const ExpressionPow& to_pow ( const Expression e)
friend

◆ to_pow [2/2]

ExpressionPow& to_pow ( Expression e)
friend

◆ to_sin [1/2]

const ExpressionSin& to_sin ( const Expression e)
friend

◆ to_sin [2/2]

ExpressionSin& to_sin ( Expression e)
friend

◆ to_sinh [1/2]

const ExpressionSinh& to_sinh ( const Expression e)
friend

◆ to_sinh [2/2]

ExpressionSinh& to_sinh ( Expression e)
friend

◆ to_sqrt [1/2]

const ExpressionSqrt& to_sqrt ( const Expression e)
friend

◆ to_sqrt [2/2]

ExpressionSqrt& to_sqrt ( Expression e)
friend

◆ to_tan [1/2]

const ExpressionTan& to_tan ( const Expression e)
friend

◆ to_tan [2/2]

ExpressionTan& to_tan ( Expression e)
friend

◆ to_tanh [1/2]

const ExpressionTanh& to_tanh ( const Expression e)
friend

◆ to_tanh [2/2]

ExpressionTanh& to_tanh ( Expression e)
friend

◆ to_unary [1/2]

const UnaryExpressionCell& to_unary ( const Expression e)
friend

◆ to_unary [2/2]

UnaryExpressionCell& to_unary ( Expression e)
friend

◆ to_uninterpreted_function [1/2]

const ExpressionUninterpretedFunction& to_uninterpreted_function ( const Expression e)
friend

◆ to_uninterpreted_function [2/2]

ExpressionUninterpretedFunction& to_uninterpreted_function ( Expression e)
friend

◆ to_variable [1/2]

const ExpressionVar& to_variable ( const Expression e)
friend

◆ to_variable [2/2]

ExpressionVar& to_variable ( Expression e)
friend

◆ uninterpreted_function

Expression uninterpreted_function ( std::string  name,
std::vector< Expression arguments 
)
friend

Constructs an uninterpreted-function expression with name and arguments.

An uninterpreted function is an opaque function that has no other property than its name and a list of its arguments. This is useful to applications where it is good enough to provide abstract information of a function without exposing full details. Declaring sparsity of a system is a typical example.


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