pub struct SvdResult<T: Scalar, R: Scalar = T> {
pub u: Tensor<T>,
pub s: Tensor<R>,
pub vt: Tensor<T>,
}Expand description
SVD result: A = U * diag(S) * Vt.
For an input of shape (m, n, *) with k = min(m, n):
u: shape(m, k, *)s: shape(k, *)in descending ordervt: shape(k, n, *)
§Examples
use tenferro_device::LogicalMemorySpace;
use tenferro_linalg::svd;
use tenferro_prims::CpuContext;
use tenferro_tensor::{MemoryOrder, Tensor};
let mut ctx = CpuContext::new(1);
let a = Tensor::<f64>::zeros(
&[3, 4],
LogicalMemorySpace::MainMemory,
MemoryOrder::ColumnMajor,
).unwrap();
let result = svd(&mut ctx, &a, None).unwrap();
assert_eq!(result.s.ndim(), 1);Fields§
§u: Tensor<T>Left singular vectors. Shape: (m, k, *).
s: Tensor<R>Singular values. Shape: (k, *).
vt: Tensor<T>Right singular vectors (conjugate-transposed). Shape: (k, n, *).
Trait Implementations§
Auto Trait Implementations§
impl<T, R> Freeze for SvdResult<T, R>
impl<T, R = T> !RefUnwindSafe for SvdResult<T, R>
impl<T, R> Send for SvdResult<T, R>
impl<T, R> Sync for SvdResult<T, R>
impl<T, R> Unpin for SvdResult<T, R>
impl<T, R = T> !UnwindSafe for SvdResult<T, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more