|
Gymbo
|
Struct representing a symbolic expression. More...
#include <type.h>

Public Member Functions | |
| Sym () | |
| Default constructor for Sym. More... | |
| Sym (SymType symtype, Sym *left) | |
| Constructor for Sym with a specified type and left child. More... | |
| Sym (SymType symtype, Sym *left, std::unordered_map< int, float > &assign) | |
| Sym (SymType symtype, Sym *left, Sym *right) | |
| Constructor for Sym with a specified type, left child, and right child. More... | |
| Sym (SymType symtype, Word32 val) | |
| Constructor for Sym with a specified type and Word32 value. More... | |
| Sym (SymType symtype, Sym *left, Sym *right, Word32 word, int var_idx) | |
| Sym * | copy () |
| void | gather_var_ids (std::unordered_set< int > &result) const |
| Gathers variable indices from the symbolic expression. More... | |
| Sym * | psimplify (const Mem &cvals) |
| Simplifies the symbolic expression by evaluating constant subexpressions. More... | |
| float | eval (const std::unordered_map< int, float > &cvals, const float eps) const |
| Evaluates the symbolic expression given concrete variable values. More... | |
| Grad | grad (const std::unordered_map< int, float > &cvals, const float eps) const |
| Computes the gradient of the symbolic expression given concrete variable values. More... | |
| std::string | toString (bool convert_to_num) const |
| Converts the symbolic expression to a string representation. More... | |
Public Attributes | |
| SymType | symtype |
| Sym * | left |
| Sym * | right |
| Word32 | word |
| int | var_idx |
| std::unordered_map< int, float > | assign |
Struct representing a symbolic expression.
|
inline |
Default constructor for Sym.
Map from var IDs to their assigned values
Constructor for Sym with a specified type and left child.
| symtype | The type of the symbolic expression. |
| left | Pointer to the left child. |
Constructor for Sym with a specified type, left child, and right child.
| symtype | The type of the symbolic expression. |
| left | Pointer to the left child. |
| right | Pointer to the right child. |
Constructor for Sym with a specified type and Word32 value.
| symtype | The type of the symbolic expression. |
| val | Word32 value associated with the expression. |
|
inline |
|
inline |
Evaluates the symbolic expression given concrete variable values.
| cvals | Map of variable indices to concrete values. |
| eps | The smallest positive value of the target type. |
|
inline |
Gathers variable indices from the symbolic expression.
| result | Set to store gathered variable indices. |
|
inline |
Computes the gradient of the symbolic expression given concrete variable values.
| cvals | Map of variable indices to concrete values. |
| eps | Small value to handle numerical instability. |
Simplifies the symbolic expression by evaluating constant subexpressions.
| cvals | Map of variable indices to constant values. |
|
inline |
Converts the symbolic expression to a string representation.
| convert_to_num | Whether to convert constants to numeric representations. |
| std::unordered_map<int, float> gymbo::Sym::assign |
| Sym* gymbo::Sym::left |
Pointer to the left child of the expression.
| Sym* gymbo::Sym::right |
Pointer to the right child of the expression.
| SymType gymbo::Sym::symtype |
The type of the symbolic expression.
| int gymbo::Sym::var_idx |
Index of the variable associated with the expression.
| Word32 gymbo::Sym::word |
Additional data associated with the expression.