linalg::factor::lu
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.
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);
The order
n.The unit lower factor
L.The upper factor
U.The row order: row
iofP Ais rowperm()[i]ofA.The permutation matrix
P(P A = L U).det(A): the product ofU's diagonal, signed byP.
Sourcepub fn solve<B: Rhs<T>>(§self, b: B) throws (LinalgError) -> B xwithA x = b;bis a vector or a matrix of columns. ThrowsSingularfor a zero pivot.
Sourcepub fn inv(§self) throws (LinalgError) -> Matrix<T> A^-1. ThrowsSingularfor a zero pivot.
Sourcepub fn solve_adjoint<B: Rhs<T>>(§self, b: B) throws (LinalgError) -> B A^H x = b(A^T x = bfor a real matrix).