pub struct CPDecomposition {
pub weights: Vec<f64>,
pub factors: Vec<Vec<f64>>,
pub shape: Vec<usize>,
pub rank: usize,
}Expand description
CP decomposition result
Fields§
§weights: Vec<f64>Weights λ_r
factors: Vec<Vec<f64>>Factor matrices A_k[n_k × R]
shape: Vec<usize>Original shape
rank: usizeRank R
Implementations§
Source§impl CPDecomposition
impl CPDecomposition
Sourcepub fn als(tensor: &DenseTensor, config: &CPConfig) -> Self
pub fn als(tensor: &DenseTensor, config: &CPConfig) -> Self
Compute CP decomposition using ALS (Alternating Least Squares)
Sourcepub fn to_dense(&self) -> DenseTensor
pub fn to_dense(&self) -> DenseTensor
Reconstruct tensor
Sourcepub fn compression_ratio(&self) -> f64
pub fn compression_ratio(&self) -> f64
Compression ratio
Sourcepub fn relative_error(&self, tensor: &DenseTensor) -> f64
pub fn relative_error(&self, tensor: &DenseTensor) -> f64
Fit error (relative Frobenius norm)
Trait Implementations§
Source§impl Clone for CPDecomposition
impl Clone for CPDecomposition
Source§fn clone(&self) -> CPDecomposition
fn clone(&self) -> CPDecomposition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CPDecomposition
impl RefUnwindSafe for CPDecomposition
impl Send for CPDecomposition
impl Sync for CPDecomposition
impl Unpin for CPDecomposition
impl UnwindSafe for CPDecomposition
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