Expand description
Unified tensor factorization module.
This module provides a unified factorize() function that dispatches to
SVD, QR, LU, or CI (Cross Interpolation) algorithms based on options.
§Note
This module works with concrete types (DynIndex, TensorDynLen) only.
Generic tensor types are not supported.
§Example
use tensor4all_core::{factorize, Canonical, DynIndex, FactorizeOptions, TensorDynLen};
let i = DynIndex::new_dyn(2);
let j = DynIndex::new_dyn(2);
let tensor = TensorDynLen::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.