Skip to content

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)

mixed_lu lu(const mat<real> &A, mixed_precision_structure);  // (6)

corrected_lu lu(const spmat &R, no_pivot_structure, const corrected_lu *previous,
                view<const idx> changed);  // (7)

suffix_block_lu lu(const spmat &R, block_structure structure,
                   const suffix_block_lu *previous, view<const idx> changed);  // (8)

(1) Factor a band matrix by LU with partial pivoting: \(P A = L U\). Pass an rvalue to factor in place.

(2) Factor a matrix by LU with partial pivoting: \(P A = L U\). Uses LAPACK above lapack_factor_threshold in double precision.

(3) Factor a matrix by LU without pivoting: \(A = L U\).

(4) Factor a sparse M-matrix by LU without pivoting: \(A = L U\).

(5) Factor a block tridiagonal M-matrix by block LU: \(P A P^T = \mathcal{L} \mathcal{U}\).

(6) Factor a matrix by LU in single precision, keeping it in double for refinement: \(P A = L U\).

(7) Factor by LU without pivoting, correcting the previous factor if few rows changed: \(A = L U\).

(8) Factor by block LU, reusing the unchanged leading blocks of previous.

Exceptions

  • std::invalid_argument: If A is not square.
  • std::runtime_error: If a pivot is zero.

Warning

Small pivots go unchecked; use only when the structure keeps pivots nonzero, as for diagonally dominant M-matrices.

Notes

A singular A sets singular; the factorization still completes.