pub fn lu<B: Backend, T: LinalgScalar>(
x: &Array<B, T>,
) -> (Array<B, T>, Array<B, i32>, Array<B, i32>)Expand description
The LU factorization with partial pivoting of each matrix, as
lax.linalg.lu: the factors (L below the diagonal, with an implicit
unit diagonal, and U), the pivots (i32[..., min(m, n)]: row i was
swapped with row pivots[i]), and the permutation (i32[..., m]), with
a[perm] = L U.
§Panics
Panics if x is not a batch of matrices.
§Examples
use ruxla_core::{Array, Native, lax};
let a = Array::<Native, f64>::from_vec(vec![1.0, 2.0, 4.0, 2.0], [2, 2]);
let (lu, pivots, perm) = lax::linalg::lu(&a);
assert_eq!(lu.to_vec(), [4.0, 2.0, 0.25, 1.5]);
assert_eq!(pivots.to_vec(), [1, 1]);
assert_eq!(perm.to_vec(), [1, 0]);