Helios++
Helios software for LiDAR simulations
|
Class implementing a Univariate Expression Tree Node. More...
#include <UnivarExprTreeNode.h>
Public Types | |
enum | SymbolType { OPERATOR , NUMBER , VARIABLE , FUNCTION } |
The different types of element (symbols) supported by the univariate expression tree node. | |
enum | OpType { OP_ADD , OP_SUB , OP_MUL , OP_DIV , OP_POW , OP_IPOW , OP_atan2 } |
The different operators supported by the univariate expression tree node. | |
enum | FunType { f_exp , f_ln , f_sqrt , f_abs , f_cos , f_sin , f_tan , f_acos , f_asin , f_atan , f_cosh , f_sinh , f_tanh } |
The different functions supported by the univariate expression tree node. | |
Public Member Functions | |
UnivarExprTreeNode (UnivarExprTreeNode *left=nullptr, UnivarExprTreeNode *right=nullptr) | |
Default constructor for Univariate Expression Tree Node. More... | |
NumericType | doOperation (NumericType const x, NumericType const y) const |
Do the operation if the node is an operator node. Otherwise, something really wrong might happen. Something that you don't want to experiment. More... | |
NumericType | doFunction (NumericType const x) const |
Compute the function's output for the given input \(x\). More... | |
NumericType | eval (NumericType const t) const override |
IBinaryTreeNode * | getLeftChild () const override |
Obtain the left child of current node. More... | |
IBinaryTreeNode * | getRightChild () const override |
Obtain the right child of current node. More... | |
bool | isLeafNode () const override |
Simplified check because for UnivarExprTreeNode there is no right child without a left child. More... | |
bool | isOperator () const |
Check whether the node is an operator (true) or not (false) More... | |
bool | isFunction () const |
Check whether the node is a function (true) or not (false) More... | |
bool | isNumber () const |
Check whether the node is a number (true) or not (false) More... | |
bool | isVariable () const |
Check whether the node is a variable (true) or not (false) More... | |
void | setOperator (std::string const &opStr) |
Set the operator UnivarExprTreeNode::op from given string. More... | |
Public Attributes | |
SymbolType | symbolType |
The type of element (symbol) used by the univariate expression tree node. More... | |
union { | |
NumericType num | |
Number as node's element. | |
OpType op | |
Operator as node's element. | |
FunType fun | |
Function as node's element. | |
}; | |
The element of the node. | |
UnivarExprTreeNode * | left |
The left child node. | |
UnivarExprTreeNode * | right |
The right child node. | |
Class implementing a Univariate Expression Tree Node.
The Univariate Expression Tree Node supports univariate expressions where \(t\) is the variable. Univariate expression trees can work with real numbers (complex are outside its scope). Supported operators are \(+, -, *, /, \textrm{^}\). Supported constants are \(e, \pi\). Supported functions are \(\exp, \ln, \mathrm{sqrt}, \mathrm{abs}, \) \(\cos, \sin, \tan, \mathrm{acos}, \mathrm{asin}, \mathrm{atan}, \) \(\mathrm{atan2}, \cosh, \sinh, \tanh\). However since \(atan2\) is a bivariate function, it is internally considered as an operator due to an implementation trick.
NumericType | The numeric type to be used by the univariate expression tree. It must be contained or equal to the reals ( \(\subseteq \mathbb{R}\)). |
|
inline |
Default constructor for Univariate Expression Tree Node.
left | The left child node |
right | The right child node |
|
inline |
Compute the function's output for the given input \(x\).
x | The function's input \(x\) |
|
inline |
Do the operation if the node is an operator node. Otherwise, something really wrong might happen. Something that you don't want to experiment.
x | The left hand side (lhs) \(x\) |
y | The right hand side (rhs) \(x\) |
|
inlineoverridevirtual |
Implements IExprTreeNode< NumericType, NumericType >.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inline |
Check whether the node is a function (true) or not (false)
|
inlineoverridevirtual |
Simplified check because for UnivarExprTreeNode there is no right child without a left child.
Reimplemented from IBinaryTreeNode.
|
inline |
Check whether the node is a number (true) or not (false)
|
inline |
Check whether the node is an operator (true) or not (false)
|
inline |
Check whether the node is a variable (true) or not (false)
|
inline |
Set the operator UnivarExprTreeNode::op from given string.
opStr | String representing an operator for the node |
SymbolType UnivarExprTreeNode< NumericType >::symbolType |
The type of element (symbol) used by the univariate expression tree node.