|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
Numeric KLU factorization: BTF permutation, the permuted matrix B = P*A*Q (block upper triangular), the per-new-index block id, and a left-looking LU factorization of each diagonal block. More...
Classes | |
| struct | klu_slice |
| A non-owning view of m consecutive Values, with the size() and operator() lu_numeric::solve takes for its vectors. More... | |
| struct | lu_snode |
| One closed (finished) L-supernode kept densely for use as an update source. More... | |
Functions | |
| template<typename Value, typename SizeType> | |
| void | require_nonzero_diagonal (const util::csc_matrix< Value, SizeType > &T, bool diagonal_last, const std::vector< Value > &values, const char *fn) |
| The check the solves skip under done_by_caller, for a factor's install: the diagonal stored first (lower) or last (upper) in each column is nonzero. | |
| template<typename Value, typename SizeType> | |
| bool | lu_fold_pivots (const util::csc_matrix< Value, SizeType > &U, Value &lo, Value &hi, bool &seen) |
| Folds |u_kk| over U's diagonal (the last entry of each column) into [lo, hi]; seen says whether lo and hi hold a value yet. | |
| template<typename Value, typename SizeType, typename ColMax> | |
| Value | lu_rgrowth (const util::csc_matrix< Value, SizeType > &U, ColMax &&amax_of, Value g=Value{1}) |
| min(g, min over U's columns k of amax_of(k) / max_i |U(i, k)|), where amax_of(k) is the largest |entry| of the factored matrix's column that became U's column k. | |
| template<typename Value, typename Parameters> | |
| Value | csr_norm1_scaled (const mat::compressed2D< Value, Parameters > &A, int &e) |
| ||A||_1, the largest column sum of |A(i, j)|, for a square CSR A, as m 2^e: 2^e <= max |A(i, j)| < 2^(e+1), so m is in [1, 2n) and neither the sums nor m overflow, whatever A's scale (e = 0 and m = 0 for A = 0). | |
| template<typename Value, typename Parameters> | |
| Value | csr_norm1 (const mat::compressed2D< Value, Parameters > &A) |
| ||A||_1 itself (it overflows where the norm does). | |
| template<typename Value, typename Solve, typename SolveT> | |
| Value | inverse_norm1_estimate (std::size_t n, Solve &&solve_raw, SolveT &&solve_t_raw, int probe_exp=0) |
| An estimate of ||A^{-1}||_1 from solves with A and A^T: Hager's method with Higham's refinements (Higham, "FORTRAN codes for estimating the one-norm of
a real or complex matrix", ACM TOMS 14(4), 1988; Algorithm 4.1), as SuiteSparse's klu_condest. | |
| template<typename Value, typename Parameters, typename Solve, typename SolveT> | |
| Value | condest_1 (const mat::compressed2D< Value, Parameters > &A, Solve &&solve, SolveT &&solve_t) |
| ||A||_1 ||A^{-1}||_1, estimated, for condest(): from solve(y, x) = A^{-1} x and solve_t(z, x) = A^{-T} x. | |
| template<typename Value, typename Parameters> | |
| supernodal_symbolic | build_supernodal_symbolic (const mat::compressed2D< Value, Parameters > &A, const cholesky_symbolic &base, std::size_t relax) |
| Shared back end of the two symbolic overloads: fuse the fill-reducing ordering with a postorder of the elimination tree (so supernode columns are contiguous), then detect supernodes in that permuted space. | |
| template<typename SizeType> | |
| void | misplaced_diagonal (const char *fn, SizeType col) |
| The diagonal of column col is not where the solve expects it (first in a column of L, last in a column of U): a wrong layout, or no diagonal stored. | |
| template<typename SizeType> | |
| void | zero_diagonal (const char *fn, SizeType col) |
| A zero diagonal: the triangular matrix is singular. | |
Numeric KLU factorization: BTF permutation, the permuted matrix B = P*A*Q (block upper triangular), the per-new-index block id, and a left-looking LU factorization of each diagonal block.
|
inline |
Shared back end of the two symbolic overloads: fuse the fill-reducing ordering with a postorder of the elimination tree (so supernode columns are contiguous), then detect supernodes in that permuted space.
| Value mtl::sparse::factorization::detail::condest_1 | ( | const mat::compressed2D< Value, Parameters > & | A, |
| Solve && | solve, | ||
| SolveT && | solve_t ) |
||A||_1 ||A^{-1}||_1, estimated, for condest(): from solve(y, x) = A^{-1} x and solve_t(z, x) = A^{-T} x.
Range-safe: with 2^e <= max |A(i, j)|, the probes are scaled by 2^(e-2), so each solve's result is about cond(A) / (4 ||A||_1 / 2^e) in size, and the result is m 2^e times the estimate of ||A^{-1}||_1, combined as m (2^(e - probe_exp) est). The probe exponent is kept above the subnormal range by twice the mantissa width, so a probe keeps its precision. 1 for n = 0; NaN for a NaN or infinite A, or solve.
| Value mtl::sparse::factorization::detail::csr_norm1 | ( | const mat::compressed2D< Value, Parameters > & | A | ) |
||A||_1 itself (it overflows where the norm does).
| Value mtl::sparse::factorization::detail::csr_norm1_scaled | ( | const mat::compressed2D< Value, Parameters > & | A, |
| int & | e ) |
||A||_1, the largest column sum of |A(i, j)|, for a square CSR A, as m 2^e: 2^e <= max |A(i, j)| < 2^(e+1), so m is in [1, 2n) and neither the sums nor m overflow, whatever A's scale (e = 0 and m = 0 for A = 0).
NaN if A holds one, or an infinity.
| Value mtl::sparse::factorization::detail::inverse_norm1_estimate | ( | std::size_t | n, |
| Solve && | solve_raw, | ||
| SolveT && | solve_t_raw, | ||
| int | probe_exp = 0 ) |
An estimate of ||A^{-1}||_1 from solves with A and A^T: Hager's method with Higham's refinements (Higham, "FORTRAN codes for estimating the one-norm of a real or complex matrix", ACM TOMS 14(4), 1988; Algorithm 4.1), as SuiteSparse's klu_condest.
At most five pairs of solves and one more, so O(5 nnz(L + U)). The estimate is a lower bound of ||A^{-1}||_1, and is exact or within a factor of 3 in practice. solve(y, x) computes A^{-1} x and solve_t(z, x) A^{-T} x, on dense_vector<Value>. NaN if a solve gives a NaN.
probe_exp scales every vector handed to a solve by 2^probe_exp (exact), so the estimate returned is of 2^probe_exp ||A^{-1}||_1. condest_1 picks it so that the solves' results are of the size of cond(A), not of ||A^{-1}||, which keeps them finite for a matrix of any scale whose condition number is.
| bool mtl::sparse::factorization::detail::lu_fold_pivots | ( | const util::csc_matrix< Value, SizeType > & | U, |
| Value & | lo, | ||
| Value & | hi, | ||
| bool & | seen ) |
Folds |u_kk| over U's diagonal (the last entry of each column) into [lo, hi]; seen says whether lo and hi hold a value yet.
At a NaN pivot it stops and returns false, with lo set to that NaN.
| Value mtl::sparse::factorization::detail::lu_rgrowth | ( | const util::csc_matrix< Value, SizeType > & | U, |
| ColMax && | amax_of, | ||
| Value | g = Value{1} ) |
min(g, min over U's columns k of amax_of(k) / max_i |U(i, k)|), where amax_of(k) is the largest |entry| of the factored matrix's column that became U's column k.
A NaN, in U or in a ratio, is returned as it is.
|
inline |
The diagonal of column col is not where the solve expects it (first in a column of L, last in a column of U): a wrong layout, or no diagonal stored.
| void mtl::sparse::factorization::detail::require_nonzero_diagonal | ( | const util::csc_matrix< Value, SizeType > & | T, |
| bool | diagonal_last, | ||
| const std::vector< Value > & | values, | ||
| const char * | fn ) |
The check the solves skip under done_by_caller, for a factor's install: the diagonal stored first (lower) or last (upper) in each column is nonzero.
|
inline |
A zero diagonal: the triangular matrix is singular.