num::lu¶
Defined in header <linear/banded/banded.hpp>, <linear/factorization/factor.hpp>, <linear/factorization/lu.hpp>, <linear/factorization/mixed_lu.hpp>, <linear/factorization/reuse.hpp>
banded_lu_result lu(band_mat A); // (1)
template <std::floating_point T>
lu_result<T> lu(const mat<T> &A); // (2)
template <std::floating_point T>
lu_result<T> lu(const mat<T> &A, no_pivot_structure); // (3)
lu_result<real> lu(const spmat &R, no_pivot_structure); // (4)
block_lu_factor lu(const spmat &R, block_structure structure); // (5)
auto_linear_solver lu(const spmat &R, sparse_structure); // (6)
mixed_lu lu(const mat<real> &A, mixed_precision_structure); // (7)
corrected_lu lu(const spmat &R, no_pivot_structure, const corrected_lu *previous,
view<const idx> changed); // (8)
suffix_block_lu lu(const spmat &R, block_structure structure,
const suffix_block_lu *previous, view<const idx> changed); // (9)
(1) Factor \(PA = LU\) with partial pivoting. Pass an rvalue to factor in place.
(2) Factor \(PA = LU\) with partial pivoting.
In double precision, uses LAPACK dgetrf above lapack_factor_threshold when an optimized LAPACK is configured, else the in-tree blocked kernel; other precisions always use the kernel. Call num::lapack::lu or num::seq::lu to force one. A singular A sets singular; the factorization still completes.
(3) Factor \(A = LU\) without row swaps, for matrices such as diagonally dominant M-matrices whose pivots stay nonzero.
Saves the pivot search and row swap at every step. singular reports a zero pivot, but small pivots go unchecked, so use lu(A) without that structural guarantee.
(4) Factor a sparse unstructured nonsingular M-matrix by no-pivot LU.
(5) Factor a block-tridiagonal nonsingular M-matrix by block LU.
(6) Factor a large unstructured matrix with the configured sparse backend.
(7) Factor \(A\) in float, keeping \(A\) in double for refinement.
(8) No-pivot LU of R, corrected from previous when few slots differ.
(9) Block LU of R, copying the unchanged prefix of previous.
Exceptions¶
std::invalid_argument: IfAis not square.std::runtime_error: If a pivot is zero.