![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
Difference of two AST sub-expressions (left minus right). More...
#include <doAST.h>
Public Member Functions | |
| ASTminus (std::unique_ptr< ASTtree< GUM_SCALAR > > op1, std::unique_ptr< ASTtree< GUM_SCALAR > > op2) | |
| std::string | protectToLatex (HashTable< std::string, int > &nameOccur) const override |
| LaTeX rendering with full name protection. | |
| std::string | fastToLatex (HashTable< std::string, int > &nameOccur) const override |
| Fast LaTeX rendering (lighter protection). | |
| std::unique_ptr< ASTtree< GUM_SCALAR > > | copy () const override |
| Deep clone of the sub-tree. | |
| Tensor< GUM_SCALAR > | eval (const IBayesNet< GUM_SCALAR > &contextual_bn) const override |
| Evaluate the expression against a contextual BN. | |
| const ASTtree< GUM_SCALAR > & | op1 () const |
| const ASTtree< GUM_SCALAR > & | op2 () const |
| std::string | toString (std::string_view prefix="") const override |
| Human-readable multi-line rendering (for debugging / logs). | |
| const std::string & | type () const noexcept |
| std::string | toLatex (HashTable< std::string, int > nameOccur=HashTable< std::string, int >()) const |
| Convenience wrapper using an empty occurrence table. | |
Static Protected Member Functions | |
| static std::string | _latexCorrect (std::string_view srcName, HashTable< std::string, int > &nameOccur) |
| Sanitize a single variable name for LaTeX and ensure uniqueness. | |
| static std::vector< std::string > | _latexCorrect (const Set< std::string > &srcNames, HashTable< std::string, int > &nameOccur) |
| Sanitize a set of variable names for LaTeX and ensure uniqueness. | |
Protected Attributes | |
| std::unique_ptr< ASTtree< GUM_SCALAR > > | _op1 |
| std::unique_ptr< ASTtree< GUM_SCALAR > > | _op2 |
| std::string | _type |
Static Protected Attributes | |
| static constexpr const char * | CONTINUE_PREFIX = "| " |
| Prefix used to draw tree branches in toString. | |
Difference of two AST sub-expressions (left minus right).
LaTeX: renders as ( (\cdot) - (\cdot) ). eval computes element-wise subtraction on aligned tensors.
| gum::ASTminus< GUM_SCALAR >::ASTminus | ( | std::unique_ptr< ASTtree< GUM_SCALAR > > | op1, |
| std::unique_ptr< ASTtree< GUM_SCALAR > > | op2 ) |
Definition at line 164 of file doAST_tpl.h.
References gum::ASTBinaryOp< GUM_SCALAR >::ASTBinaryOp(), gum::ASTBinaryOp< GUM_SCALAR >::op1(), and gum::ASTBinaryOp< GUM_SCALAR >::op2().
|
staticprotectedinherited |
Sanitize a set of variable names for LaTeX and ensure uniqueness.
Definition at line 89 of file doAST_tpl.h.
References _latexCorrect().
|
staticprotectedinherited |
Sanitize a single variable name for LaTeX and ensure uniqueness.
Definition at line 79 of file doAST_tpl.h.
References gum::HashTable< Key, Val >::getWithDefault().
Referenced by _latexCorrect(), gum::ASTjointProba< GUM_SCALAR >::fastToLatex(), gum::ASTposteriorProba< GUM_SCALAR >::fastToLatex(), gum::ASTsum< GUM_SCALAR >::fastToLatex(), gum::ASTjointProba< GUM_SCALAR >::toString(), and gum::ASTposteriorProba< GUM_SCALAR >::toString().
|
overridevirtual |
Deep clone of the sub-tree.
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 180 of file doAST_tpl.h.
References gum::ASTBinaryOp< GUM_SCALAR >::_op1, and gum::ASTBinaryOp< GUM_SCALAR >::_op2.
|
overridevirtual |
Evaluate the expression against a contextual BN.
| contextual_bn | Bayesian network providing CPTs and variable domains |
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 187 of file doAST_tpl.h.
References gum::ASTBinaryOp< GUM_SCALAR >::_op1, and gum::ASTBinaryOp< GUM_SCALAR >::_op2.
|
overridevirtual |
Fast LaTeX rendering (lighter protection).
Assumes prior hygiene of names; typically avoids heavier bookkeeping performed in protectToLatex.
| nameOccur | symbol occurrence table (may be consulted/updated) |
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 175 of file doAST_tpl.h.
References gum::ASTBinaryOp< GUM_SCALAR >::_op1, and gum::ASTBinaryOp< GUM_SCALAR >::_op2.
Referenced by protectToLatex().
|
inherited |
Definition at line 110 of file doAST_tpl.h.
References _op1.
Referenced by ASTBinaryOp(), gum::ASTdiv< GUM_SCALAR >::ASTdiv(), gum::ASTminus< GUM_SCALAR >::ASTminus(), gum::ASTmult< GUM_SCALAR >::ASTmult(), gum::ASTplus< GUM_SCALAR >::ASTplus(), and operator=().
|
inherited |
Definition at line 115 of file doAST_tpl.h.
References _op2.
Referenced by ASTBinaryOp(), gum::ASTdiv< GUM_SCALAR >::ASTdiv(), gum::ASTminus< GUM_SCALAR >::ASTminus(), gum::ASTmult< GUM_SCALAR >::ASTmult(), gum::ASTplus< GUM_SCALAR >::ASTplus(), and operator=().
|
overridevirtual |
LaTeX rendering with full name protection.
Produces LaTeX with variable-name disambiguation, using nameOccur as a registry of encountered names and their occurrence counts.
| nameOccur | symbol occurrence table (updated in place) |
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 170 of file doAST_tpl.h.
References fastToLatex().
|
inherited |
Convenience wrapper using an empty occurrence table.
Definition at line 73 of file doAST_tpl.h.
References fastToLatex().
Referenced by fastToLatex().
|
overridevirtualinherited |
Human-readable multi-line rendering (for debugging / logs).
| prefix | indentation prefix propagated to children |
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 120 of file doAST_tpl.h.
References _op1, _op2, gum::ASTtree< GUM_SCALAR >::_type, and gum::ASTtree< GUM_SCALAR >::CONTINUE_PREFIX.
Referenced by operator=().
|
noexceptinherited |
Definition at line 68 of file doAST_tpl.h.
References _type.
Referenced by gum::ASTBinaryOp< GUM_SCALAR >::ASTBinaryOp(), ASTtree(), and operator=().
|
protectedinherited |
Definition at line 201 of file doAST.h.
Referenced by ASTBinaryOp(), gum::ASTdiv< GUM_SCALAR >::copy(), gum::ASTminus< GUM_SCALAR >::copy(), gum::ASTmult< GUM_SCALAR >::copy(), gum::ASTplus< GUM_SCALAR >::copy(), gum::ASTdiv< GUM_SCALAR >::eval(), gum::ASTminus< GUM_SCALAR >::eval(), gum::ASTmult< GUM_SCALAR >::eval(), gum::ASTplus< GUM_SCALAR >::eval(), gum::ASTdiv< GUM_SCALAR >::fastToLatex(), gum::ASTminus< GUM_SCALAR >::fastToLatex(), gum::ASTmult< GUM_SCALAR >::fastToLatex(), gum::ASTplus< GUM_SCALAR >::fastToLatex(), op1(), gum::ASTmult< GUM_SCALAR >::protectToLatex(), and toString().
|
protectedinherited |
Definition at line 201 of file doAST.h.
Referenced by ASTBinaryOp(), gum::ASTdiv< GUM_SCALAR >::copy(), gum::ASTminus< GUM_SCALAR >::copy(), gum::ASTmult< GUM_SCALAR >::copy(), gum::ASTplus< GUM_SCALAR >::copy(), gum::ASTdiv< GUM_SCALAR >::eval(), gum::ASTminus< GUM_SCALAR >::eval(), gum::ASTmult< GUM_SCALAR >::eval(), gum::ASTplus< GUM_SCALAR >::eval(), gum::ASTdiv< GUM_SCALAR >::fastToLatex(), gum::ASTminus< GUM_SCALAR >::fastToLatex(), gum::ASTmult< GUM_SCALAR >::fastToLatex(), gum::ASTplus< GUM_SCALAR >::fastToLatex(), op2(), gum::ASTmult< GUM_SCALAR >::protectToLatex(), and toString().
|
protectedinherited |
Definition at line 154 of file doAST.h.
Referenced by ASTtree(), gum::ASTBinaryOp< GUM_SCALAR >::toString(), and type().
|
staticconstexprprotectedinherited |
Prefix used to draw tree branches in toString.
Definition at line 153 of file doAST.h.
Referenced by gum::ASTBinaryOp< GUM_SCALAR >::toString(), and gum::ASTsum< GUM_SCALAR >::toString().