Loading [MathJax]/extensions/tex2jax.js
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PLMD::lepton::Operation Class Referenceabstract

An Operation represents a single step in the evaluation of an expression, such as a function, an operator, or a constant value. More...

#include <Operation.h>

Inheritance diagram for PLMD::lepton::Operation:

Classes

class  Abs
 
class  Acos
 
class  Add
 
class  AddConstant
 
class  Asin
 
class  Atan
 
class  Atan2
 
class  Ceil
 
class  Constant
 
class  Cos
 
class  Cosh
 
class  Cot
 
class  Csc
 
class  Cube
 
class  Custom
 
class  Delta
 
class  Divide
 
class  Erf
 
class  Erfc
 
class  Exp
 
class  Floor
 
class  Log
 
class  Max
 
class  Min
 
class  Multiply
 
class  MultiplyConstant
 
class  Nandelta
 
class  Negate
 
class  Power
 
class  PowerConstant
 
class  Reciprocal
 
class  Sec
 
class  Select
 
class  Sin
 
class  Sinh
 
class  Sqrt
 
class  Square
 
class  Step
 
class  Subtract
 
class  Tan
 
class  Tanh
 
class  Variable
 

Public Types

enum  Id {
  CONSTANT , VARIABLE , CUSTOM , ADD ,
  SUBTRACT , MULTIPLY , DIVIDE , POWER ,
  NEGATE , SQRT , EXP , LOG ,
  SIN , COS , SEC , CSC ,
  TAN , COT , ASIN , ACOS ,
  ATAN , ATAN2 , SINH , COSH ,
  TANH , ERF , ERFC , STEP ,
  DELTA , NANDELTA , SQUARE , CUBE ,
  RECIPROCAL , ADD_CONSTANT , MULTIPLY_CONSTANT , POWER_CONSTANT ,
  MIN , MAX , ABS , FLOOR ,
  CEIL , SELECT , ACOT , ASEC ,
  ACSC , COTH , SECH , CSCH ,
  ASINH , ACOSH , ATANH , ACOTH ,
  ASECH , ACSCH
}
 This enumeration lists all Operation subclasses. More...
 

Public Member Functions

virtual ~Operation ()
 
virtual Operationclone () const =0
 Create a clone of this Operation.
 
virtual ExpressionTreeNode differentiate (const std::vector< ExpressionTreeNode > &children, const std::vector< ExpressionTreeNode > &childDerivs, const std::string &variable) const =0
 Return an ExpressionTreeNode which represents the analytic derivative of this Operation with respect to a variable.
 
virtual double evaluate (double *args, const std::map< std::string, double > &variables) const =0
 Perform the computation represented by this operation.
 
virtual Id getId () const =0
 Get this Operation's ID.
 
virtual std::string getName () const =0
 Get the name of this Operation.
 
virtual int getNumArguments () const =0
 Get the number of arguments this operation expects.
 
virtual bool isInfixOperator () const
 Get whether this operation should be displayed with infix notation.
 
virtual bool isSymmetric () const
 Get whether this is a symmetric binary operation, such that exchanging its arguments does not affect the result.
 
virtual bool operator!= (const Operation &op) const
 
virtual bool operator== (const Operation &op) const
 

Detailed Description

An Operation represents a single step in the evaluation of an expression, such as a function, an operator, or a constant value.

Each Operation takes some number of values as arguments and produces a single value.

This is an abstract class with subclasses for specific operations.

Member Enumeration Documentation

◆ Id

This enumeration lists all Operation subclasses.

This is provided so that switch statements can be used when processing or analyzing parsed expressions.

Enumerator
CONSTANT 
VARIABLE 
CUSTOM 
ADD 
SUBTRACT 
MULTIPLY 
DIVIDE 
POWER 
NEGATE 
SQRT 
EXP 
LOG 
SIN 
COS 
SEC 
CSC 
TAN 
COT 
ASIN 
ACOS 
ATAN 
ATAN2 
SINH 
COSH 
TANH 
ERF 
ERFC 
STEP 
DELTA 
NANDELTA 
SQUARE 
CUBE 
RECIPROCAL 
ADD_CONSTANT 
MULTIPLY_CONSTANT 
POWER_CONSTANT 
MIN 
MAX 
ABS 
FLOOR 
CEIL 
SELECT 
ACOT 
ASEC 
ACSC 
COTH 
SECH 
CSCH 
ASINH 
ACOSH 
ATANH 
ACOTH 
ASECH 
ACSCH 

Constructor & Destructor Documentation

◆ ~Operation()

virtual PLMD::lepton::Operation::~Operation ( )
inlinevirtual

Member Function Documentation

◆ clone()

◆ differentiate()

virtual ExpressionTreeNode PLMD::lepton::Operation::differentiate ( const std::vector< ExpressionTreeNode > & children,
const std::vector< ExpressionTreeNode > & childDerivs,
const std::string & variable ) const
pure virtual

Return an ExpressionTreeNode which represents the analytic derivative of this Operation with respect to a variable.

Parameters
childrenthe child nodes
childDerivsthe derivatives of the child nodes with respect to the variable
variablethe variable with respect to which the derivate should be taken

Implemented in PLMD::lepton::Operation::Abs, PLMD::lepton::Operation::Acos, PLMD::lepton::Operation::Add, PLMD::lepton::Operation::AddConstant, PLMD::lepton::Operation::Asin, PLMD::lepton::Operation::Atan2, PLMD::lepton::Operation::Atan, PLMD::lepton::Operation::Ceil, PLMD::lepton::Operation::Constant, PLMD::lepton::Operation::Cos, PLMD::lepton::Operation::Cosh, PLMD::lepton::Operation::Cot, PLMD::lepton::Operation::Csc, PLMD::lepton::Operation::Cube, PLMD::lepton::Operation::Custom, PLMD::lepton::Operation::Delta, PLMD::lepton::Operation::Divide, PLMD::lepton::Operation::Erf, PLMD::lepton::Operation::Erfc, PLMD::lepton::Operation::Exp, PLMD::lepton::Operation::Floor, PLMD::lepton::Operation::Log, PLMD::lepton::Operation::Max, PLMD::lepton::Operation::Min, PLMD::lepton::Operation::Multiply, PLMD::lepton::Operation::MultiplyConstant, PLMD::lepton::Operation::Nandelta, PLMD::lepton::Operation::Negate, PLMD::lepton::Operation::Power, PLMD::lepton::Operation::PowerConstant, PLMD::lepton::Operation::Reciprocal, PLMD::lepton::Operation::Sec, PLMD::lepton::Operation::Select, PLMD::lepton::Operation::Sin, PLMD::lepton::Operation::Sinh, PLMD::lepton::Operation::Sqrt, PLMD::lepton::Operation::Square, PLMD::lepton::Operation::Step, PLMD::lepton::Operation::Subtract, PLMD::lepton::Operation::Tan, PLMD::lepton::Operation::Tanh, and PLMD::lepton::Operation::Variable.

◆ evaluate()

virtual double PLMD::lepton::Operation::evaluate ( double * args,
const std::map< std::string, double > & variables ) const
pure virtual

Perform the computation represented by this operation.

Parameters
argsthe array of arguments
variablesa map containing the values of all variables
Returns
the result of performing the computation.

Implemented in PLMD::lepton::Operation::Abs, PLMD::lepton::Operation::Acos, PLMD::lepton::Operation::Add, PLMD::lepton::Operation::AddConstant, PLMD::lepton::Operation::Asin, PLMD::lepton::Operation::Atan2, PLMD::lepton::Operation::Atan, PLMD::lepton::Operation::Ceil, PLMD::lepton::Operation::Constant, PLMD::lepton::Operation::Cos, PLMD::lepton::Operation::Cosh, PLMD::lepton::Operation::Cot, PLMD::lepton::Operation::Csc, PLMD::lepton::Operation::Cube, PLMD::lepton::Operation::Custom, PLMD::lepton::Operation::Delta, PLMD::lepton::Operation::Divide, PLMD::lepton::Operation::Erf, PLMD::lepton::Operation::Erfc, PLMD::lepton::Operation::Exp, PLMD::lepton::Operation::Floor, PLMD::lepton::Operation::Log, PLMD::lepton::Operation::Max, PLMD::lepton::Operation::Min, PLMD::lepton::Operation::Multiply, PLMD::lepton::Operation::MultiplyConstant, PLMD::lepton::Operation::Nandelta, PLMD::lepton::Operation::Negate, PLMD::lepton::Operation::Power, PLMD::lepton::Operation::PowerConstant, PLMD::lepton::Operation::Reciprocal, PLMD::lepton::Operation::Sec, PLMD::lepton::Operation::Select, PLMD::lepton::Operation::Sin, PLMD::lepton::Operation::Sinh, PLMD::lepton::Operation::Sqrt, PLMD::lepton::Operation::Square, PLMD::lepton::Operation::Step, PLMD::lepton::Operation::Subtract, PLMD::lepton::Operation::Tan, PLMD::lepton::Operation::Tanh, and PLMD::lepton::Operation::Variable.

◆ getId()

◆ getName()

◆ getNumArguments()

virtual int PLMD::lepton::Operation::getNumArguments ( ) const
pure virtual

◆ isInfixOperator()

virtual bool PLMD::lepton::Operation::isInfixOperator ( ) const
inlinevirtual

◆ isSymmetric()

virtual bool PLMD::lepton::Operation::isSymmetric ( ) const
inlinevirtual

Get whether this is a symmetric binary operation, such that exchanging its arguments does not affect the result.

Reimplemented in PLMD::lepton::Operation::Add, and PLMD::lepton::Operation::Multiply.

◆ operator!=()

◆ operator==()

virtual bool PLMD::lepton::Operation::operator== ( const Operation & op) const
inlinevirtual

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