|
Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
|
The evaluation-block contract for the block-composed System. More...
#include <type_traits>#include <variant>#include "bertini2/num_traits.hpp"#include "bertini2/eigen_extensions.hpp"#include "bertini2/system/blocks/polynomial_block.hpp"#include "bertini2/system/blocks/products_of_linears_block.hpp"#include "bertini2/system/blocks/linear_forms_block.hpp"#include "bertini2/system/blocks/blend_block.hpp"#include "bertini2/system/blocks/randomization_block.hpp"Go to the source code of this file.
Namespaces | |
| namespace | bertini |
| namespace | bertini::blocks |
Typedefs | |
| using | bertini::Block = std::variant<blocks::PolynomialBlock, blocks::ProductsOfLinearsBlock, blocks::LinearFormsBlock, blocks::BlendBlock<System>, blocks::RandomizationBlock<System>> |
| The closed set of evaluation blocks a System can be composed of. | |
Variables | |
| template<typename B> | |
| constexpr bool | bertini::blocks::is_block_v = is_block<B>::value |
| Convenience variable template: true iff B satisfies the polynomial-block evaluation interface. | |
The evaluation-block contract for the block-composed System.
A System is composed of evaluation blocks held in a std::variant and dispatched by std::visit – closed set, no type erasure. Each block contributes a contiguous range of rows to the system's function vector / Jacobian. Every block must provide, for each numeric type T in {complex_dbl, complex_mp}:
template<typename T> void EvalInPlace(Eigen::Ref<Vec<T>> seg, Vec<T> const& vars, T const& t) const; template<typename T> void JacobianInPlace(Eigen::Ref<Mat<T>> blk, Vec<T> const& vars, T const& t) const; template<typename T> void TimeDerivInPlace(Eigen::Ref<Vec<T>> seg, Vec<T> const& vars, T const& t) const;
plus the non-templated metadata / precision surface:
size_t NumFunctions() const; // rows this block contributes bool DependsOnPathVariable() const; // false => TimeDerivInPlace writes zeros, and dH/dt can skip it unsigned Precision() const; void Precision(unsigned) const;
and the structural surface the owning System routes through every block (degrees + homogenization), so a block can be homogenized and degree-counted uniformly:
std::vector<int> Degrees() const; std::vector<int> Degrees(VariableGroup const&) const; bool IsHomogeneous(VariableGroup const&) const; bool IsPolynomial(VariableGroup const&) const; void Homogenize(VariableGroup const&, std::shared_ptr<node::Variable> const&); // non-const
seg/blk are caller-provided sub-ranges of the system's storage (the block writes its own rows; the caller owns segmentation, the patch, etc.). vars is the full system variable vector; t is the path-variable value (ignored by blocks that don't depend on it). The contract is value-in / value-out so blocks are self-contained and testable without a System.
We are on C++17, so the contract is enforced structurally (std::visit + the is_block detection trait below + static_assert), not via a C++20 concept.