lu_factor

Function lu_factor 

pub fn lu_factor<T, C>(
    ctx: &mut C,
    tensor: &Tensor<T>,
) -> Result<LuFactorResult<T>, Error>
Expand description

Compute the packed LU factorization of a batched matrix.

ยงExamples

use tenferro_linalg::lu_factor;
use tenferro_prims::CpuContext;
use tenferro_tensor::{MemoryOrder, Tensor};

let mut ctx = CpuContext::new(1);
let col = MemoryOrder::ColumnMajor;
let a = Tensor::<f64>::from_slice(&[2.0, 1.0, 1.0, 3.0], &[2, 2], col).unwrap();
let result = lu_factor(&mut ctx, &a).unwrap();
assert_eq!(result.factors.dims(), &[2, 2]);
assert_eq!(result.pivots.len(), 2);