pub struct TtDecomposition {
pub cores: Vec<Tensor>,
}Expand description
Tensor-Train (TT) decomposition result.
Represents a tensor as a chain of 3D cores:
X(i_1, ..., i_N) = G_1(i_1) · G_2(i_2) · ... · G_N(i_N)
where each G_k(i_k) is an r_{k-1} × r_k matrix slice, and
core k has shape r_{k-1} × n_k × r_k.
Fields§
§cores: Vec<Tensor>TT-cores, each a 3D tensor of shape [r_{k-1}, n_k, r_k].
Implementations§
Source§impl TtDecomposition
impl TtDecomposition
Sourcepub fn ranks(&self) -> Vec<usize>
pub fn ranks(&self) -> Vec<usize>
Returns the TT-ranks [r_0, r_1, ..., r_N] where r_0 = r_N = 1.
Sourcepub fn reconstruct(&self) -> SolverResult<Tensor>
pub fn reconstruct(&self) -> SolverResult<Tensor>
Reconstructs the full tensor from TT-cores.
Sourcepub fn fit_error(&self, original: &Tensor) -> SolverResult<f64>
pub fn fit_error(&self, original: &Tensor) -> SolverResult<f64>
Computes the relative fit error: ||X - X_hat|| / ||X||.
Sourcepub fn compression_ratio(&self, original_shape: &[usize]) -> f64
pub fn compression_ratio(&self, original_shape: &[usize]) -> f64
Compression ratio: original elements / decomposition elements.
Sourcepub fn tt_round(&self, max_rank: usize) -> SolverResult<TtDecomposition>
pub fn tt_round(&self, max_rank: usize) -> SolverResult<TtDecomposition>
TT-rounding: truncates TT-ranks to at most max_rank.
Performs left-to-right QR orthogonalization, then right-to-left truncated SVD to reduce ranks.
Trait Implementations§
Source§impl Clone for TtDecomposition
impl Clone for TtDecomposition
Source§fn clone(&self) -> TtDecomposition
fn clone(&self) -> TtDecomposition
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 TtDecomposition
impl RefUnwindSafe for TtDecomposition
impl Send for TtDecomposition
impl Sync for TtDecomposition
impl Unpin for TtDecomposition
impl UnsafeUnpin for TtDecomposition
impl UnwindSafe for TtDecomposition
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