Public Types | Public Member Functions

rt_unary_expr< InterfaceType > Class Template Reference

Runtime representation of a unary expression F(e), where F is a function of one argument (e.g. log()) and e is an expression. More...

#include <unary_expr.hpp>

Public Types

typedef InterfaceType::numeric_type numeric_type

Public Member Functions

 rt_unary_expr ()
 rt_unary_expr (InterfaceType *lhs, op_interface_type *op)
 rt_unary_expr (InterfaceType *lhs)
template<typename LHS , typename OP , typename RHS >
 rt_unary_expr (ct_unary_expr< LHS, OP > const &other)
 rt_unary_expr (rt_variable< InterfaceType > const &other)
template<typename T >
 rt_unary_expr (rt_constant< T, InterfaceType > const &other)
template<long value>
 rt_unary_expr (ct_constant< value > const &other)
 rt_unary_expr (rt_unary_expr const &other)
template<typename LHS , typename OP >
rt_unary_exproperator= (ct_unary_expr< LHS, OP > const &other)
rt_unary_exproperator= (rt_unary_expr const &other)
template<typename ScalarType >
rt_unary_exproperator= (rt_constant< ScalarType > const &other)
template<long value>
rt_unary_exproperator= (ct_constant< value > const &other)
rt_unary_exproperator= (numeric_type value)
const InterfaceType * lhs () const
 Returns the expression the unary function is acting on.
const op_interface_typeop () const
 Returns the operation.
numeric_type operator() (numeric_type val) const
 Evaluation of the unary expression at val (i.e. all variables with ID 0 replaced by 'val').
template<typename ScalarType >
numeric_type operator() (rt_constant< ScalarType > val) const
 Evaluation of the unary expression at the ViennaMath runtime constant val.
template<long value>
numeric_type operator() (ct_constant< value > val) const
 Evaluation of the unary expression at the ViennaMath compiletime constant val.
template<typename VectorType >
numeric_type operator() (VectorType const &v) const
 Evaluation of the unary expression at the vector v.
numeric_type operator() (std::vector< numeric_type > const &stl_v) const
 Evaluation of the unary expression at the STL vector v.
template<typename T0 >
numeric_type operator() (viennamath::ct_vector_1< T0 > const &v) const
 Evaluation of the unary expression at a ViennaMath compiletime vector with one entry.
template<typename T0 , typename T1 >
numeric_type operator() (viennamath::ct_vector_2< T0, T1 > const &v) const
 Evaluation of the unary expression at a ViennaMath compiletime vector with two entries.
template<typename T0 , typename T1 , typename T2 >
numeric_type operator() (viennamath::ct_vector_3< T0, T1, T2 > const &v) const
 Evaluation of the unary expression at a ViennaMath compiletime vector with three entries.
numeric_type eval (std::vector< double > const &v) const
 Evaluation of the unary expression at an STL vector. Interface requirement.
numeric_type eval (numeric_type val) const
 Evaluation of the unary expression for a numerical constant. Interface requirement.
InterfaceType * simplify () const
 Returns a simplified expression with trivial operations removed. The caller is responsible for deleting the object the returned pointer refers to.
bool can_simplify () const
 Returns true if the expression can be simplified.
InterfaceType * clone () const
 Returns a copy of the unary expression. The caller is responsible for deleting the returned object.
std::string deep_str () const
 Returns a detailed string describing the unary expression. Acts recursively.
std::string shallow_str () const
 Returns a short string describing the unary expression. Does not act recursively.
numeric_type unwrap () const
 Reduces the expression to a constant. If this is not possible, an expression_not_unwrappable_exception is thrown.
InterfaceType * substitute (const InterfaceType *e, const InterfaceType *repl) const
 If 'e' equals to this unary expression, the replacement 'repl' is returned. Otherwise, the unary expression is cloned. Note that the caller must ensure proper deletion of the returned object.
InterfaceType * substitute (std::vector< const InterfaceType * > const &e, std::vector< const InterfaceType * > const &repl) const
 If one of the expressions in 'e' equals to this unary expression, the respective replacement 'repl' is returned. Otherwise, a copy of *this is returned. Note that the caller must ensure proper deletion of the returned object.
bool deep_equal (const InterfaceType *other) const
 Performs a detailed comparison of the unary expression with the passed expression. Returns true if they represent the same expression (equal IDs, etc.).
bool shallow_equal (const InterfaceType *other) const
 Returns true if the passed expression is of the same type as this expression.
InterfaceType * diff (const InterfaceType *diff_var) const
 Returns the derivative of this unary expression with respect to the variable 'diff_var'. The returned object must be deleted by the caller.
InterfaceType * recursive_manipulation (rt_manipulation_wrapper< InterfaceType > const &fw) const
 Recursively manipulates the expression. If this expression is manipulated, the result is returned directly. Otherwise, the manipulator continues with the expression the unary operation is acting on. The returned object must be deleted by the caller.
void recursive_traversal (rt_traversal_wrapper< InterfaceType > const &fw) const
 Recursively traverses the expression by calling the wrapper for each object without manipulating it.

Detailed Description

template<typename InterfaceType>
class viennamath::rt_unary_expr< InterfaceType >

Runtime representation of a unary expression F(e), where F is a function of one argument (e.g. log()) and e is an expression.

Template Parameters:
InterfaceType The expression runtime interface to inherit from. Usually rt_expression_interface, but extensions are possible.

Member Typedef Documentation

typedef InterfaceType::numeric_type numeric_type

Constructor & Destructor Documentation

rt_unary_expr (  )  [inline]
rt_unary_expr ( InterfaceType *  lhs,
op_interface_type op 
) [inline, explicit]
rt_unary_expr ( InterfaceType *  lhs  )  [inline, explicit]
rt_unary_expr ( ct_unary_expr< LHS, OP > const &  other  )  [inline, explicit]
rt_unary_expr ( rt_variable< InterfaceType > const &  other  )  [inline, explicit]
rt_unary_expr ( rt_constant< T, InterfaceType > const &  other  )  [inline, explicit]
rt_unary_expr ( ct_constant< value > const &  other  )  [inline, explicit]
rt_unary_expr ( rt_unary_expr< InterfaceType > const &  other  )  [inline]

Member Function Documentation

bool can_simplify (  )  const [inline]

Returns true if the expression can be simplified.

InterfaceType* clone (  )  const [inline]

Returns a copy of the unary expression. The caller is responsible for deleting the returned object.

bool deep_equal ( const InterfaceType *  other  )  const [inline]

Performs a detailed comparison of the unary expression with the passed expression. Returns true if they represent the same expression (equal IDs, etc.).

std::string deep_str (  )  const [inline]

Returns a detailed string describing the unary expression. Acts recursively.

InterfaceType* diff ( const InterfaceType *  diff_var  )  const [inline]

Returns the derivative of this unary expression with respect to the variable 'diff_var'. The returned object must be deleted by the caller.

numeric_type eval ( numeric_type  val  )  const [inline]

Evaluation of the unary expression for a numerical constant. Interface requirement.

numeric_type eval ( std::vector< double > const &  v  )  const [inline]

Evaluation of the unary expression at an STL vector. Interface requirement.

const InterfaceType* lhs (  )  const [inline]

Returns the expression the unary function is acting on.

const op_interface_type* op (  )  const [inline]

Returns the operation.

numeric_type operator() ( numeric_type  val  )  const [inline]

Evaluation of the unary expression at val (i.e. all variables with ID 0 replaced by 'val').

numeric_type operator() ( rt_constant< ScalarType >  val  )  const [inline]

Evaluation of the unary expression at the ViennaMath runtime constant val.

numeric_type operator() ( ct_constant< value >  val  )  const [inline]

Evaluation of the unary expression at the ViennaMath compiletime constant val.

numeric_type operator() ( VectorType const &  v  )  const [inline]

Evaluation of the unary expression at the vector v.

numeric_type operator() ( std::vector< numeric_type > const &  stl_v  )  const [inline]

Evaluation of the unary expression at the STL vector v.

numeric_type operator() ( viennamath::ct_vector_1< T0 > const &  v  )  const [inline]

Evaluation of the unary expression at a ViennaMath compiletime vector with one entry.

numeric_type operator() ( viennamath::ct_vector_2< T0, T1 > const &  v  )  const [inline]

Evaluation of the unary expression at a ViennaMath compiletime vector with two entries.

numeric_type operator() ( viennamath::ct_vector_3< T0, T1, T2 > const &  v  )  const [inline]

Evaluation of the unary expression at a ViennaMath compiletime vector with three entries.

rt_unary_expr& operator= ( ct_constant< value > const &  other  )  [inline]
rt_unary_expr& operator= ( rt_unary_expr< InterfaceType > const &  other  )  [inline]
rt_unary_expr& operator= ( numeric_type  value  )  [inline]
rt_unary_expr& operator= ( rt_constant< ScalarType > const &  other  )  [inline]
rt_unary_expr& operator= ( ct_unary_expr< LHS, OP > const &  other  )  [inline]
InterfaceType* recursive_manipulation ( rt_manipulation_wrapper< InterfaceType > const &  fw  )  const [inline]

Recursively manipulates the expression. If this expression is manipulated, the result is returned directly. Otherwise, the manipulator continues with the expression the unary operation is acting on. The returned object must be deleted by the caller.

void recursive_traversal ( rt_traversal_wrapper< InterfaceType > const &  fw  )  const [inline]

Recursively traverses the expression by calling the wrapper for each object without manipulating it.

bool shallow_equal ( const InterfaceType *  other  )  const [inline]

Returns true if the passed expression is of the same type as this expression.

std::string shallow_str (  )  const [inline]

Returns a short string describing the unary expression. Does not act recursively.

InterfaceType* simplify (  )  const [inline]

Returns a simplified expression with trivial operations removed. The caller is responsible for deleting the object the returned pointer refers to.

InterfaceType* substitute ( std::vector< const InterfaceType * > const &  e,
std::vector< const InterfaceType * > const &  repl 
) const [inline]

If one of the expressions in 'e' equals to this unary expression, the respective replacement 'repl' is returned. Otherwise, a copy of *this is returned. Note that the caller must ensure proper deletion of the returned object.

InterfaceType* substitute ( const InterfaceType *  e,
const InterfaceType *  repl 
) const [inline]

If 'e' equals to this unary expression, the replacement 'repl' is returned. Otherwise, the unary expression is cloned. Note that the caller must ensure proper deletion of the returned object.

numeric_type unwrap (  )  const [inline]

Reduces the expression to a constant. If this is not possible, an expression_not_unwrappable_exception is thrown.


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