Abstract interface for all ViennaMath runtime expressions. More...
#include <expression_interface.hpp>
Public Types | |
typedef NumericT | numeric_type |
The underlying numeric type of all arithmetical operations (typically 'double'). | |
typedef rt_expression_interface < NumericT > | interface_type |
The interface type of the respective expression. | |
Public Member Functions | |
virtual | ~rt_expression_interface () |
virtual interface_type * | clone () const =0 |
Returns a pointer to a copy of the expression. The caller must ensure the deletion of the returned copy. | |
virtual std::string | deep_str () const =0 |
Returns a detailed string fully identifying the expression. | |
virtual std::string | shallow_str () const |
Returns a short string identifying just the type of the expression. | |
virtual NumericT | eval (std::vector< NumericT > const &v) const =0 |
Evaluates the expression at the given vector. | |
virtual NumericT | eval (NumericT val) const =0 |
Evaluates an expression taking one variable only. | |
virtual bool | is_unary () const |
Returns true, if the expression is a unary expression. | |
virtual bool | is_constant () const |
Returns true, if the expression can be evaluated without providing values for variables (i.e. the expression is a constant). | |
virtual NumericT | unwrap () const =0 |
Returns the numeric value of the expression. | |
virtual bool | shallow_equal (const interface_type *other) const =0 |
Checks the current expression for being equal to 'other'. Checks for same type only, does not check members. | |
virtual bool | deep_equal (const interface_type *other) const =0 |
Checks the current expression for being equal to 'other'. Performs a deep check for equality of members. | |
virtual interface_type * | recursive_manipulation (rt_manipulation_wrapper< interface_type > const &fw) const |
Provides a common interface for top-down manipulations of the expression. | |
virtual void | recursive_traversal (rt_traversal_wrapper< interface_type > const &fw) const |
Provides a common interface for all top-down traversals of the expression. | |
virtual interface_type * | substitute (const interface_type *e, const interface_type *repl) const =0 |
Returns a new expression with all occurrences of 'e' replaced by 'repl'. The caller must ensure the deletion of the object the returned pointer is referring to. | |
virtual interface_type * | substitute (std::vector< const interface_type * > const &e, std::vector< const interface_type * > const &repl) const =0 |
Returns a expression with all occurrances of 'e' in the expression substituted by the respective replacement in 'repl'. The caller must ensure the deletion of the object the returned pointer is referring to. | |
virtual interface_type * | simplify () const |
Returns an optimized expression, where trivial operations such as multiplications by unity are removed. The caller must ensure the deletion of the object the returned pointer is referring to. | |
virtual bool | can_simplify () const |
Returns true if the experssion can be further optimized. | |
virtual interface_type * | diff (const interface_type *diff_var) const =0 |
Returns the expression differentiated with respect to the provided variable. The caller must ensure the deletion of the object the returned pointer is referring to. |
Abstract interface for all ViennaMath runtime expressions.
typedef rt_expression_interface<NumericT> interface_type |
The interface type of the respective expression.
typedef NumericT numeric_type |
The underlying numeric type of all arithmetical operations (typically 'double').
virtual ~rt_expression_interface | ( | ) | [inline, virtual] |
virtual bool can_simplify | ( | ) | const [inline, virtual] |
Returns true if the experssion can be further optimized.
virtual interface_type* clone | ( | ) | const [pure virtual] |
Returns a pointer to a copy of the expression. The caller must ensure the deletion of the returned copy.
virtual bool deep_equal | ( | const interface_type * | other | ) | const [pure virtual] |
Checks the current expression for being equal to 'other'. Performs a deep check for equality of members.
virtual std::string deep_str | ( | ) | const [pure virtual] |
Returns a detailed string fully identifying the expression.
virtual interface_type* diff | ( | const interface_type * | diff_var | ) | const [pure virtual] |
Returns the expression differentiated with respect to the provided variable. The caller must ensure the deletion of the object the returned pointer is referring to.
virtual NumericT eval | ( | std::vector< NumericT > const & | v | ) | const [pure virtual] |
Evaluates the expression at the given vector.
virtual NumericT eval | ( | NumericT | val | ) | const [pure virtual] |
Evaluates an expression taking one variable only.
virtual bool is_constant | ( | ) | const [inline, virtual] |
Returns true, if the expression can be evaluated without providing values for variables (i.e. the expression is a constant).
virtual bool is_unary | ( | ) | const [inline, virtual] |
Returns true, if the expression is a unary expression.
virtual interface_type* recursive_manipulation | ( | rt_manipulation_wrapper< interface_type > const & | fw | ) | const [inline, virtual] |
Provides a common interface for top-down manipulations of the expression.
virtual void recursive_traversal | ( | rt_traversal_wrapper< interface_type > const & | fw | ) | const [inline, virtual] |
Provides a common interface for all top-down traversals of the expression.
virtual bool shallow_equal | ( | const interface_type * | other | ) | const [pure virtual] |
Checks the current expression for being equal to 'other'. Checks for same type only, does not check members.
virtual std::string shallow_str | ( | ) | const [inline, virtual] |
Returns a short string identifying just the type of the expression.
virtual interface_type* simplify | ( | ) | const [inline, virtual] |
Returns an optimized expression, where trivial operations such as multiplications by unity are removed. The caller must ensure the deletion of the object the returned pointer is referring to.
virtual interface_type* substitute | ( | const interface_type * | e, | |
const interface_type * | repl | |||
) | const [pure virtual] |
Returns a new expression with all occurrences of 'e' replaced by 'repl'. The caller must ensure the deletion of the object the returned pointer is referring to.
virtual interface_type* substitute | ( | std::vector< const interface_type * > const & | e, | |
std::vector< const interface_type * > const & | repl | |||
) | const [pure virtual] |
Returns a expression with all occurrances of 'e' in the expression substituted by the respective replacement in 'repl'. The caller must ensure the deletion of the object the returned pointer is referring to.
virtual NumericT unwrap | ( | ) | const [pure virtual] |
Returns the numeric value of the expression.