OASIS
Open Algebra Software
Loading...
Searching...
No Matches
Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT > Class Template Reference

#include <Oasis/BoundedBinaryExpression.hpp>

Inheritance diagram for Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >:
[legend]
Collaboration diagram for Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >:
[legend]

Public Member Functions

 BoundedBinaryExpression ()=default
 
 BoundedBinaryExpression (const BoundedBinaryExpression &other)
 
 BoundedBinaryExpression (const MostSigOpT &mostSigOp, const LeastSigOpT &leastSigOp)
 
auto Copy () const -> std::unique_ptr< Expression > final
 Copies this expression.
 
auto Copy (tf::Subflow &subflow) const -> std::unique_ptr< Expression > final
 
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 Generalize (tf::Subflow &subflow) const -> std::unique_ptr< Expression > final
 
auto Simplify () const -> std::unique_ptr< Expression > override
 Simplifies this expression.
 
auto Simplify (tf::Subflow &subflow) const -> std::unique_ptr< Expression > override
 
auto StructurallyEquivalent (const Expression &other) const -> bool final
 Checks whether this expression is structurally equivalent to another expression.
 
auto StructurallyEquivalent (const Expression &other, tf::Subflow &subflow) const -> bool final
 
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 -> DerivedSpecialized
 Swaps the operands of this expression.
 
auto operator= (const BoundedBinaryExpression &other) -> BoundedBinaryExpression &=default
 
void Serialize (SerializationVisitor &visitor) const override
 This function serializes the expression object.
 
- Public Member Functions inherited from Oasis::BoundedExpression< LowerBoundT, UpperBoundT >
 BoundedExpression ()=default
 
 BoundedExpression (const BoundedExpression &other)
 
 BoundedExpression (const LowerBoundT &lowerBound, const UpperBoundT &upperBound)
 
auto HasLowerBound () const -> bool
 
auto HasUpperBound () const -> bool
 
auto GetLowerBound () const -> const LowerBoundT &
 
auto GetUpperBound () const -> const UpperBoundT &
 
template<typename T >
requires IsAnyOf<T, LowerBoundT, Expression>
void SetLowerBound (const T &expr)
 
template<typename T >
requires IsAnyOf<T, UpperBoundT, Expression>
void SetUpperBound (const T &expr)
 
- Public Member Functions inherited from Oasis::Expression
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 Integrate (const Expression &) const -> std::unique_ptr< Expression >
 Attempts to integrate this expression using integration rules.
 
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
 

Constructor & Destructor Documentation

◆ BoundedBinaryExpression() [1/3]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::BoundedBinaryExpression ( )
default

◆ BoundedBinaryExpression() [2/3]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::BoundedBinaryExpression ( const BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT > & other)
inline

◆ BoundedBinaryExpression() [3/3]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::BoundedBinaryExpression ( const MostSigOpT & mostSigOp,
const LeastSigOpT & leastSigOp )
inline

Member Function Documentation

◆ Copy() [1/2]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Copy ( ) const -> std::unique_ptr< Expression >
inlinefinalvirtual

Copies this expression.

Returns
A copy of this expression.

Implements Oasis::Expression.

◆ Copy() [2/2]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Copy ( tf::Subflow & subflow) const -> std::unique_ptr<Expression>
inlinefinal

◆ Differentiate()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Differentiate ( const Expression & ) const -> std::unique_ptr<Expression>
inlineoverridevirtual

Tries to differentiate this function.

Returns
the differentiated expression.

Reimplemented from Oasis::Expression.

◆ Equals()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Equals ( const Expression & other) const -> bool
inlinefinalvirtual

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
otherThe other expression.
Returns
Whether the two expressions are equal.

Implements Oasis::Expression.

◆ Flatten()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Flatten ( std::vector< std::unique_ptr< Expression > > & out) const -> void
inline

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
outThe vector to copy the operands into.

◆ Generalize() [1/2]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Generalize ( ) const -> std::unique_ptr<Expression>
inlinefinalvirtual

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.

◆ Generalize() [2/2]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Generalize ( tf::Subflow & subflow) const -> std::unique_ptr<Expression>
inlinefinal

◆ GetLeastSigOp()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::GetLeastSigOp ( ) const -> const LeastSigOpT&
inline

Gets the least significant operand of this expression.

Returns
The least significant operand of this expression.

◆ GetMostSigOp()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::GetMostSigOp ( ) const -> const MostSigOpT&
inline

Gets the most significant operand of this expression.

Returns
The most significant operand of this expression.

◆ HasLeastSigOp()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::HasLeastSigOp ( ) const -> bool
inline

Gets whether this expression has a least significant operand.

Returns
True if this expression has a least significant operand, false otherwise.

◆ HasMostSigOp()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::HasMostSigOp ( ) const -> bool
inline

Gets whether this expression has a most significant operand.

Returns
True if this expression has a most significant operand, false otherwise.

◆ operator=()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::operator= ( const BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT > & other) -> BoundedBinaryExpression &=default
default

◆ Serialize()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
void Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Serialize ( SerializationVisitor & visitor) const
inlineoverridevirtual

This function serializes the expression object.

Parameters
visitorThe serializer class object to write the Expression data.

Implements Oasis::Expression.

◆ SetLeastSigOp()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
template<typename T >
requires IsAnyOf<T, LeastSigOpT, Expression>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::SetLeastSigOp ( const T & op) -> bool
inline

Sets the least significant operand of this expression.

Parameters
opThe operand to set.

◆ SetMostSigOp()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
template<typename T >
requires IsAnyOf<T, MostSigOpT, Expression>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::SetMostSigOp ( const T & op) -> bool
inline

Sets the most significant operand of this expression.

Parameters
opThe operand to set.

◆ Simplify() [1/2]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Simplify ( ) const -> std::unique_ptr<Expression>
inlineoverridevirtual

Simplifies this expression.

Returns
The simplified expression.

Reimplemented from Oasis::Expression.

◆ Simplify() [2/2]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Simplify ( tf::Subflow & subflow) const -> std::unique_ptr<Expression>
inlineoverride

◆ StructurallyEquivalent() [1/2]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::StructurallyEquivalent ( const Expression & other) const -> bool
inlinefinalvirtual

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
otherThe other expression.
Returns
Whether the two expressions are structurally equivalent.

Implements Oasis::Expression.

◆ StructurallyEquivalent() [2/2]

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::StructurallyEquivalent ( const Expression & other,
tf::Subflow & subflow ) const -> bool
inlinefinal

◆ Substitute()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::Substitute ( const Expression & var,
const Expression & val ) -> std::unique_ptr<Expression>
inlineoverridevirtual

Implements Oasis::Expression.

◆ SwapOperands()

template<template< IExpression, IExpression, IExpression, IExpression > class DerivedT, IExpression MostSigOpT = Expression, IExpression LeastSigOpT = MostSigOpT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
auto Oasis::BoundedBinaryExpression< DerivedT, MostSigOpT, LeastSigOpT, LowerBoundT, UpperBoundT >::SwapOperands ( ) const -> DerivedSpecialized
inline

Swaps the operands of this expression.

Returns
A new expression with the operands swapped.

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