pub struct CPDecomposition {
pub weights: FixedVector,
pub factors: Vec<FixedMatrix>,
}Expand description
CP (Canonical Polyadic) decomposition: T ≈ Σ_r λ_r a₁_r ∘ a₂_r ∘ … ∘ a_N_r
Decomposes a tensor into a sum of R rank-1 terms. Each term is an outer product of vectors, weighted by λ_r.
Fields§
§weights: FixedVectorComponent weights (R values).
factors: Vec<FixedMatrix>Factor matrices: factors[n] is d_n × R (columns are the rank-1 vectors).
Implementations§
Source§impl CPDecomposition
impl CPDecomposition
Sourcepub fn reconstruct(&self, shape: &[usize]) -> Tensor
pub fn reconstruct(&self, shape: &[usize]) -> Tensor
Reconstruct the full tensor from CP factors.
Auto Trait Implementations§
impl Freeze for CPDecomposition
impl RefUnwindSafe for CPDecomposition
impl Send for CPDecomposition
impl Sync for CPDecomposition
impl Unpin for CPDecomposition
impl UnsafeUnpin 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