fmatvec  2.0.0
Fast Matrix/Vector Library
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
fmatvec::AST::Operation Class Reference

A vertex of the AST representing an operation. More...

#include <ast.h>

Inheritance diagram for fmatvec::AST::Operation:
[legend]

Classes

struct  CacheKeyComp
 

Public Types

enum  Operator {
  Plus, Minus, Mult, Div,
  Pow, Log, Sqrt, Neg,
  Sin, Cos, Tan, Sinh,
  Cosh, Tanh, ASin, ACos,
  ATan, ASinh, ACosh, ATanh,
  Exp, Sign, Abs
}
 Defined operations.
 

Public Member Functions

double eval () const override
 
SymbolicExpression parDer (const IndependentVariable &x) const override
 Generate a new AST being the partial derivate of this AST with respect to the variable x.
 
Operator getOp () const
 
const std::vector< SymbolicExpression > & getChilds () const
 
- Public Member Functions inherited from fmatvec::AST::Vertex
virtual bool isConstantInt () const
 Rreturn true if this Vertex is a constant integer.
 
bool isZero () const
 
bool isOne () const
 
const std::map< std::weak_ptr< const Symbol >, unsigned long, std::owner_less< std::weak_ptr< const Symbol > > > & getDependsOn () const
 Return a list of all variables this AST depends on.
 

Static Public Member Functions

static SymbolicExpression create (Operator op_, const std::vector< SymbolicExpression > &child_)
 

Private Types

typedef std::pair< Operator, std::vector< std::weak_ptr< const Vertex > > > CacheKey
 

Private Member Functions

 Operation (Operator op_, const std::vector< SymbolicExpression > &child_)
 
bool equal (const SymbolicExpression &b, std::map< IndependentVariable, SymbolicExpression > &m) const override
 

Private Attributes

friend SymbolicExpression
 
Operator op
 
std::vector< SymbolicExpression > child
 
double cacheValue
 

Static Private Attributes

static std::map< CacheKey, std::weak_ptr< const Operation >, CacheKeyComp > cache
 
static const std::map< Operator, std::string > opMap
 

Friends

SymbolicExpression fmatvec::subst (const SymbolicExpression &se, const IndependentVariable &a, const SymbolicExpression &b)
 
boost::spirit::qi::rule< boost::spirit::istream_iterator, SymbolicExpression()> & fmatvec::getBoostSpiritQiRule ()
 
boost::spirit::karma::rule< std::ostream_iterator< char >, SymbolicExpression()> & fmatvec::getBoostSpiritKarmaRule ()
 

Additional Inherited Members

- Protected Attributes inherited from fmatvec::AST::Vertex
std::map< std::weak_ptr< const Symbol >, unsigned long, std::owner_less< std::weak_ptr< const Symbol > > > dependsOn
 

Detailed Description

A vertex of the AST representing an operation.

Member Function Documentation

◆ eval()

double fmatvec::AST::Operation::eval ( ) const
inlineoverridevirtual

Evaluate the AST. The returned value depends on the AST and on the current values of all independent variables this AST depends on. Also see Symbol ant Vertex::getDependsOn().

Implements fmatvec::AST::Vertex.

Member Data Documentation

◆ opMap

const std::map< Operation::Operator, string > fmatvec::AST::Operation::opMap
staticprivate
Initial value:
{
{ Plus, "plus"},
{ Minus, "minus"},
{ Mult, "mult"},
{ Div, "div"},
{ Pow, "pow"},
{ Log, "log"},
{ Sqrt, "sqrt"},
{ Neg, "neg"},
{ Sin, "sin"},
{ Cos, "cos"},
{ Tan, "tan"},
{ Sinh, "sinh"},
{ Cosh, "cosh"},
{ Tanh, "tanh"},
{ ASin, "asin"},
{ ACos, "acos"},
{ ATan, "atan"},
{ ASinh, "asinh"},
{ ACosh, "acosh"},
{ ATanh, "atanh"},
{ Exp, "exp"},
{ Sign, "sign"},
{ Abs, "abs"}
}

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