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>
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 Operation * | clone () 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 |
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.
This enumeration lists all Operation subclasses.
This is provided so that switch statements can be used when processing or analyzing parsed expressions.
|
inlinevirtual |
|
pure virtual |
Create a clone of this Operation.
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.
|
pure virtual |
Return an ExpressionTreeNode which represents the analytic derivative of this Operation with respect to a variable.
children | the child nodes |
childDerivs | the derivatives of the child nodes with respect to the variable |
variable | the 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.
|
pure virtual |
Perform the computation represented by this operation.
args | the array of arguments |
variables | a map containing the values of all variables |
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.
|
pure virtual |
Get this Operation's ID.
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.
|
pure virtual |
Get the name of this Operation.
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.
|
pure virtual |
Get the number of arguments this operation expects.
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.
|
inlinevirtual |
Get whether this operation should be displayed with infix notation.
Reimplemented in PLMD::lepton::Operation::Add, PLMD::lepton::Operation::Divide, PLMD::lepton::Operation::Multiply, PLMD::lepton::Operation::Power, PLMD::lepton::Operation::PowerConstant, and PLMD::lepton::Operation::Subtract.
|
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.
|
inlinevirtual |
|
inlinevirtual |
Hosted by GitHub
![]() |
![]() |