packages

linalg::factor::lu

On this page

LU with partial pivoting, blocked right-looking (LAPACK's xGETRF): a panel of NB columns is factored with row pivoting (largest |re| + |im| in the column), then the block row is solved and the trailing matrix updated by one gemm, where most of the flops go. Backward stable in practice (growth factor bound 2^(n-1), rarely above 10); O(2n^3/3).

Structs

LuSource

pub struct Lu<T>

P A = L U of a square matrix: L unit lower, U upper, P a row permutation. Build it with linalg::lu.

nabi
use core::array::Matrix;

let a: Matrix<f64> = [[4, 3], [6, 3]];
let f = try linalg::lu(a);
assert(f.perm() == [1, 0]);
let x = try f.solve(core::array::Vector::<f64>::from([10.0, 12.0]));
assert(x[0] == 1.0 && x[1] == 2.0);
  • pub fn n(self) -> usize§

    Source

    The order n.

  • pub fn l(self) -> Matrix<T>§

    Source

    The unit lower factor L.

  • pub fn u(self) -> Matrix<T>§

    Source

    The upper factor U.

  • pub fn perm(self) -> List<usize>§

    Source

    The row order: row i of P A is row perm()[i] of A.

  • pub fn p(self) -> Matrix<T>§

    Source

    The permutation matrix P (P A = L U).

  • pub fn det(self) -> T§

    Source

    det(A): the product of U's diagonal, signed by P.

  • pub fn solve<B: Rhs<T>>(self, b: B) throws (LinalgError) -> B§

    Source

    x with A x = b; b is a vector or a matrix of columns. Throws Singular for a zero pivot.

  • pub fn inv(self) throws (LinalgError) -> Matrix<T>§

    Source

    A^-1. Throws Singular for a zero pivot.

  • pub fn solve_adjoint<B: Rhs<T>>(self, b: B) throws (LinalgError) -> B§

    Source

    A^H x = b (A^T x = b for a real matrix).