linalg::factor::qr
Householder QR (LAPACK's xGEQRF / xGEQP3 conventions): step k turns column k below the diagonal into zeros with H_k = I - tau v v^H, v[k] = 1, keeping v below R. Column pivoting moves the column of largest remaining norm to the front first; the norms are downdated and recomputed when cancellation makes them unreliable. Backward stable; O(2mn^2 - 2n^3/3).
Structs
QrSource
pub struct Qr<T>A P = Q R of an m x n matrix: Q unitary (orthogonal for real
input), R upper triangular, P a column permutation (the identity
unless built with qr_pivoted).
use core::array::Matrix;
let a: Matrix<f64> = [[3, 1], [4, 2]];
let f = try linalg::qr(a);
let r = f.r();
assert((r[0, 0].abs() - 5.0).abs() < 1e-12);
The thin
Q: m x min(m, n), orthonormal columns.The full
Q: m x m, unitary.R: min(m, n) x n, upper triangular. With pivoting its diagonal falls in magnitude.The column order: column
jofA Pis columnperm()[j]ofA.
Sourcepub fn solve<B: Rhs<T>>(§self, b: B) throws (LinalgError) -> B The least-squares solution of
A x = b(the exact one when A is square), for m >= n and full column rank. ThrowsSingularwhen a diagonal entry ofRis zero; uselstsqfor rank-deficient A.