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

A linear slice of affine or projective space: a stack of linear forms, M [x ; 1]. More...

#include <slice.hpp>

Public Member Functions

 Slice ()=default
 An empty slice (zero forms, zero variables).
template<typename NumT>
void Eval (Vec< NumT > &result, Vec< NumT > const &x) const
 Evaluate the slice's linear-form values, in-place.
template<typename NumT>
Vec< NumT > Eval (Vec< NumT > const &x) const
 Evaluate the slice's linear-form values.
template<typename NumT>
void Jacobian (Mat< NumT > &result, Vec< NumT > const &x) const
 The slice's Jacobian (its constant variable-coefficient matrix), in-place.
template<typename NumT>
Mat< NumT > Jacobian (Vec< NumT > const &x) const
 The slice's Jacobian (its constant variable-coefficient matrix).
Mat< complex_mp > const & Coefficients () const
 The augmented coefficient matrix: one row per linear form, (Dimension) x (NumVariables+1), the trailing column carrying each form's constant term.
blocks::LinearFormsBlock const & AsLinearFormsBlock () const
 The underlying linear-forms block (eval / Jacobian / precision engine).
void AddTo (System &s) const
 Add this slice's linear forms to a System as a LinearFormsBlock. (Defined in slice.cpp.).
System AsSystem () const
 A standalone System whose functions are exactly this slice's linear forms (over the slice's variable group).
Slice Concatenate (Slice const &other) const
 A new slice stacking this slice's linear forms on top of other's.
Slice Head (unsigned m) const
 A new slice over the same variables built from the first m linear forms.
Slice Tail (unsigned m) const
 A new slice over the same variables built from the last m linear forms.
Slice Rows (std::vector< unsigned > const &indices) const
 A new slice over the same variables built from the chosen linear forms.
unsigned Dimension () const
 The dimension of the slice – the number of linear forms.
unsigned NumVariables () const
 The number of variables sliced.
VariableGroup const & Variables () const
 The variables the slice is a function of.
bool IsHomogeneous () const
 Whether the slice was authored without constant terms (passes through the origin).
unsigned Precision () const
 Get the current working precision of the slice, in digits.
void Precision (unsigned new_precision) const
 Set the working precision of the slice, in digits.

Static Public Member Functions

static Slice FromCoefficients (VariableGroup const &v, Mat< complex_mp > const &augmented_coefficients, bool homogeneous=false)
 Build a slice directly from an augmented coefficient matrix.
static Slice ThroughPoint (VariableGroup const &v, Mat< complex_mp > const &coefficients, Vec< complex_mp > const &point)
 Build an affine slice whose every linear form vanishes at a given point.
static Slice RandomReal (VariableGroup const &v, unsigned dim, bool homogeneous=false, bool orthogonal=true, Vec< complex_mp > const *through_point=nullptr)
 Produce a random real slice on a variable group, slicing a given number of dimensions.
static Slice RandomComplex (VariableGroup const &v, unsigned dim, bool homogeneous=false, bool orthogonal=true, Vec< complex_mp > const *through_point=nullptr)
 Generate a random complex slice.
static Slice Make (VariableGroup const &v, unsigned dim, bool homogeneous, bool orthogonal, bool real, std::function< void(complex_mp &, unsigned)> gen, Vec< complex_mp > const *through_point=nullptr)
 Factory for generating slices.

Friends

class boost::serialization::access
std::ostream & operator<< (std::ostream &out, Slice const &s)
 Provides output streaming for Slice.

Detailed Description

A linear slice of affine or projective space: a stack of linear forms, M [x ; 1].

The slice is held as an augmented coefficient matrix (one row per linear form, the trailing column being that form's constant term) inside a LinearFormsBlock. A homogeneous slice simply has a zero constant column. Slices compose: Head / Tail / Rows return a new Slice over the same variables built from a subset of the linear forms.

Constructor & Destructor Documentation

◆ Slice()

bertini::Slice::Slice ( )
default

An empty slice (zero forms, zero variables).

Member Function Documentation

◆ AddTo()

void bertini::Slice::AddTo ( System & s) const

Add this slice's linear forms to a System as a LinearFormsBlock. (Defined in slice.cpp.).

◆ AsLinearFormsBlock()

blocks::LinearFormsBlock const & bertini::Slice::AsLinearFormsBlock ( ) const
inline

The underlying linear-forms block (eval / Jacobian / precision engine).

◆ AsSystem()

System bertini::Slice::AsSystem ( ) const

A standalone System whose functions are exactly this slice's linear forms (over the slice's variable group).

Lets a slice be carried around and evaluated / tracked on its own. (Defined in slice.cpp.)

◆ Coefficients()

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

The augmented coefficient matrix: one row per linear form, (Dimension) x (NumVariables+1), the trailing column carrying each form's constant term.

These rows are also factor rows for a ProductsOfLinearsBlock, so a slice composes directly into the product-of-linears form regeneration uses.

◆ Concatenate()

Slice bertini::Slice::Concatenate ( Slice const & other) const
inline

A new slice stacking this slice's linear forms on top of other's.

Both slices must be on the same number of variables. The result is homogeneous only if both operands are. This is how you build a higher-codimension slice from pieces (and the Python + operator).

◆ Dimension()

unsigned bertini::Slice::Dimension ( ) const
inline

The dimension of the slice – the number of linear forms.

◆ Eval() [1/2]

template<typename NumT>
void bertini::Slice::Eval ( Vec< NumT > & result,
Vec< NumT > const & x ) const
inline

Evaluate the slice's linear-form values, in-place.

◆ Eval() [2/2]

template<typename NumT>
Vec< NumT > bertini::Slice::Eval ( Vec< NumT > const & x) const
inline

Evaluate the slice's linear-form values.

◆ FromCoefficients()

Slice bertini::Slice::FromCoefficients ( VariableGroup const & v,
Mat< complex_mp > const & augmented_coefficients,
bool homogeneous = false )
inlinestatic

Build a slice directly from an augmented coefficient matrix.

Parameters
vThe variables the slice is a function of.
augmented_coefficientsOne row per linear form, (number-of-forms) x (v.size()+1); the trailing column is each form's constant term (zero, for a homogeneous slice).
homogeneousWhether the slice was authored without constant terms.

◆ Head()

Slice bertini::Slice::Head ( unsigned m) const
inline

A new slice over the same variables built from the first m linear forms.

◆ IsHomogeneous()

bool bertini::Slice::IsHomogeneous ( ) const
inline

Whether the slice was authored without constant terms (passes through the origin).

◆ Jacobian() [1/2]

template<typename NumT>
void bertini::Slice::Jacobian ( Mat< NumT > & result,
Vec< NumT > const & x ) const
inline

The slice's Jacobian (its constant variable-coefficient matrix), in-place.

◆ Jacobian() [2/2]

template<typename NumT>
Mat< NumT > bertini::Slice::Jacobian ( Vec< NumT > const & x) const
inline

The slice's Jacobian (its constant variable-coefficient matrix).

◆ Make()

Slice bertini::Slice::Make ( VariableGroup const & v,
unsigned dim,
bool homogeneous,
bool orthogonal,
bool real,
std::function< void(complex_mp &, unsigned)> gen,
Vec< complex_mp > const * through_point = nullptr )
inlinestatic

Factory for generating slices.

Generates the variable-coefficient block (optionally orthonormalized by a QR factorization) and the constant column, then assembles the augmented matrix the LinearFormsBlock holds.

Parameters
vThe variable group the slice is over.
dimThe number of linear forms (the slice's dimension).
homogeneousWhether the slice is homogeneous (zero constant column).
orthogonalWhether to orthonormalize the coefficient block via a QR factorization.
realWhether the coefficients are real (a real orthonormal block on the orthogonal path, matching the real gen used on the non-orthogonal path and for the constant column).
genThe scalar generator used for the non-orthogonal coefficients and the constant column.
through_pointIf non-null, a point the slice must pass through (length v.size(); affine, or homogeneous when the slice is homogeneous); overrides the random constant column.

◆ NumVariables()

unsigned bertini::Slice::NumVariables ( ) const
inline

The number of variables sliced.

◆ Precision() [1/2]

unsigned bertini::Slice::Precision ( ) const
inline

Get the current working precision of the slice, in digits.

◆ Precision() [2/2]

void bertini::Slice::Precision ( unsigned new_precision) const
inline

Set the working precision of the slice, in digits.

◆ RandomComplex()

Slice bertini::Slice::RandomComplex ( VariableGroup const & v,
unsigned dim,
bool homogeneous = false,
bool orthogonal = true,
Vec< complex_mp > const * through_point = nullptr )
inlinestatic

Generate a random complex slice.

Parameters
vThe variable group the slice is over.
dimThe number of linear forms (the slice's dimension).
homogeneousWhether the slice is homogeneous (zero constant column).
orthogonalWhether to orthonormalize the coefficient block via a QR factorization.
through_pointIf non-null, a point the slice must pass through (length v.size(); affine, or homogeneous when homogeneous=true).

◆ RandomReal()

Slice bertini::Slice::RandomReal ( VariableGroup const & v,
unsigned dim,
bool homogeneous = false,
bool orthogonal = true,
Vec< complex_mp > const * through_point = nullptr )
inlinestatic

Produce a random real slice on a variable group, slicing a given number of dimensions.

Parameters
vThe variable group the slice is over.
dimThe number of linear forms (the slice's dimension).
homogeneousWhether the slice is homogeneous (zero constant column).
orthogonalWhether to orthonormalize the coefficient block via a QR factorization.
through_pointIf non-null, a point the slice must pass through (length v.size(); affine, or homogeneous when homogeneous=true).

◆ Rows()

Slice bertini::Slice::Rows ( std::vector< unsigned > const & indices) const
inline

A new slice over the same variables built from the chosen linear forms.

◆ Tail()

Slice bertini::Slice::Tail ( unsigned m) const
inline

A new slice over the same variables built from the last m linear forms.

◆ ThroughPoint()

Slice bertini::Slice::ThroughPoint ( VariableGroup const & v,
Mat< complex_mp > const & coefficients,
Vec< complex_mp > const & point )
inlinestatic

Build an affine slice whose every linear form vanishes at a given point.

Given a bare (non-augmented) coefficient block A and a point p, this assembles the augmented matrix [ A | -A*p ], so each form A_i*x - A_i*p = 0 passes through p. The result is affine (non-homogeneous): a homogeneous form cannot pass through an arbitrary point via a constant term (it would need its rows orthogonal to p – see the random factories' homogeneous through-point path).

Parameters
vThe variables the slice is a function of.
coefficientsThe bare coefficient block, (number-of-forms) x v.size() (NOT augmented).
pointThe point the slice must pass through, length v.size().

◆ Variables()

VariableGroup const & bertini::Slice::Variables ( ) const
inline

The variables the slice is a function of.

◆ boost::serialization::access

friend class boost::serialization::access
friend

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
Slice const & s )
friend

Provides output streaming for Slice.