pub enum SvdDriver {
Auto,
Jacobi,
QrBased,
Polar,
}Expand description
Algorithm family used by SvdOptions.
A provider may ignore the selection and run its single SVD kernel; where a
selection is honoured it changes speed and numerical behavior, not the
decomposition contract, so gauge handling and AD rule selection are
unaffected. Self::Polar may perturb near-singular inputs. Equivalent to
jax.lax.linalg.svd(..., algorithm=...) and
torch.linalg.svd(..., driver=...).
§Examples
use tenferro_linalg::{SvdDriver, SvdOptions};
let options = SvdOptions::default().driver(SvdDriver::QrBased);
assert_eq!(options.driver, SvdDriver::QrBased);
assert_eq!(SvdOptions::default().driver, SvdDriver::Auto);Variants§
Auto
The provider’s default policy for this input.
Never selects Self::Polar: its small singular values are only
accurate to about 1e-6 of the largest, which an eps-scale
truncation cannot tolerate, so the accurate families stay the default
unless the caller opts in. A provider with one SVD kernel returns the
same factors for every selection.
On the CUDA provider this is the accuracy-preserving, JAX-compatible
rule: Self::Jacobi when both matrix dimensions are at most 1024,
otherwise Self::QrBased.
Jacobi
One-sided Jacobi rotations: the accurate family for small and medium
orders, and more work than Self::QrBased on large or wide spectra.
On the CUDA provider this selects cusolverDn<t>gesvdj.
QrBased
Bidiagonalization followed by an implicit-QR iteration: the general
purpose family, and the faster of the two accurate families on large
and wide spectra.
On the CUDA provider this selects cusolverDn<t>gesvd.
Polar
Polar decomposition: the fastest family for min(m, n) >= 256 on an
A100 (see the cuda_svd_driver benchmark), and the least accurate on
small singular values.
Explicit only: Self::Auto never selects it. Its small singular
values are only accurate to about 1e-6 of the largest, so do not use
it for an eps-scale truncation (a pseudoinverse or a tensor-network
truncation at 1e-12..1e-14): the perturbation can change the
retained rank. Accuracy is input-dependent rather than uniformly worse
than Self::QrBased: on ten-decade spectra built as U diag(s) Vᴴ it
was the most accurate of the three families on an A100, but on a
circulant-like matrix with the same spectrum it lost about two digits
against Self::QrBased. Measure on your own inputs before relying on
it for small singular values.
A provider that can bound its own perturbation returns a typed backend
failure instead of silently wrong factors when the bound is not small
relative to the largest singular value.
On the CUDA provider this selects cusolverDnXgesvdp.
Trait Implementations§
impl Copy for SvdDriver
impl Eq for SvdDriver
impl StructuralPartialEq for SvdDriver
Auto Trait Implementations§
impl Freeze for SvdDriver
impl RefUnwindSafe for SvdDriver
impl Send for SvdDriver
impl Sync for SvdDriver
impl Unpin for SvdDriver
impl UnsafeUnpin for SvdDriver
impl UnwindSafe for SvdDriver
Blanket Implementations§
impl<T> Boilerplate for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
impl<T, U> Imply<T> for U
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> ⓘ
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> ⓘ
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