Expand description
Unified tensor factorization module.
This module provides a unified factorize() function that dispatches to
SVD, RSVD, QR, LU, or CI (Cross Interpolation) algorithms based on options.
§Note
This module works with concrete types (DynIndex, IdxTensor) only.
Generic tensor types are not supported.
§Example
use tensor4all_core::{factorize, Canonical, DynIndex, FactorizeOptions, IdxTensor, TensorLike};
let i = DynIndex::new_dyn(2);
let j = DynIndex::new_dyn(2);
let tensor = IdxTensor::from_dense(
vec![i.clone(), j.clone()],
vec![1.0, 0.0, 0.0, 1.0],
)?;
let result = factorize(
&tensor,
std::slice::from_ref(&i),
&FactorizeOptions::svd().with_canonical(Canonical::Left),
)?;
assert_eq!(result.rank, 2);
assert_eq!(result.left.dims(), vec![2, 2]);Re-exports§
pub use crate::tensor_like::Canonical;pub use crate::tensor_like::FactorizeAlg;pub use crate::tensor_like::FactorizeError;pub use crate::tensor_like::FactorizeOptions;pub use crate::tensor_like::FactorizeResult;
Functions§
- factorize
- Factorize a tensor into left and right factors.
- factorize_
full_ rank - Factorize a tensor without applying algorithm-specific truncation options.
- factorize_
full_ rank_ in - Full-rank factorization in a caller-owned execution context.
- factorize_
full_ rank_ on_ session - Full-rank factorization on a caller-held explicit session.
- factorize_
in - Factorize a tensor in a caller-owned execution context.
- factorize_
on_ session - Factorize a tensor on a caller-held explicit session.
- factorize_
with_ rng - Factorize with a caller-owned RNG, preserving its stream across calls.
- factorize_
with_ rng_ in - Factorize with a continuous caller RNG in a caller-owned execution context.
- factorize_
with_ rng_ on_ session - Factorize on a caller-held plain session using a caller-owned RNG.