pub fn svd<T: Scalar>(
_tensor: &Tensor<T>,
_options: Option<&SvdOptions>,
) -> Result<SvdResult<T>>Expand description
Compute the SVD of a batched matrix.
Input shape: (m, n, *). Must be column-major contiguous.
§Arguments
tensor— Input tensor of shape(m, n, *)options— Optional truncation parameters
§Examples
ⓘ
use tenferro_linalg::{svd, SvdOptions};
use tenferro_tensor::{Tensor, MemoryOrder};
use tenferro_device::LogicalMemorySpace;
let col = MemoryOrder::ColumnMajor;
let a = Tensor::<f64>::zeros(&[3, 4],
LogicalMemorySpace::MainMemory, col);
// Full SVD
let result = svd(&a, None).unwrap();
// Truncated SVD
let opts = SvdOptions { max_rank: Some(2), cutoff: None };
let result = svd(&a, Some(&opts)).unwrap();§Errors
Returns an error if the input has fewer than 2 dimensions.