OASIS
Open Algebra Software
Loading...
Searching...
No Matches
Oasis::UnaryExpression< DerivedT, OperandT > Class Template Reference

#include <Oasis/UnaryExpression.hpp>

Inheritance diagram for Oasis::UnaryExpression< DerivedT, OperandT >:
[legend]
Collaboration diagram for Oasis::UnaryExpression< DerivedT, OperandT >:
[legend]

Public Member Functions

 UnaryExpression ()=default
 
 UnaryExpression (const UnaryExpression &other)
 
 UnaryExpression (const OperandT &operand)
 
auto Copy () const -> std::unique_ptr< Expression > final
 Copies this expression.
 
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 GetOperand () const -> const OperandT &
 
auto HasOperand () const -> bool
 
auto StructurallyEquivalent (const Expression &other) const -> bool final
 Checks whether this expression is structurally equivalent to another expression.
 
auto SetOperand (const OperandT &operand) -> void
 
auto Substitute (const Expression &var, const Expression &val) -> std::unique_ptr< Expression > override
 
void Serialize (SerializationVisitor &visitor) const override
 This function serializes the expression object.
 
- Public Member Functions inherited from Oasis::Expression
virtual auto Differentiate (const Expression &) const -> std::unique_ptr< Expression >
 Tries to differentiate this function.
 
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 auto Simplify () const -> std::unique_ptr< Expression >
 Simplifies this expression.
 
virtual ~Expression ()=default
 

Protected Attributes

std::unique_ptr< OperandT > op
 

Constructor & Destructor Documentation

◆ UnaryExpression() [1/3]

template<template< IExpression > class DerivedT, IExpression OperandT>
Oasis::UnaryExpression< DerivedT, OperandT >::UnaryExpression ( )
default

◆ UnaryExpression() [2/3]

template<template< IExpression > class DerivedT, IExpression OperandT>
Oasis::UnaryExpression< DerivedT, OperandT >::UnaryExpression ( const UnaryExpression< DerivedT, OperandT > & other)
inline

◆ UnaryExpression() [3/3]

template<template< IExpression > class DerivedT, IExpression OperandT>
Oasis::UnaryExpression< DerivedT, OperandT >::UnaryExpression ( const OperandT & operand)
inlineexplicit

Member Function Documentation

◆ Copy()

template<template< IExpression > class DerivedT, IExpression OperandT>
auto Oasis::UnaryExpression< DerivedT, OperandT >::Copy ( ) const -> std::unique_ptr< Expression >
inlinefinalvirtual

Copies this expression.

Returns
A copy of this expression.

Implements Oasis::Expression.

◆ Equals()

template<template< IExpression > class DerivedT, IExpression OperandT>
auto Oasis::UnaryExpression< DerivedT, OperandT >::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.

◆ Generalize()

template<template< IExpression > class DerivedT, IExpression OperandT>
auto Oasis::UnaryExpression< DerivedT, OperandT >::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.

◆ GetOperand()

template<template< IExpression > class DerivedT, IExpression OperandT>
auto Oasis::UnaryExpression< DerivedT, OperandT >::GetOperand ( ) const -> const OperandT&
inline

◆ HasOperand()

template<template< IExpression > class DerivedT, IExpression OperandT>
auto Oasis::UnaryExpression< DerivedT, OperandT >::HasOperand ( ) const -> bool
inline

◆ Serialize()

template<template< IExpression > class DerivedT, IExpression OperandT>
void Oasis::UnaryExpression< DerivedT, OperandT >::Serialize ( SerializationVisitor & visitor) const
inlineoverridevirtual

This function serializes the expression object.

Parameters
visitorThe serializer class object to write the Expression data.

Implements Oasis::Expression.

◆ SetOperand()

template<template< IExpression > class DerivedT, IExpression OperandT>
auto Oasis::UnaryExpression< DerivedT, OperandT >::SetOperand ( const OperandT & operand) -> void
inline

◆ StructurallyEquivalent()

template<template< IExpression > class DerivedT, IExpression OperandT>
auto Oasis::UnaryExpression< DerivedT, OperandT >::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.

◆ Substitute()

template<template< IExpression > class DerivedT, IExpression OperandT>
auto Oasis::UnaryExpression< DerivedT, OperandT >::Substitute ( const Expression & var,
const Expression & val ) -> std::unique_ptr<Expression>
inlineoverridevirtual

Implements Oasis::Expression.

Member Data Documentation

◆ op

template<template< IExpression > class DerivedT, IExpression OperandT>
std::unique_ptr<OperandT> Oasis::UnaryExpression< DerivedT, OperandT >::op
protected

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