qr

Function qr 

Source
pub fn qr<T: KernelLinalgScalar, C>(
    ctx: &mut C,
    tensor: &Tensor<T>,
) -> Result<QrResult<T>>
where C: TensorLinalgContextFor<T>, C::Backend: 'static,
Expand description

Compute the QR decomposition of a batched matrix.

Input shape: (m, n, *).

The function internally normalizes input to column-major contiguous layout. If the input is not already contiguous, an internal copy is performed.

§Examples

use tenferro_device::LogicalMemorySpace;
use tenferro_linalg::qr;
use tenferro_prims::CpuContext;
use tenferro_tensor::{MemoryOrder, Tensor};

let mut ctx = CpuContext::new(1);
let a = Tensor::<f64>::zeros(
    &[4, 3],
    LogicalMemorySpace::MainMemory,
    MemoryOrder::ColumnMajor,
).unwrap();
let _result = qr(&mut ctx, &a).unwrap();

§Errors

Returns an error if the input has fewer than 2 dimensions.