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

A block of system functions, each an affine linear form f_i(x) = c_i . More...

#include <linear_forms_block.hpp>

Public Member Functions

 LinearFormsBlock ()
 LinearFormsBlock (size_t num_vars, Mat< complex_mp > coefficients)
 LinearFormsBlock (size_t num_vars, Mat< complex_mp > coefficients, bool homogenized)
 Construct a block in a stated homogenization state – for a loader restoring an archived block as it was, without re-running Homogenize.
size_t NumFunctions () const
 Number of functions (rows the block contributes to the system).
std::vector< int > Degrees () const
 Linear forms are degree 1.
std::vector< int > Degrees (VariableGroup const &) const
 Per-function degrees with respect to a given variable group (all 1).
bool IsPolynomial (VariableGroup const &) const
 Linear forms are polynomial.
bool IsHomogeneous (VariableGroup const &) const
 An affine form a.x + b is inhomogeneous (it carries a constant); once homogenized the constant has become a homogenizing-variable coefficient, so it is degree-1 homogeneous.
void Homogenize (VariableGroup const &, std::shared_ptr< node::Variable > const &)
 Homogenize: fold the constant column onto the homogenizing variable.
size_t NumVariables () const
 Number of variables the block expects in the input vector.
Mat< complex_mp > const & Coefficients () const
 The master coefficient matrix (one row per form).
bool IsHomogenized () const
 Whether Homogenize has folded the constant column onto a homogenizing variable.
void Describe (std::ostream &out, size_t &row, VariableGroup const &vars, bool verbose) const
 Human-facing description: each form prints as the placeholder 'f_k = c.
bool DependsOnPathVariable () const
 Linear forms do not depend on the path variable.
bool HasConstantJacobian () const
 The Jacobian is the (constant) coefficient matrix, independent of x and t.
void Differentiate () const
 Analytic block: nothing symbolic to differentiate.
unsigned Precision () const
 Get the block's current working precision.
void Precision (unsigned new_precision) const
 Set the working precision; recasts the mpfr working coefficients from the master.
template<typename T>
void EvalInPlace (Eigen::Ref< Vec< T > > result, Vec< T > const &vars, T const &) const
 Evaluate the block's 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 block's Jacobian (d f_i / d x_j) into a caller-provided block.
template<typename T>
void TimeDerivInPlace (Eigen::Ref< Vec< T > > result, Vec< T > const &, T const &) const
 Time-derivative into a caller-provided segment.

Friends

class boost::serialization::access

Detailed Description

A block of system functions, each an affine linear form f_i(x) = c_i .

[x ; 1].

Value-in / value-out: evaluation takes the variable vector and writes into a caller- provided segment, so the block is self-contained and unit-testable without a System.

Constructor & Destructor Documentation

◆ LinearFormsBlock() [1/3]

bertini::blocks::LinearFormsBlock::LinearFormsBlock ( )
inline

◆ LinearFormsBlock() [2/3]

bertini::blocks::LinearFormsBlock::LinearFormsBlock ( size_t num_vars,
Mat< complex_mp > coefficients )
inline
Parameters
num_varsThe number of variables (n). The coefficient matrix has n+1 columns (the trailing column multiplies the augmenting 1 – the constant term of each form).
coefficientsThe augmented coefficient matrix: one row per function, shape (number-of-functions) x (num_vars + 1).

◆ LinearFormsBlock() [3/3]

bertini::blocks::LinearFormsBlock::LinearFormsBlock ( size_t num_vars,
Mat< complex_mp > coefficients,
bool homogenized )
inline

Construct a block in a stated homogenization state – for a loader restoring an archived block as it was, without re-running Homogenize.

Parameters
num_varsThe number of variables the block reads (the homogenizing variable included when homogenized).
coefficientsThe coefficient matrix exactly as the block held it: num_vars + 1 columns (the last the constant term) when affine, num_vars columns when homogenized.
homogenizedWhether the constant column has already been folded onto a homogenizing variable.

Member Function Documentation

◆ Coefficients()

Mat< complex_mp > const & bertini::blocks::LinearFormsBlock::Coefficients ( ) const
inline

The master coefficient matrix (one row per form).

Affine: num_vars+1 columns, the last being the constant term. Homogeneous (post-Homogenize): num_vars columns, all variable columns. Exposed for the function-tree expansion (System::NaturalFunctionsAsNodes).

◆ Degrees() [1/2]

std::vector< int > bertini::blocks::LinearFormsBlock::Degrees ( ) const
inline

Linear forms are degree 1.

◆ Degrees() [2/2]

std::vector< int > bertini::blocks::LinearFormsBlock::Degrees ( VariableGroup const & ) const
inline

Per-function degrees with respect to a given variable group (all 1).

◆ DependsOnPathVariable()

bool bertini::blocks::LinearFormsBlock::DependsOnPathVariable ( ) const
inline

Linear forms do not depend on the path variable.

◆ Describe()

void bertini::blocks::LinearFormsBlock::Describe ( std::ostream & out,
size_t & row,
VariableGroup const & vars,
bool verbose ) const
inline

Human-facing description: each form prints as the placeholder 'f_k = c.

[x, y, 1]' (structure stays legible) followed by its actual coefficient row in a 'c =' legend below – short (4 significant figures) in terse, full precision in verbose. Terse truncates after kTerseRowCap forms so a large slice does not flood the terminal.

◆ Differentiate()

void bertini::blocks::LinearFormsBlock::Differentiate ( ) const
inline

Analytic block: nothing symbolic to differentiate.

◆ EvalInPlace()

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

Evaluate the block's function values into a caller-provided segment.

The path variable is ignored (linear forms are autonomous).

Parameters
resultLength-NumFunctions() segment to write into.
varsLength-NumVariables() current variable values.

◆ HasConstantJacobian()

bool bertini::blocks::LinearFormsBlock::HasConstantJacobian ( ) const
inline

The Jacobian is the (constant) coefficient matrix, independent of x and t.

◆ Homogenize()

void bertini::blocks::LinearFormsBlock::Homogenize ( VariableGroup const & ,
std::shared_ptr< node::Variable > const &  )
inline

Homogenize: fold the constant column onto the homogenizing variable.

An augmented form a.x + b (last column = constant) becomes the homogeneous a.x + b*h, where the homogenizing variable h is prepended to the variable ordering – so its column is the old constant column. The block then evaluates M*[vars] directly (no augmenting 1). Currently supports a single affine variable group (the dominant bertini.linalg case); a second call (a second affine group) throws.

◆ IsHomogeneous()

bool bertini::blocks::LinearFormsBlock::IsHomogeneous ( VariableGroup const & ) const
inline

An affine form a.x + b is inhomogeneous (it carries a constant); once homogenized the constant has become a homogenizing-variable coefficient, so it is degree-1 homogeneous.

◆ IsHomogenized()

bool bertini::blocks::LinearFormsBlock::IsHomogenized ( ) const
inline

Whether Homogenize has folded the constant column onto a homogenizing variable.

◆ IsPolynomial()

bool bertini::blocks::LinearFormsBlock::IsPolynomial ( VariableGroup const & ) const
inline

Linear forms are polynomial.

◆ JacobianInPlace()

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

Evaluate the block's Jacobian (d f_i / d x_j) into a caller-provided block.

The Jacobian of f(x) = M x + b is simply M (its variable columns) – constant in x. The path variable is unused (autonomous).

Parameters
JA NumFunctions() x NumVariables() block to write into.
varsLength-NumVariables() current variable values. The Jacobian does not depend on them, but they carry the PRECISION to evaluate at: the block materializes its working coefficients to match before writing them out (ADR-0057).

◆ NumFunctions()

size_t bertini::blocks::LinearFormsBlock::NumFunctions ( ) const
inline

Number of functions (rows the block contributes to the system).

◆ NumVariables()

size_t bertini::blocks::LinearFormsBlock::NumVariables ( ) const
inline

Number of variables the block expects in the input vector.

◆ Precision() [1/2]

unsigned bertini::blocks::LinearFormsBlock::Precision ( ) const
inline

Get the block's current working precision.

◆ Precision() [2/2]

void bertini::blocks::LinearFormsBlock::Precision ( unsigned new_precision) const
inline

Set the working precision; recasts the mpfr working coefficients from the master.

◆ TimeDerivInPlace()

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

Time-derivative into a caller-provided segment.

Linear forms are autonomous (no path-variable dependence), so this is identically zero.

◆ boost::serialization::access

friend class boost::serialization::access
friend