Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::blocks::RandomizationBlock< SystemT > Class Template Reference

A block that randomizes an overdetermined operand system down to a square one (with a constant coefficient matrix). More...

#include <randomization_block.hpp>

Public Types

using Var = std::shared_ptr<node::Variable>
 Shorthand for a shared pointer to a variable node.
using OperandPtr = std::shared_ptr<SystemT>
 Shorthand for a shared pointer to the operand system.

Public Member Functions

 RandomizationBlock ()
 Construct an empty randomization block at the current default precision.
 RandomizationBlock (OperandPtr operand, Mat< complex_mp > coefficients, std::vector< std::vector< int > > target_multidegrees, std::vector< std::vector< int > > operand_multidegrees, size_t num_groups)
 RandomizationBlock (RandomizationBlock const &other)
 Memory-isolating copy constructor (deep-copies the operand system; ADR-0027).
RandomizationBlock & operator= (RandomizationBlock const &other)
 Memory-isolating copy assignment (deep-copies the operand system; ADR-0027).
 RandomizationBlock (RandomizationBlock &&)=default
 Move constructor.
RandomizationBlock & operator= (RandomizationBlock &&)=default
 Move assignment.
size_t NumFunctions () const
 Number of randomized functions (rows this block contributes) = n.
std::vector< int > Degrees () const
 The randomized functions' degrees: the (total) target degree of each row, i.e.
std::vector< int > Degrees (VariableGroup const &vars) const
 Per-group target degree.
bool IsPolynomial (VariableGroup const &) const
 The randomized system is polynomial / homogeneous exactly when the operand is (System's IsPolynomial/IsHomogeneous are whole-system, no-argument checks – as BlendBlock delegates).
bool IsHomogeneous (VariableGroup const &) const
 Query whether the randomized system is homogeneous (iff homogenized and the operand is).
void Homogenize (VariableGroup const &, Var const &hom_var)
 Homogenize: thread the owning system's homogenizing variable for this group into the operand, so the operand's functions and this block's h-power deficit factors share one set of homogenizing variables.
void RestoreHomogenization (std::vector< Var > hom_vars)
 Mark the block homogenized with the given homogenizing variables, WITHOUT touching the operand – for a loader restoring an archived block whose operand is already homogenized (the canonical-encoding reader).
bool DependsOnPathVariable () const
 The randomization itself adds no path-variable dependence; it inherits the operand's.
bool HasConstantJacobian () const
 The randomized Jacobian varies in x (operand Jacobian times constants, plus h-power terms).
void Differentiate () const
 Analytic block: nothing symbolic to differentiate (the operand differentiates itself).
OperandPtr const & Operand () const
 The overdetermined operand, for the function-tree expansion oracle and the matrix getter.
Mat< complex_mp > const & RandomizationMatrix () const
 The randomization matrix R (master, highest precision); n x N, row i column j is c_ij.
bool IsHomogenized () const
 Query whether the operand has been homogenized.
std::vector< Var > const & HomVars () const
 Get the homogenizing variables accumulated, one per affine variable group.
std::vector< std::vector< int > > const & TargetMultidegrees () const
 Get the target multidegrees (per randomized row, per variable group).
std::vector< std::vector< int > > const & OperandMultidegrees () const
 Get the operand multidegrees (per operand function, per variable group).
size_t NumGroups () const
 Get the number of variable groups the multidegree bookkeeping spans.
void Reintern (node::ReinternMemo &memo)
 Re-intern this block's nodes after deserialization (ADR-0042): the homogenizing variables rebuild through the live intern tables via the shared memo, and the operand system recurses.
void Describe (std::ostream &out, size_t &row, VariableGroup const &, bool verbose) const
 Human-facing description: terse shows 'f_a..f_b = R .
unsigned Precision () const
 Get the block's current working precision.
void Precision (unsigned new_precision) const
 Set the working precision: recast the mpfr working coefficients from the master and bring the operand to the same precision (so a high-precision coefficient is not multiplied against a low-precision operand value).
template<typename T>
void EvalInPlace (Eigen::Ref< Vec< T > > result, Vec< T > const &vars, T const &) const
 Evaluate the randomized function values into a caller-provided segment.
template<typename T>
void JacobianInPlace (Eigen::Ref< Mat< T > > J, Vec< T > const &vars, T const &) const
 Evaluate the randomized Jacobian into a caller-provided block.
template<typename T>
void TimeDerivInPlace (Eigen::Ref< Vec< T > > result, Vec< T > const &, T const &) const
 Time-derivative.

Friends

class boost::serialization::access

Detailed Description

template<typename SystemT>
class bertini::blocks::RandomizationBlock< SystemT >

A block that randomizes an overdetermined operand system down to a square one (with a constant coefficient matrix).

Member Typedef Documentation

◆ OperandPtr

template<typename SystemT>
using bertini::blocks::RandomizationBlock< SystemT >::OperandPtr = std::shared_ptr<SystemT>

Shorthand for a shared pointer to the operand system.

◆ Var

template<typename SystemT>
using bertini::blocks::RandomizationBlock< SystemT >::Var = std::shared_ptr<node::Variable>

Shorthand for a shared pointer to a variable node.

Constructor & Destructor Documentation

◆ RandomizationBlock() [1/4]

template<typename SystemT>
bertini::blocks::RandomizationBlock< SystemT >::RandomizationBlock ( )
inline

Construct an empty randomization block at the current default precision.

◆ RandomizationBlock() [2/4]

template<typename SystemT>
bertini::blocks::RandomizationBlock< SystemT >::RandomizationBlock ( OperandPtr operand,
Mat< complex_mp > coefficients,
std::vector< std::vector< int > > target_multidegrees,
std::vector< std::vector< int > > operand_multidegrees,
size_t num_groups )
inline
Parameters
operandThe overdetermined system being randomized (N natural functions).
coefficientsThe n x N constant matrix; row i, column j is c_ij.
target_multidegreesn rows, each a length-num_groups vector D_i (row i's target degree per variable group).
operand_multidegreesN rows, each a length-num_groups vector d_j (operand function j's degree per variable group), measured on the affine operand.
num_groupsThe number of (affine) variable groups G.

◆ RandomizationBlock() [3/4]

template<typename SystemT>
bertini::blocks::RandomizationBlock< SystemT >::RandomizationBlock ( RandomizationBlock< SystemT > const & other)
inline

Memory-isolating copy constructor (deep-copies the operand system; ADR-0027).

◆ RandomizationBlock() [4/4]

template<typename SystemT>
bertini::blocks::RandomizationBlock< SystemT >::RandomizationBlock ( RandomizationBlock< SystemT > && )
default

Move constructor.

Member Function Documentation

◆ Degrees() [1/2]

template<typename SystemT>
std::vector< int > bertini::blocks::RandomizationBlock< SystemT >::Degrees ( ) const
inline

The randomized functions' degrees: the (total) target degree of each row, i.e.

the sum of its target multidegree over the variable groups. This is the degree-reporting hook – the path count of the squared system is the product of these.

◆ Degrees() [2/2]

template<typename SystemT>
std::vector< int > bertini::blocks::RandomizationBlock< SystemT >::Degrees ( VariableGroup const & vars) const
inline

Per-group target degree.

We match the group against the operand's variable groups by identity so the correct column of the target multidegree is returned; an unrecognized group reports the total (defensive – the owning System asks per its own groups).

◆ DependsOnPathVariable()

template<typename SystemT>
bool bertini::blocks::RandomizationBlock< SystemT >::DependsOnPathVariable ( ) const
inline

The randomization itself adds no path-variable dependence; it inherits the operand's.

◆ Describe()

template<typename SystemT>
void bertini::blocks::RandomizationBlock< SystemT >::Describe ( std::ostream & out,
size_t & row,
VariableGroup const & ,
bool verbose ) const
inline

Human-facing description: terse shows 'f_a..f_b = R .

g (R: nxN)' then the underlying functions 'g_j' indented (they are the interesting part); verbose additionally prints R's entries.

◆ Differentiate()

template<typename SystemT>
void bertini::blocks::RandomizationBlock< SystemT >::Differentiate ( ) const
inline

Analytic block: nothing symbolic to differentiate (the operand differentiates itself).

◆ EvalInPlace()

template<typename SystemT>
template<typename T>
void bertini::blocks::RandomizationBlock< SystemT >::EvalInPlace ( Eigen::Ref< Vec< T > > result,
Vec< T > const & vars,
T const &  ) const
inline

Evaluate the randomized function values into a caller-provided segment.

g_i = sum_j c_ij * f_j * prod_g h_g^{(D_{i,g} - d_{j,g})}.

◆ HasConstantJacobian()

template<typename SystemT>
bool bertini::blocks::RandomizationBlock< SystemT >::HasConstantJacobian ( ) const
inline

The randomized Jacobian varies in x (operand Jacobian times constants, plus h-power terms).

◆ Homogenize()

template<typename SystemT>
void bertini::blocks::RandomizationBlock< SystemT >::Homogenize ( VariableGroup const & ,
Var const & hom_var )
inline

Homogenize: thread the owning system's homogenizing variable for this group into the operand, so the operand's functions and this block's h-power deficit factors share one set of homogenizing variables.

The owning System calls this once per affine variable group, in group order. We accumulate the supplied hom vars; once we have one per group we homogenize the operand with exactly those variables (System::Homogenize(VariableGroup const&) reuses them rather than minting fresh ones) and record each hom var's position in the operand's variable ordering for the h-power factors.

◆ HomVars()

template<typename SystemT>
std::vector< Var > const & bertini::blocks::RandomizationBlock< SystemT >::HomVars ( ) const
inline

Get the homogenizing variables accumulated, one per affine variable group.

◆ IsHomogeneous()

template<typename SystemT>
bool bertini::blocks::RandomizationBlock< SystemT >::IsHomogeneous ( VariableGroup const & ) const
inline

Query whether the randomized system is homogeneous (iff homogenized and the operand is).

◆ IsHomogenized()

template<typename SystemT>
bool bertini::blocks::RandomizationBlock< SystemT >::IsHomogenized ( ) const
inline

Query whether the operand has been homogenized.

◆ IsPolynomial()

template<typename SystemT>
bool bertini::blocks::RandomizationBlock< SystemT >::IsPolynomial ( VariableGroup const & ) const
inline

The randomized system is polynomial / homogeneous exactly when the operand is (System's IsPolynomial/IsHomogeneous are whole-system, no-argument checks – as BlendBlock delegates).

Query whether the randomized system is polynomial (iff the operand is).

◆ JacobianInPlace()

template<typename SystemT>
template<typename T>
void bertini::blocks::RandomizationBlock< SystemT >::JacobianInPlace ( Eigen::Ref< Mat< T > > J,
Vec< T > const & vars,
T const &  ) const
inline

Evaluate the randomized Jacobian into a caller-provided block.

By the product rule on c_ij * f_j * W_ij(x) (W_ij = prod_g h_g^{e_{ij,g}}): d g_i / d x_l = sum_j c_ij [ (d f_j / d x_l) W_ij + f_j (d W_ij / d x_l) ], and dW_ij/dx_l is nonzero only when x_l is a homogenizing variable h_{g'} appearing in W_ij.

◆ NumFunctions()

template<typename SystemT>
size_t bertini::blocks::RandomizationBlock< SystemT >::NumFunctions ( ) const
inline

Number of randomized functions (rows this block contributes) = n.

◆ NumGroups()

template<typename SystemT>
size_t bertini::blocks::RandomizationBlock< SystemT >::NumGroups ( ) const
inline

Get the number of variable groups the multidegree bookkeeping spans.

◆ Operand()

template<typename SystemT>
OperandPtr const & bertini::blocks::RandomizationBlock< SystemT >::Operand ( ) const
inline

The overdetermined operand, for the function-tree expansion oracle and the matrix getter.

◆ OperandMultidegrees()

template<typename SystemT>
std::vector< std::vector< int > > const & bertini::blocks::RandomizationBlock< SystemT >::OperandMultidegrees ( ) const
inline

Get the operand multidegrees (per operand function, per variable group).

◆ operator=() [1/2]

template<typename SystemT>
RandomizationBlock & bertini::blocks::RandomizationBlock< SystemT >::operator= ( RandomizationBlock< SystemT > && )
default

Move assignment.

◆ operator=() [2/2]

template<typename SystemT>
RandomizationBlock & bertini::blocks::RandomizationBlock< SystemT >::operator= ( RandomizationBlock< SystemT > const & other)
inline

Memory-isolating copy assignment (deep-copies the operand system; ADR-0027).

◆ Precision() [1/2]

template<typename SystemT>
unsigned bertini::blocks::RandomizationBlock< SystemT >::Precision ( ) const
inline

Get the block's current working precision.

◆ Precision() [2/2]

template<typename SystemT>
void bertini::blocks::RandomizationBlock< SystemT >::Precision ( unsigned new_precision) const
inline

Set the working precision: recast the mpfr working coefficients from the master and bring the operand to the same precision (so a high-precision coefficient is not multiplied against a low-precision operand value).

◆ RandomizationMatrix()

template<typename SystemT>
Mat< complex_mp > const & bertini::blocks::RandomizationBlock< SystemT >::RandomizationMatrix ( ) const
inline

The randomization matrix R (master, highest precision); n x N, row i column j is c_ij.

◆ Reintern()

template<typename SystemT>
void bertini::blocks::RandomizationBlock< SystemT >::Reintern ( node::ReinternMemo & memo)
inline

Re-intern this block's nodes after deserialization (ADR-0042): the homogenizing variables rebuild through the live intern tables via the shared memo, and the operand system recurses.

The coefficient matrices hold no nodes. Content unchanged.

◆ RestoreHomogenization()

template<typename SystemT>
void bertini::blocks::RandomizationBlock< SystemT >::RestoreHomogenization ( std::vector< Var > hom_vars)
inline

Mark the block homogenized with the given homogenizing variables, WITHOUT touching the operand – for a loader restoring an archived block whose operand is already homogenized (the canonical-encoding reader).

Never call this after Homogenize.

Parameters
hom_varsThe homogenizing variable of each affine variable group, in group order.

◆ TargetMultidegrees()

template<typename SystemT>
std::vector< std::vector< int > > const & bertini::blocks::RandomizationBlock< SystemT >::TargetMultidegrees ( ) const
inline

Get the target multidegrees (per randomized row, per variable group).

◆ TimeDerivInPlace()

template<typename SystemT>
template<typename T>
void bertini::blocks::RandomizationBlock< SystemT >::TimeDerivInPlace ( Eigen::Ref< Vec< T > > result,
Vec< T > const & ,
T const &  ) const
inline

Time-derivative.

The randomization is autonomous in the path variable; if the operand depends on t (unusual for a randomized target) its rows would contribute, but the common case is an autonomous operand, so this is zero.

◆ boost::serialization::access

template<typename SystemT>
friend class boost::serialization::access
friend