Skip to main content

qr_pivoting

Function qr_pivoting 

Source
pub fn qr_pivoting<B: Backend, T: LinalgScalar>(
    x: &Array<B, T>,
    full_matrices: bool,
) -> (Array<B, T>, Array<B, T>, Array<B, i32>)
Expand description

The QR decomposition with column pivoting of each matrix, as lax.linalg.qr(x, pivoting=True): (q, r, p) with x[..., p] = q r, where the permutation p (i32[..., n]) moves the columns of largest remaining norm forward, as LAPACK’s geqp3, so that the magnitudes of the diagonal of r do not increase (rank-revealing). The shapes of q and r are those of qr.

§Examples

use ruxla_core::{Array, Native, lax};

let a = Array::<Native, f64>::from_vec(vec![1.0, 3.0, 0.0, 4.0], [2, 2]);
let (_, r, p) = lax::linalg::qr_pivoting(&a, false);
assert_eq!(p.to_vec(), [1, 0]);
assert_eq!(r.to_vec()[0], -5.0);

§Panics

Panics if x is not a batch of matrices.