Skip to main content

rrlu_mut

Function rrlu_mut 

Source
pub fn rrlu_mut<T: Scalar>(
    a: &mut Matrix<T>,
    options: Option<RrLUOptions>,
) -> Result<RrLU<T>>
Expand description

Perform in-place rank-revealing LU decomposition.

The input matrix a is modified in place. Use rrlu for a non-destructive version.

§Errors

Returns MatrixCIError::InvalidArgument if the matrix shape product overflows usize or its backing storage length does not match the shape. Returns MatrixCIError::NaNEncountered if NaN values appear in the L or U factors.

§Examples

use tensor4all_core::{matrixlu::rrlu_mut, RrLUOptions};
use tensor4all_tensorbackend::from_vec2d;

let mut m = from_vec2d(vec![
    vec![1.0_f64, 2.0],
    vec![3.0, 4.0],
]);
let lu = rrlu_mut(&mut m, Some(RrLUOptions { max_bond_dim: 1, ..Default::default() })).unwrap();
assert_eq!(lu.npivots(), 1);