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

Stateful partial-pivot LU factor/solve with preallocated, precision-adjustable banks. More...

#include <lu_solver.hpp>

Public Member Functions

void ChangeSize (unsigned n)
 (Re)size the workspace to hold n x n systems.
void ChangePrecision (unsigned prec)
 Re-set the precision of every mp temporary bank (a no-op for complex_dbl).
unsigned precision () const
 Get the current working precision (digits).
MatrixSuccessCode Factor (Mat< NumT > const &A)
 Factor a copy of A with partial pivoting; A is preserved.
MatrixSuccessCode FactorDestructive (Mat< NumT > &A)
 Factor A destructively (no copy): on return A holds the L\U factors.
template<typename OutDerived>
void Solve (Vec< NumT > const &b, Eigen::MatrixBase< OutDerived > const &x_out) const
 Solve A x = b using the stored factors.
Mat< NumT > const & Factors () const
 The factored matrix (L below the diagonal, U on and above), for the caller's LUPartialPivotDecompositionSuccessful()-style health check.

Detailed Description

template<typename NumT>
class bertini::linalg::PartialPivLU< NumT >

Stateful partial-pivot LU factor/solve with preallocated, precision-adjustable banks.

Template Parameters
NumTThe (complex) scalar type – complex_dbl or complex_mp.

Numerically this is the same right-looking Gaussian elimination with partial pivoting as Eigen's PartialPivLU (unit lower-triangular L, upper-triangular U, row pivoting), so solutions agree with Eigen to backward-stable accuracy. The win is allocation behavior, not the arithmetic.

Member Function Documentation

◆ ChangePrecision()

template<typename NumT>
void bertini::linalg::PartialPivLU< NumT >::ChangePrecision ( unsigned prec)
inline

Re-set the precision of every mp temporary bank (a no-op for complex_dbl).

Parameters
precThe new working precision (digits).

◆ ChangeSize()

template<typename NumT>
void bertini::linalg::PartialPivLU< NumT >::ChangeSize ( unsigned n)
inline

(Re)size the workspace to hold n x n systems.

Call on a system-size change.

Parameters
nThe matrix dimension.

◆ Factor()

template<typename NumT>
MatrixSuccessCode bertini::linalg::PartialPivLU< NumT >::Factor ( Mat< NumT > const & A)
inline

Factor a copy of A with partial pivoting; A is preserved.

O(1) allocations.

Parameters
AThe square matrix to factor.
Returns
Success unless the factored diagonal looks near-singular / ill-conditioned.

◆ FactorDestructive()

template<typename NumT>
MatrixSuccessCode bertini::linalg::PartialPivLU< NumT >::FactorDestructive ( Mat< NumT > & A)
inline

Factor A destructively (no copy): on return A holds the L\U factors.

Parameters
AThe square matrix; overwritten with the factorization.
Returns
Success unless the factored diagonal looks near-singular / ill-conditioned.

◆ Factors()

template<typename NumT>
Mat< NumT > const & bertini::linalg::PartialPivLU< NumT >::Factors ( ) const
inline

The factored matrix (L below the diagonal, U on and above), for the caller's LUPartialPivotDecompositionSuccessful()-style health check.

◆ precision()

template<typename NumT>
unsigned bertini::linalg::PartialPivLU< NumT >::precision ( ) const
inline

Get the current working precision (digits).

◆ Solve()

template<typename NumT>
template<typename OutDerived>
void bertini::linalg::PartialPivLU< NumT >::Solve ( Vec< NumT > const & b,
Eigen::MatrixBase< OutDerived > const & x_out ) const
inline

Solve A x = b using the stored factors.

Reuses scratch; O(1) allocations.

Template Parameters
OutDerivedThe output type – a Vec or a writable block such as K.col(stage).
Parameters
bThe right-hand side (must be materialized storage, distinct from x).
[out]x_outThe solution (sized n). A temporary expression (e.g. .col()) is fine.