|
| std::size_t | num_rows () const |
| std::size_t | num_cols () const |
| const util::csc_matrix< Value > & | factorL () const |
| | Read-only access to the factors (L unit lower, U upper; both CSC).
|
| const util::csc_matrix< Value > & | factorU () const |
| void | set_factor (util::csc_matrix< Value > L, util::csc_matrix< Value > U) |
| | Install the factors and (re)build the coupled forward (L) and upper (U) solve schedules from them.
|
| bool | has_factor () const |
| | True once factors (and their coupled schedules) have been installed.
|
| Value | rcond () const |
| | A cheap estimate of the reciprocal condition number: min |u_kk| / max |u_kk| over U's diagonal, as SuiteSparse's klu_rcond.
|
| template<typename Parameters> |
| Value | rgrowth (const mat::compressed2D< Value, Parameters > &A) const |
| | The reciprocal pivot growth: the minimum over U's columns k of max_i |A(i, q[k])| / max_i |U(i, k)|, capped at 1, as SuiteSparse's klu_rgrowth.
|
| 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), from at most 11 solves.
|
| void | set_factor_values (std::vector< Value > Lvals, std::vector< Value > Uvals) |
| | Install recomputed VALUES on the already-installed factor pattern, keeping the existing solve schedules.
|
| template<typename Accumulator = void, typename VecX, typename VecB> |
| void | solve (VecX &x, const VecB &b) const |
| | Solve A*x = b using the LU factorization.
|
| template<typename Accumulator = void, typename VecX, typename VecB> |
| void | solve (VecX &x, const VecB &b, std::vector< Value > &w) const |
| | solve(x, b) with the caller's workspace w, resized to n: a caller that solves many small systems (native_klu's blocks) reuses one buffer instead of allocating per solve (issue 908).
|
template<typename Value>
struct mtl::sparse::factorization::lu_numeric< Value >
Result of numeric LU factorization.
Contains L (unit lower triangular) and U (upper triangular) in CSC, plus the row and column permutations.
template<typename Value>
template<typename Parameters>
The reciprocal pivot growth: the minimum over U's columns k of max_i |A(i, q[k])| / max_i |U(i, k)|, capped at 1, as SuiteSparse's klu_rgrowth.
Near 1 means the pivots fit A; a tiny value means elements of U grew far past A's, and the factorization (a refactorization, which keeps an earlier pivot sequence, above all) cannot be trusted. It costs O(nnz(A) + nnz(U)). A must be the matrix this factorization is of. 1 for n = 0; NaN if A or U holds a NaN.
- Exceptions
-
| std::invalid_argument | if A's dimensions are not n x n. |
| std::logic_error | if no factor is installed (n > 0). |
Install recomputed VALUES on the already-installed factor pattern, keeping the existing solve schedules.
The schedules are value-agnostic – they cache positions into L_.values / U_.values, not the values – so a same-pattern refactorization can swap in new numbers and skip the O(nnz) schedule rebuild set_factor pays. Only the value arrays change; col_ptr / row_ind are kept.
Requires a factor already installed, and value arrays of exactly the installed nnz – a PATTERN change must go through set_factor. The schedules' built_nnz staleness guards (the ones the solves assert on) are re-checked here, so a schedule can never be left silently stale. Strongly exception safe: all validation precedes any member replacement.
template<typename Value>
template<typename Accumulator = void, typename VecX, typename VecB>
Solve A*x = b using the LU factorization.
P*A*Q = L*U, so A = P^T * L * U * Q^T A*x = b => P^T * L * U * Q^T * x = b => L * U * Q^T * x = P * b Let y = Q^T * x, then L * U * y = P * b
- w = P * b
- L * z = w (forward solve)
- U * y = z (back solve)
- x = Q * y Accumulator (default void, leading as in the numeric phase) selects the accumulator policy of the triangular-solve row reductions (#535): void is the raw Value loop; see level_schedule.hpp for the contract.
template<typename Value>
template<typename Accumulator = void, typename VecX, typename VecB>
solve(x, b) with the caller's workspace w, resized to n: a caller that solves many small systems (native_klu's blocks) reuses one buffer instead of allocating per solve (issue 908).
Same arithmetic. w must not share storage with x or b: b is read through the row permutation while w is written. x and b may be the same vector (all of b is read into w before x is written).
template<typename Value>
template<typename VecX, typename VecB>
Solve A^T x = b (the transpose, not the conjugate transpose).
With P A Q = L U, A^T = Q U^T L^T P, so U^T L^T (P x) = Q^T b: a forward solve with U^T, a back solve with L^T, then the row permutation. x and b may be the same vector. Serial: the transposed solves have no schedule.
- Exceptions
-
| std::logic_error | if no factor is installed (n > 0). |
| std::invalid_argument | on a size mismatch. |