|
| BinaryExpression ()=default |
|
| BinaryExpression (const BinaryExpression &other) |
|
| BinaryExpression (const MostSigOpT &mostSigOp, const LeastSigOpT &leastSigOp) |
|
template<IExpression Op1T, IExpression Op2T, IExpression... OpsT> |
| BinaryExpression (const Op1T &op1, const Op2T &op2, const OpsT &... ops) |
|
auto | Copy () const -> std::unique_ptr< Expression > final |
| Copies this expression.
|
|
auto | Differentiate (const Expression &differentiationVariable) const -> std::unique_ptr< Expression > override |
| Tries to differentiate this function.
|
|
auto | Equals (const Expression &other) const -> bool final |
| Compares this expression to another expression for equality.
|
|
auto | Generalize () const -> std::unique_ptr< Expression > final |
| Converts this expression to a more general expression.
|
|
auto | Simplify () const -> std::unique_ptr< Expression > override |
| Simplifies this expression.
|
|
auto | Integrate (const Expression &integrationVariable) const -> std::unique_ptr< Expression > override |
| Attempts to integrate this expression using integration rules.
|
|
auto | StructurallyEquivalent (const Expression &other) const -> bool final |
| Checks whether this expression is structurally equivalent to another expression.
|
|
auto | Flatten (std::vector< std::unique_ptr< Expression > > &out) const -> void |
| Flattens this expression.
|
|
auto | GetMostSigOp () const -> const MostSigOpT & |
| Gets the most significant operand of this expression.
|
|
auto | GetLeastSigOp () const -> const LeastSigOpT & |
| Gets the least significant operand of this expression.
|
|
auto | HasMostSigOp () const -> bool |
| Gets whether this expression has a most significant operand.
|
|
auto | HasLeastSigOp () const -> bool |
| Gets whether this expression has a least significant operand.
|
|
template<typename T >
requires IsAnyOf<T, MostSigOpT, Expression> |
auto | SetMostSigOp (const T &op) -> bool |
| Sets the most significant operand of this expression.
|
|
template<typename T >
requires IsAnyOf<T, LeastSigOpT, Expression> |
auto | SetLeastSigOp (const T &op) -> bool |
| Sets the least significant operand of this expression.
|
|
auto | Substitute (const Expression &var, const Expression &val) -> std::unique_ptr< Expression > override |
|
auto | SwapOperands () const -> DerivedT< LeastSigOpT, MostSigOpT > |
| Swaps the operands of this expression.
|
|
auto | operator= (const BinaryExpression &other) -> BinaryExpression &=default |
|
void | Serialize (SerializationVisitor &visitor) const override |
| This function serializes the expression object.
|
|
auto | FindZeros () const -> std::vector< std::unique_ptr< Expression > > |
| The FindZeros function finds all rational real zeros, and up to 2 irrational/complex zeros of a polynomial.
|
|
virtual auto | GetCategory () const -> uint32_t |
| Gets the category of this expression.
|
|
virtual auto | GetType () const -> ExpressionType |
| Gets the type of this expression.
|
|
virtual auto | IntegrateWithBounds (const Expression &, const Expression &, const Expression &) -> std::unique_ptr< Expression > |
| Attempts to integrate this expression using integration rules.
|
|
template<IExpression T> |
bool | Is () const |
| Gets whether this expression is of a specific type.
|
|
template<template< typename > typename T> |
bool | Is () const |
|
template<template< typename, typename > typename T> |
bool | Is () const |
|
virtual | ~Expression ()=default |
|
template<template< IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT>
class Oasis::BinaryExpression< DerivedT, MostSigOpT, LeastSigOpT >
A binary expression.
The BinaryExpression class is a base class for all binary expressions. It provides a common interface for all binary expressions, and implements common functionality. Specifically, it provides functionality dependent on the Derived class. The Derived class must be a template class that takes two template parameters, the types of the most significant and least significant operands, respectively. This class uses a Curiously Recurring Template Pattern
- Note
- This class is not intended to be used directly by end users.
- Template Parameters
-
DerivedT | The derived class. |
MostSigOpT | The type of the most significant operand. |
LeastSigOpT | The type of the least significant operand. |
template<template< IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT>
Compares this expression to another expression for equality.
Two expressions are equal if they are structurally equivalent and have the same value. While this method considers the associativity and commutativity of expressions, it does not simplify the expressions before comparing them. For example, Add<Real>(Real(1), Real(2))
and Add<Real>(Real(2), Real(1))
are not equal, despite being structurally equivalent.
- Parameters
-
other | The other expression. |
- Returns
- Whether the two expressions are equal.
Implements Oasis::Expression.
template<template< IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT>
Flattens this expression.
Flattening an expression means that all operands of the expression are copied into a vector. For example, flattening the expression Add { Add { Real { 1.0 }, Real { 2.0 } }, Real { 3.0 } }
would result in a vector containing three Real
expressions, Real { 1.0 }
, Real { 2.0 }
, and Real { 3.0 }
. This is useful for simplifying expressions, as it allows the simplifier to operate on the operands of the expression without having to worry about the structure of the expression.
- Parameters
-
out | The vector to copy the operands into. |
template<template< IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT>
Converts this expression to a more general expression.
Some expressions may explicitly specify the type of their operands. For example, a Divide<Real>
expression may only accept Real
operands. This function converts the expression to a more general expression, such as Divide<Expression>
, which accepts any expression as an operand.
- Returns
- The generalized expression.
Reimplemented from Oasis::Expression.
template<template< IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT>
Checks whether this expression is structurally equivalent to another expression.
Two expressions are structurally equivalent if the share the same tree structure. For example, Add<Real>(Real(1), Real(2))
and Add<Real>(Real(2), Real(1))
are structurally equivalent despite having different values.
- Parameters
-
other | The other expression. |
- Returns
- Whether the two expressions are structurally equivalent.
Implements Oasis::Expression.