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

The evaluation-block contract for the block-composed System. More...

Include dependency graph for block.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  bertini::blocks::is_block< typename, typename >
 Detection trait: does B satisfy the evaluation-block contract? More...
struct  bertini::blocks::is_block< B, std::void_t< decltype(std::declval< const B & >().NumFunctions()), decltype(std::declval< const B & >().DependsOnPathVariable()), decltype(std::declval< const B & >().Precision()), decltype(std::declval< const B & >().Precision(0u)), decltype(std::declval< const B & >().Degrees()), decltype(std::declval< const B & >().Degrees(std::declval< VariableGroup const & >())), decltype(std::declval< const B & >().IsHomogeneous(std::declval< VariableGroup const & >())), decltype(std::declval< const B & >().IsPolynomial(std::declval< VariableGroup const & >())), decltype(std::declval< B & >().Homogenize(std::declval< VariableGroup const & >(), std::declval< std::shared_ptr< node::Variable > const & >())), decltype(std::declval< const B & >().template EvalInPlace< complex_dbl >(std::declval< Eigen::Ref< Vec< complex_dbl > > >(), std::declval< Vec< complex_dbl > const & >(), std::declval< complex_dbl const & >())), decltype(std::declval< const B & >().template JacobianInPlace< complex_dbl >(std::declval< Eigen::Ref< Mat< complex_dbl > > >(), std::declval< Vec< complex_dbl > const & >(), std::declval< complex_dbl const & >())), decltype(std::declval< const B & >().template TimeDerivInPlace< complex_dbl >(std::declval< Eigen::Ref< Vec< complex_dbl > > >(), std::declval< Vec< complex_dbl > const & >(), std::declval< complex_dbl const & >()))> >

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.

Detailed Description

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.