|
Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
|
Namespaces | |
| namespace | special_number |
Classes | |
| class | DecodingCursor |
| A read position over one canonical-encoding text, with the small lexical helpers the grammar needs (literals, words, netstrings, numbers). More... | |
| struct | DecodingContext |
| The back-reference table of one decoding pass: the nodes in first-encounter order, so #<index> resolves to the node the encoder numbered index. More... | |
| struct | EncodingContext |
| Traversal state for one canonical-encoding pass: the back-reference table. More... | |
| class | Node |
| An interface for all nodes in a function tree, and for a function object as well. More... | |
| class | SumOperator |
| Represents summation and difference Operator. More... | |
| class | NegateOperator |
| The negation Operator. More... | |
| class | MultOperator |
| Multiplication and division Operator. More... | |
| class | PowerOperator |
| Operator for power functions with arbitrary expressions in the exponent and base. More... | |
| class | IntegerPowerOperator |
| This class represents the exponentiation Operator. More... | |
| class | SqrtOperator |
| Represents the square root Operator. More... | |
| class | ExpOperator |
| represents the exponential function More... | |
| class | LogOperator |
| represents the natural logarithm function More... | |
| class | Operator |
| Abstract Node type from which all Operators inherit. More... | |
| class | UnaryOperator |
| Interface for all unary Operator types. More... | |
| class | NaryOperator |
| Abstract interface for n-ary Operator types. More... | |
| class | TrigOperator |
| Abstract class for trigonometric Operator types. More... | |
| class | SinOperator |
| Provides the sine Operator. More... | |
| class | ArcSinOperator |
| Provides the inverse sine Operator. More... | |
| class | CosOperator |
| Provides the cosine Operator. More... | |
| class | ArcCosOperator |
| Provides the arc cosine Operator. More... | |
| class | TanOperator |
| Provides the tangent Operator. More... | |
| class | ArcTanOperator |
| Provides the inverse tangent Operator. More... | |
| class | NamedExpression |
| A user-named expression — the surviving, immutable entry point into a subtree. More... | |
| class | Differential |
| Provides the differential type for differentiation of expression trees. More... | |
| class | Number |
| Abstract Number type from which other Numbers derive. More... | |
| class | Integer |
| Signed real Integer storage in an expression tree. More... | |
| class | Complex |
| A complex-number literal node in an expression tree. More... | |
| class | Rational |
| The Rational number type for Bertini2 expression trees. More... | |
| class | Symbol |
| Abstract symbol class. More... | |
| class | NameHolder |
| Capability class for things which have a name. More... | |
| class | NamedSymbol |
| Symbols which have names are named symbols. More... | |
| class | Variable |
| Represents variable leaves in the function tree. More... | |
Typedefs | |
| using | ReinternMemo = std::map<Node const*, std::shared_ptr<Node>> |
| Memo for one re-interning pass: loaded node -> its interned replacement. | |
Enumerations | |
| enum class | MonomialOrder { Lex , RevLex , GrevLex } |
| Pluggable monomial orders for canonicalization. More... | |
| enum | PrintPrecedence : unsigned { PrecSum = 10 , PrecNegate = 15 , PrecMult = 20 , PrecPower = 30 , PrecAtom = 100 } |
| Operator precedence classes, used to decide parenthesization when printing. More... | |
| enum class | PrintDialect { Classic = 0 , PythonReadable = 1 , PythonExact = 2 } |
| Who a printed expression is for; selects the operator and constant spellings. More... | |
Functions | |
| MonomialOrder | CurrentMonomialOrder () |
| The monomial order currently used for canonicalization (session-global – it must be consistent session-wide, since it determines interned identity). | |
| void | SetMonomialOrder (MonomialOrder order) |
| Set the session-wide monomial order (determines interned identity). | |
| bool | CanonicalizeByDefault () |
| Whether Sum/Mult construction canonicalizes operand order by default. | |
| void | SetCanonicalizeByDefault (bool on) |
| Set whether Sum/Mult construction canonicalizes operand order by default. | |
| bool | PowerFoldByDefault () |
| Whether Mult construction flattens + power-folds (x*x -> x^2) by default. | |
| void | SetPowerFoldByDefault (bool on) |
| Set whether Mult construction flattens + power-folds by default. | |
| void | CanonicalizeNaryOperands (std::vector< std::shared_ptr< Node > > &operands, std::vector< bool > &flags, bool multiplicands_first) |
| Sort an n-ary operator's (operand, flag) pairs into canonical order, in place. | |
| std::shared_ptr< Node > | DecodeCanonical (DecodingCursor &cursor, DecodingContext &ctx) |
| Decode one node (and everything under it) from the cursor's position. | |
| std::shared_ptr< Node > | DecodeCanonicalTree (std::string const &text) |
| Decode a whole tree from its canonical encoding text (fresh context). | |
| void | EncodeCanonical (std::shared_ptr< Node > const &root, std::ostream &out, EncodingContext &ctx) |
| Append the canonical encoding of the DAG rooted at root to out. | |
| std::string | CanonicalEncoding (std::shared_ptr< Node > const &root) |
| The canonical encoding of a single tree as a string (fresh context). | |
| template<typename T> | |
| std::vector< std::shared_ptr< T > > | Find (std::shared_ptr< const Node > const &n) |
| All distinct nodes of kind T in the subtree rooted at n, sorted by name. | |
| template<typename T> | |
| std::vector< std::shared_ptr< T > > | Find (std::vector< std::shared_ptr< const Node > > const &roots) |
| The union of Find<T> across several roots (one shared traversal), sorted by name. | |
| template<typename Archive> | |
| void | register_derived_node_types (Archive &ar) |
| Register all concrete Node types with a Boost.Serialization archive. | |
| VariableGroup | GatherVariables (std::shared_ptr< const Node > const &n) |
| Collect the distinct Variables appearing in a function-tree subtree. | |
| VariableGroup | GatherVariables (std::vector< std::shared_ptr< Node > > const &functions) |
| Collect the distinct Variables appearing across a collection of expressions. | |
| std::ostream & | operator<< (std::ostream &out, const Node &N) |
| a single layer of indirection, though which to call the overridden virtual print() method which must be defined for each non-abstract Node type. | |
| std::ostream & | operator<< (std::ostream &out, const std::shared_ptr< Node > &N) |
| Stream insertion for a Node pointer: dispatches to the node's virtual print(). | |
| std::string | PrintIn (Node const &N, PrintDialect dialect) |
| Print a tree in one dialect (see print_dialect.hpp). | |
| std::string | PrintClassic (Node const &N) |
| The Bertini 1 spelling of a tree: ^ for powers, (re+im*I) for complex constants, every constant with all its digits. | |
| std::string | PrintPython (Node const &N, bool exact) |
| The Python spelling of a tree: ** for powers. | |
| std::shared_ptr< Node > | Intern (std::shared_ptr< Node > const &candidate) |
| Hash-cons a freshly-built node: return an existing structurally-equal node if one is live, otherwise register and return this one. | |
| std::shared_ptr< Node > | operator- (const std::shared_ptr< Node > &rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | sqrt (const std::shared_ptr< Node > &N) |
| Build a square-root expression-tree node. | |
| std::shared_ptr< Node > | exp (const std::shared_ptr< Node > &N) |
| Build an exponential (e raised to the node) expression-tree node. | |
| std::shared_ptr< Node > | log (const std::shared_ptr< Node > &N) |
| Build a natural-logarithm expression-tree node. | |
| std::shared_ptr< Node > | pow (const std::shared_ptr< Node > &N, const std::shared_ptr< Node > &p) |
| Build a power expression-tree node. | |
| std::shared_ptr< Node > | pow (std::shared_ptr< Node > const &base, int power) |
| Build a power expression-tree node. | |
| std::shared_ptr< Node > | pow (const std::shared_ptr< Node > &N, double p)=delete |
| Build a power expression-tree node. | |
| std::shared_ptr< Node > | pow (const std::shared_ptr< Node > &N, complex_dbl p)=delete |
| Build a power expression-tree node. | |
| std::shared_ptr< Node > | pow (const std::shared_ptr< Node > &N, real_mp p) |
| Build a power expression-tree node. | |
| std::shared_ptr< Node > | pow (const std::shared_ptr< Node > &N, complex_mp p) |
| Build a power expression-tree node. | |
| std::shared_ptr< Node > | pow (const std::shared_ptr< Node > &N, mpq_rational const &p) |
| Build a power expression-tree node. | |
| std::shared_ptr< Node > | SimplifiedNegate (std::shared_ptr< Node > const &n) |
| Negation that never builds junk: -0 stays 0. | |
| std::shared_ptr< Node > | SimplifiedSum (std::vector< std::pair< std::shared_ptr< Node >, bool > > const &terms) |
| Build a sum from (term, add_or_sub) pairs, omitting literal zeros. | |
| std::shared_ptr< Node > | SimplifiedMult (std::vector< std::pair< std::shared_ptr< Node >, bool > > const &factors) |
| Build a product from (factor, mult_or_div) pairs, simplified. | |
| std::shared_ptr< Node > & | operator+= (std::shared_ptr< Node > &lhs, const std::shared_ptr< Node > &rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (std::shared_ptr< Node > lhs, const std::shared_ptr< Node > &rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (std::shared_ptr< Node > lhs, real_mp const &rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (std::shared_ptr< Node > lhs, complex_mp const &rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (real_mp const &lhs, std::shared_ptr< Node > rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (complex_mp const &lhs, std::shared_ptr< Node > rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (std::shared_ptr< Node > lhs, int rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (int lhs, std::shared_ptr< Node > rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (std::shared_ptr< Node > lhs, mpz_int const &rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (mpz_int const &lhs, std::shared_ptr< Node > rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (std::shared_ptr< Node > lhs, mpq_rational const &rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator+ (mpq_rational const &lhs, std::shared_ptr< Node > rhs) |
| Build a sum expression-tree node from its operands. | |
| std::shared_ptr< Node > & | operator-= (std::shared_ptr< Node > &lhs, const std::shared_ptr< Node > &rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (std::shared_ptr< Node > lhs, const std::shared_ptr< Node > &rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (std::shared_ptr< Node > lhs, real_mp const &rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (real_mp const &lhs, std::shared_ptr< Node > rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (std::shared_ptr< Node > lhs, complex_mp const &rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (complex_mp const &lhs, std::shared_ptr< Node > rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (std::shared_ptr< Node > lhs, int rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (int lhs, std::shared_ptr< Node > rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (std::shared_ptr< Node > lhs, mpz_int const &rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (mpz_int const &lhs, std::shared_ptr< Node > rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (std::shared_ptr< Node > lhs, mpq_rational const &rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator- (mpq_rational const &lhs, std::shared_ptr< Node > rhs) |
| Build a difference expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator*= (std::shared_ptr< MultOperator > &lhs, const std::shared_ptr< Node > &rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (std::shared_ptr< Node > lhs, real_mp const &rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (std::shared_ptr< Node > lhs, complex_mp const &rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (real_mp const &lhs, std::shared_ptr< Node > rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (complex_mp const &lhs, std::shared_ptr< Node > rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (std::shared_ptr< Node > lhs, int rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (int lhs, std::shared_ptr< Node > rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (std::shared_ptr< Node > lhs, mpz_int const &rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (mpz_int const &lhs, std::shared_ptr< Node > rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (std::shared_ptr< Node > lhs, mpq_rational const &rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (mpq_rational const &lhs, std::shared_ptr< Node > rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > & | operator*= (std::shared_ptr< Node > &lhs, const std::shared_ptr< Node > &rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator* (std::shared_ptr< Node > lhs, const std::shared_ptr< Node > &rhs) |
| Build a product expression-tree node from its operands. | |
| std::shared_ptr< Node > & | operator/= (std::shared_ptr< Node > &lhs, const std::shared_ptr< Node > &rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/= (std::shared_ptr< MultOperator > &lhs, const std::shared_ptr< Node > &rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (std::shared_ptr< Node > lhs, const std::shared_ptr< Node > &rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (std::shared_ptr< Node > lhs, real_mp rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (std::shared_ptr< Node > lhs, complex_mp rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (real_mp lhs, std::shared_ptr< Node > rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (complex_mp lhs, std::shared_ptr< Node > rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (std::shared_ptr< Node > lhs, int rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (int lhs, std::shared_ptr< Node > rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (std::shared_ptr< Node > lhs, mpz_int const &rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (mpz_int const &lhs, std::shared_ptr< Node > rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (std::shared_ptr< Node > lhs, mpq_rational const &rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | operator/ (mpq_rational const &lhs, std::shared_ptr< Node > rhs) |
| Build a quotient expression-tree node from its operands. | |
| std::shared_ptr< Node > | sin (const std::shared_ptr< Node > &N) |
| Build a sine expression-tree node. | |
| std::shared_ptr< Node > | asin (const std::shared_ptr< Node > &N) |
| Build a arcsine expression-tree node. | |
| std::shared_ptr< Node > | cos (const std::shared_ptr< Node > &N) |
| Build a cosine expression-tree node. | |
| std::shared_ptr< Node > | acos (const std::shared_ptr< Node > &N) |
| Build a arccosine expression-tree node. | |
| std::shared_ptr< Node > | tan (const std::shared_ptr< Node > &N) |
| Build a tangent expression-tree node. | |
| std::shared_ptr< Node > | atan (const std::shared_ptr< Node > &N) |
| Build a arctangent expression-tree node. | |
| int | PrintDialectSlot () |
| The stream-state slot the dialect is kept in (allocated once per process). | |
| PrintDialect | DialectOf (std::ios_base &stream) |
| The dialect a stream prints in; Classic unless SetDialect was called on it. | |
| void | SetDialect (std::ios_base &stream, PrintDialect dialect) |
| Choose the dialect everything subsequently printed to stream is written in. | |
| char const * | PowerSymbol (PrintDialect dialect) |
| The power operator in a dialect: ^ for Bertini 1, ** for Python. | |
| std::shared_ptr< Node > | Reintern (std::shared_ptr< Node > const &root, ReinternMemo &memo) |
| Rebuild the DAG rooted at root through the interning factories (memoized, post-order), returning the canonical interned equivalent. | |
| std::shared_ptr< Node > | Reintern (std::shared_ptr< Node > const &root) |
| Convenience overload with a private memo (single-root use). | |
| std::shared_ptr< NamedExpression > | Named (std::shared_ptr< Node > const &expr, std::string const &name) |
| Give an expression a name: Named(x*x + y*y, "a"). | |
| std::shared_ptr< Node > | Pi () |
Construct a shared pointer to . | |
| std::shared_ptr< Node > | E () |
Construct a shared pointer to . | |
| std::shared_ptr< Node > | I () |
Construct a shared pointer to . | |
| std::shared_ptr< Node > | Two () |
Construct a shared pointer to . | |
| std::shared_ptr< Node > | One () |
Construct a shared pointer to . | |
| std::shared_ptr< Node > | Zero () |
Construct a shared pointer to . | |
| using bertini::node::ReinternMemo = std::map<Node const*, std::shared_ptr<Node>> |
Memo for one re-interning pass: loaded node -> its interned replacement.
Share one memo across all roots of a loaded object (e.g. a whole System), so cross-root sharing in the archive is preserved in the rebuilt DAG.
|
strong |
|
strong |
Who a printed expression is for; selects the operator and constant spellings.
| enum bertini::node::PrintPrecedence : unsigned |
Operator precedence classes, used to decide parenthesization when printing.
Higher binds tighter. A child is wrapped in parentheses only when its precedence is too low for the position it is printed in; leaves and self-delimiting nodes (function calls like sin(...), complex pairs) are atoms and never wrapped. Negative literal constants report PrecNegate so they parenthesize exactly where a Negate node would.
| Enumerator | |
|---|---|
| PrecSum | |
| PrecNegate | |
| PrecMult | |
| PrecPower | |
| PrecAtom | |
Build a arccosine expression-tree node.
Build a arcsine expression-tree node.
Build a arctangent expression-tree node.
| std::string bertini::node::CanonicalEncoding | ( | std::shared_ptr< Node > const & | root | ) |
The canonical encoding of a single tree as a string (fresh context).
| root | The root of the (interned) expression DAG to encode. |
| bool bertini::node::CanonicalizeByDefault | ( | ) |
Whether Sum/Mult construction canonicalizes operand order by default.
(Per-expression opt-out is a future refinement; for now this is the session switch.)
| void bertini::node::CanonicalizeNaryOperands | ( | std::vector< std::shared_ptr< Node > > & | operands, |
| std::vector< bool > & | flags, | ||
| bool | multiplicands_first ) |
Sort an n-ary operator's (operand, flag) pairs into canonical order, in place.
| operands | the operator's operands (mutated into canonical order) |
| flags | the parallel signs (Sum) or multiply/divide flags (Mult), reordered in tandem |
| multiplicands_first | for a Mult, keep flag==true (multiplicands) ahead of flag==false (divisors), so a divisor never ends up first (the eval path expects a leading multiplicand). Pass false for a Sum (the +/- sign does not affect term order). |
No-op when canonicalization is disabled or there are fewer than two operands. Called from the Sum/Mult constructors, so the node is canonical before Make() interns it.
Build a cosine expression-tree node.
| MonomialOrder bertini::node::CurrentMonomialOrder | ( | ) |
The monomial order currently used for canonicalization (session-global – it must be consistent session-wide, since it determines interned identity).
| std::shared_ptr< Node > bertini::node::DecodeCanonical | ( | DecodingCursor & | cursor, |
| DecodingContext & | ctx ) |
Decode one node (and everything under it) from the cursor's position.
| cursor | The read position; on return it sits just past the node's closing parenthesis (or past a back-reference). |
| ctx | The back-reference table shared across the encoding unit. |
Throws std::runtime_error on any byte that does not fit the grammar, on an unknown node kind, and on a back-reference to an index not yet encountered.
| std::shared_ptr< Node > bertini::node::DecodeCanonicalTree | ( | std::string const & | text | ) |
Decode a whole tree from its canonical encoding text (fresh context).
The entire text must be one node: trailing bytes are an error.
| text | The canonical encoding, as CanonicalEncoding(root) produced it. |
|
inline |
The dialect a stream prints in; Classic unless SetDialect was called on it.
| std::shared_ptr< Node > bertini::node::E | ( | ) |
Construct a shared pointer to
.
| void bertini::node::EncodeCanonical | ( | std::shared_ptr< Node > const & | root, |
| std::ostream & | out, | ||
| EncodingContext & | ctx ) |
Append the canonical encoding of the DAG rooted at root to out.
| root | The root of the (interned) expression DAG to encode. |
| out | The stream the encoding is appended to. |
| ctx | The back-reference table; share one context across all roots of an encoding unit, so cross-root sharing encodes deterministically. |
Throws on a node kind unknown to the encoder (fail loud: an unencodable node must never silently produce a digest).
Build an exponential (e raised to the node) expression-tree node.
| std::vector< std::shared_ptr< T > > bertini::node::Find | ( | std::shared_ptr< const Node > const & | n | ) |
All distinct nodes of kind T in the subtree rooted at n, sorted by name.
| std::vector< std::shared_ptr< T > > bertini::node::Find | ( | std::vector< std::shared_ptr< const Node > > const & | roots | ) |
The union of Find<T> across several roots (one shared traversal), sorted by name.
| VariableGroup bertini::node::GatherVariables | ( | std::shared_ptr< const Node > const & | n | ) |
Collect the distinct Variables appearing in a function-tree subtree.
Traverses the tree non-intrusively, via the public child accessors of the operator and root node types. The returned group is de-duplicated (by node identity) and ordered alphabetically by Variable name.
| n | The root of the subtree to scan. May be null, in which case an empty group is returned. |
| VariableGroup bertini::node::GatherVariables | ( | std::vector< std::shared_ptr< Node > > const & | functions | ) |
Collect the distinct Variables appearing across a collection of expressions.
The union of the variables of each expression, de-duplicated (by node identity) and ordered alphabetically by Variable name. This is what the function-list System constructor uses to auto-build a single variable group.
| functions | The expressions to scan. |
| std::shared_ptr< Node > bertini::node::I | ( | ) |
Construct a shared pointer to
.
Hash-cons a freshly-built node: return an existing structurally-equal node if one is live, otherwise register and return this one.
The intern table is a process-global, weak (self-cleaning) map keyed by Node::Hash() and disambiguated by Node::IsSame(). Every Make() routes its just-constructed node through here, so structurally-equal subtrees collapse to a single shared object (hash-consing). On a hit the just-built candidate is discarded. Nodes whose IsSame() is identity (e.g. Variable, Function, Pi, E) never match, so they pass through unchanged – no special-casing.
Thread note: guarded by a mutex, contended only during single-threaded authoring. Deserialization constructs nodes WITHOUT going through Make/Intern; whatever holds the loaded nodes re-interns them as the last step of its load (System and Slice do, ADR-0068), so nothing a caller receives is outside this table.
Build a natural-logarithm expression-tree node.
|
inline |
Give an expression a name: Named(x*x + y*y, "a").
The result prints as a and evaluates to the expression; it is hash-consed by (expression, name).
| std::shared_ptr< Node > bertini::node::One | ( | ) |
Construct a shared pointer to
.
|
inline |
Build a product expression-tree node from its operands.
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
|
inline |
Build a product expression-tree node from its operands.
Like-factor power-folding (x*x -> x^2, x^a*x^b -> x^(a+b)) and nested-product flattening live centrally in CanonicalizeNaryOperands (called by the MultOperator constructor), so every product-building route – not just this adjacent binary one – gets normalized.
|
inline |
Build a sum expression-tree node from its operands.
Build a sum expression-tree node from its operands.
|
inline |
Build a sum expression-tree node from its operands.
|
inline |
Build a sum expression-tree node from its operands.
|
inline |
Build a sum expression-tree node from its operands.
|
inline |
Build a sum expression-tree node from its operands.
|
inline |
Build a sum expression-tree node from its operands.
Build a sum expression-tree node from its operands.
|
inline |
Build a sum expression-tree node from its operands.
|
inline |
Build a sum expression-tree node from its operands.
|
inline |
Build a sum expression-tree node from its operands.
|
inline |
Build a sum expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
Build a difference expression-tree node from its operands.
Build a difference expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
Build a difference expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
|
inline |
Build a difference expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
|
inline |
Build a quotient expression-tree node from its operands.
|
inline |
a single layer of indirection, though which to call the overridden virtual print() method which must be defined for each non-abstract Node type.
|
inline |
Stream insertion for a Node pointer: dispatches to the node's virtual print().
| std::shared_ptr< Node > bertini::node::Pi | ( | ) |
Construct a shared pointer to
.
|
delete |
Build a power expression-tree node.
|
inline |
Build a power expression-tree node.
|
inline |
Build a power expression-tree node.
Build a power expression-tree node.
|
inline |
Build a power expression-tree node.
Build a power expression-tree node.
|
inline |
Build a power expression-tree node.
| bool bertini::node::PowerFoldByDefault | ( | ) |
Whether Mult construction flattens + power-folds (x*x -> x^2) by default.
Session-global A/B switch (like the monomial order, it determines interned identity, so it must be consistent session-wide). ON by default; turning it off recovers the pre-fold canonical form (sort-only) – used to measure the fold's impact and to demonstrate before/after tapes.
|
inline |
The power operator in a dialect: ^ for Bertini 1, ** for Python.
|
inline |
The Bertini 1 spelling of a tree: ^ for powers, (re+im*I) for complex constants, every constant with all its digits.
What the classic parser reads back.
|
inline |
The stream-state slot the dialect is kept in (allocated once per process).
|
inline |
Print a tree in one dialect (see print_dialect.hpp).
| N | The tree to print. |
| dialect | Who the text is for. |
|
inline |
The Python spelling of a tree: ** for powers.
| N | The tree to print. |
| exact | False for str (readable; the same constant shapes as Classic), true for repr (constant spellings eval rebuilds at full precision in the bertini namespace). |
| void bertini::node::register_derived_node_types | ( | Archive & | ar | ) |
Register all concrete Node types with a Boost.Serialization archive.
Convenience overload with a private memo (single-root use).
| root | The root to re-intern. |
| std::shared_ptr< Node > bertini::node::Reintern | ( | std::shared_ptr< Node > const & | root, |
| ReinternMemo & | memo ) |
Rebuild the DAG rooted at root through the interning factories (memoized, post-order), returning the canonical interned equivalent.
| root | The (typically just-deserialized) root to re-intern. |
| memo | The pass's memo; share it across the roots of one loaded object. |
Throws on a node kind unknown to the rebuilder (fail loud – an unrebuildable node must never silently remain un-interned).
| void bertini::node::SetCanonicalizeByDefault | ( | bool | on | ) |
Set whether Sum/Mult construction canonicalizes operand order by default.
|
inline |
Choose the dialect everything subsequently printed to stream is written in.
| void bertini::node::SetMonomialOrder | ( | MonomialOrder | order | ) |
Set the session-wide monomial order (determines interned identity).
| void bertini::node::SetPowerFoldByDefault | ( | bool | on | ) |
Set whether Mult construction flattens + power-folds by default.
| std::shared_ptr< Node > bertini::node::SimplifiedMult | ( | std::vector< std::pair< std::shared_ptr< Node >, bool > > const & | factors | ) |
Build a product from (factor, mult_or_div) pairs, simplified.
A multiplied literal zero collapses the whole product to 0; literal ones are dropped; literal Integer/Rational constants (real-valued) are folded together exactly (no Complex folding – precision semantics stay untouched). A literal zero DIVISOR is left in place, keeping the division by zero visible. A single surviving multiplied factor is returned unwrapped. Builds fresh nodes; the factor nodes are shared, never modified.
Negation that never builds junk: -0 stays 0.
Builds a fresh node; never modifies the input.
| std::shared_ptr< Node > bertini::node::SimplifiedSum | ( | std::vector< std::pair< std::shared_ptr< Node >, bool > > const & | terms | ) |
Build a sum from (term, add_or_sub) pairs, omitting literal zeros.
Empty after pruning -> Integer 0; a single added term is returned unwrapped; a single subtracted term is negated. Builds fresh nodes; the term nodes are shared, never modified. Used by differentiation so derivative trees come out already simplified.
Build a sine expression-tree node.
Build a square-root expression-tree node.
Build a tangent expression-tree node.
| std::shared_ptr< Node > bertini::node::Two | ( | ) |
Construct a shared pointer to
.
| std::shared_ptr< Node > bertini::node::Zero | ( | ) |
Construct a shared pointer to
.