Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
eval_expression.hpp File Reference

Evaluate a bare expression tree at a point, without the caller owning a System. More...

#include <map>
#include <string>
#include <stdexcept>
#include <type_traits>
#include "bertini2/system/system.hpp"
#include "bertini2/function_tree/gather.hpp"
Include dependency graph for eval_expression.hpp:

Go to the source code of this file.

Namespaces

namespace  bertini

Functions

template<typename T>
T bertini::EvalExpression (std::shared_ptr< node::Node > const &expr, std::map< std::string, T > const &variable_values, bool strict=true)
 Evaluate an expression tree at a point supplied as a variable-name -> value map.

Detailed Description

Evaluate a bare expression tree at a point, without the caller owning a System.

The work is delegated to the single evaluation engine (the compiled SLP). The expression's variables are discovered and ordered by name; a one-function program is compiled for the expression and memoized on the (immutable, hash-consed) node, so repeated evaluation of the same expression reuses it rather than recompiling. Each call runs the shared program against its own working memory at the requested point.