[][src]Module smartcore::linalg::qr

QR factorization that factors a matrix into a product of an orthogonal matrix and an upper triangular matrix.

QR Decomposition

Any real square matrix \(A \in R^{n \times n}\) can be decomposed as a product of an orthogonal matrix \(Q\) and an upper triangular matrix \(R\):

\[A = QR\]

Example:

use smartcore::linalg::naive::dense_matrix::*;
use smartcore::linalg::qr::*;

let A = DenseMatrix::from_2d_array(&[
                &[0.9, 0.4, 0.7],
                &[0.4, 0.5, 0.3],
                &[0.7, 0.3, 0.8]
        ]);

let qr = A.qr().unwrap();
let orthogonal: DenseMatrix<f64> = qr.Q();
let triangular: DenseMatrix<f64> = qr.R();

References:

Structs

QR

Results of QR decomposition.

Traits

QRDecomposableMatrix

Trait that implements QR decomposition routine for any matrix.