MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::sparse::factorization::klu_numeric< Value > Struct Template Reference

#include <native_klu.hpp>

Public Member Functions

std::size_t num_rows () const
std::size_t num_cols () const
std::size_t nblocks () const
Value rcond () const
 A cheap reciprocal condition estimate: min |u_kk| / max |u_kk| over the diagonals of every block's U, as SuiteSparse's klu_rcond.
Value rgrowth () const
 The reciprocal pivot growth, as SuiteSparse's klu_rgrowth: the minimum, over the columns j of every diagonal block, of max |B_bb(:, j)| / max |U_b(:, j)|, capped at 1.
template<typename VecX, typename VecB>
void solve (VecX &x, const VecB &b) const
 Solve A*x = b via block back-substitution.
template<typename VecX, typename VecB>
void solve_transpose (VecX &x, const VecB &b) const
 Solve A^T x = b (the transpose, not the conjugate transpose).
template<typename Parameters>
Value condest (const mat::compressed2D< Value, Parameters > &A) const
 An estimate of the 1-norm condition number ||A||_1 ||A^{-1}||_1, as SuiteSparse's klu_condest: Hager's method with Higham's refinements (detail::inverse_norm1_estimate in sparse_lu.hpp), from at most 11 solves with A and A^T.

Public Attributes

ordering::btf_result btf
 row/col permutations + blocks
mat::compressed2D< Value > B
 P*(R*A)*Q, block upper triangular.
std::vector< std::size_t > block_of
 new index -> block id
std::vector< lu_numeric< Value > > block_numeric
 LU of each diagonal block.
std::vector< Value > row_scale
 r[orig row]; empty = unscaled (factored R*A, so solve scales b)
std::size_t num_perturbed = 0
 total perturbed pivots across blocks (0 = clean)

Member Function Documentation

◆ condest()

template<typename Value>
template<typename Parameters>
Value mtl::sparse::factorization::klu_numeric< Value >::condest ( const mat::compressed2D< Value, Parameters > & A) const
inline

An estimate of the 1-norm condition number ||A||_1 ||A^{-1}||_1, as SuiteSparse's klu_condest: Hager's method with Higham's refinements (detail::inverse_norm1_estimate in sparse_lu.hpp), from at most 11 solves with A and A^T.

A lower bound, exact or within a factor of 3 in practice. A is the matrix factored, unscaled: the row scaling is undone by the solves. 1 for n = 0; NaN if A or a solve holds a NaN.

Exceptions
std::invalid_argumentif A's dimensions are not n x n.

◆ nblocks()

template<typename Value>
std::size_t mtl::sparse::factorization::klu_numeric< Value >::nblocks ( ) const
inline

◆ num_cols()

template<typename Value>
std::size_t mtl::sparse::factorization::klu_numeric< Value >::num_cols ( ) const
inline

◆ num_rows()

template<typename Value>
std::size_t mtl::sparse::factorization::klu_numeric< Value >::num_rows ( ) const
inline

◆ rcond()

template<typename Value>
Value mtl::sparse::factorization::klu_numeric< Value >::rcond ( ) const
inline

A cheap reciprocal condition estimate: min |u_kk| / max |u_kk| over the diagonals of every block's U, as SuiteSparse's klu_rcond.

O(n). A crude first check, not a bound. 1 for n = 0; NaN if a pivot is NaN.

◆ rgrowth()

template<typename Value>
Value mtl::sparse::factorization::klu_numeric< Value >::rgrowth ( ) const
inline

The reciprocal pivot growth, as SuiteSparse's klu_rgrowth: the minimum, over the columns j of every diagonal block, of max |B_bb(:, j)| / max |U_b(:, j)|, capped at 1.

B is the row-scaled, permuted matrix that was factored. Near 1 means the pivots fit the values; a tiny value means they do not, typically after native_klu_refactor kept a pivot that the new values made tiny, and the solve cannot be trusted: factor afresh. O(nnz(B) + nnz(U)). 1 for n = 0; NaN if B or U holds a NaN.

◆ solve()

template<typename Value>
template<typename VecX, typename VecB>
void mtl::sparse::factorization::klu_numeric< Value >::solve ( VecX & x,
const VecB & b ) const
inline

Solve A*x = b via block back-substitution.

x and b have the dimension of the original matrix A.

◆ solve_transpose()

template<typename Value>
template<typename VecX, typename VecB>
void mtl::sparse::factorization::klu_numeric< Value >::solve_transpose ( VecX & x,
const VecB & b ) const
inline

Solve A^T x = b (the transpose, not the conjugate transpose).

With B = P R A Q, A^T = Q B^T P R^{-1}, so B^T y = Q^T b with y = P R^{-1} x. B^T is block LOWER triangular: the first block is solved first, and its coupling is subtracted from the later blocks' right-hand sides. Each block's transposed solve is lu_numeric::solve_transpose. It is what condest() needs, and what an adjoint (sensitivity) solve needs.

Member Data Documentation

◆ B

template<typename Value>
mat::compressed2D<Value> mtl::sparse::factorization::klu_numeric< Value >::B

P*(R*A)*Q, block upper triangular.

◆ block_numeric

template<typename Value>
std::vector<lu_numeric<Value> > mtl::sparse::factorization::klu_numeric< Value >::block_numeric

LU of each diagonal block.

◆ block_of

template<typename Value>
std::vector<std::size_t> mtl::sparse::factorization::klu_numeric< Value >::block_of

new index -> block id

◆ btf

template<typename Value>
ordering::btf_result mtl::sparse::factorization::klu_numeric< Value >::btf

row/col permutations + blocks

◆ num_perturbed

template<typename Value>
std::size_t mtl::sparse::factorization::klu_numeric< Value >::num_perturbed = 0

total perturbed pivots across blocks (0 = clean)

◆ row_scale

template<typename Value>
std::vector<Value> mtl::sparse::factorization::klu_numeric< Value >::row_scale

r[orig row]; empty = unscaled (factored R*A, so solve scales b)


The documentation for this struct was generated from the following file:
  • /home/runner/work/mtl5/mtl5/include/mtl/sparse/factorization/native_klu.hpp