pub struct TensorTrain {
pub cores: Vec<TTCore>,
pub shape: Vec<usize>,
pub ranks: Vec<usize>,
}Expand description
Tensor Train representation
Fields§
§cores: Vec<TTCore>TT-cores
shape: Vec<usize>Original tensor shape
ranks: Vec<usize>TT-ranks: [1, r1, r2, …, r_{d-1}, 1]
Implementations§
Source§impl TensorTrain
impl TensorTrain
Sourcepub fn from_cores(cores: Vec<TTCore>) -> Self
pub fn from_cores(cores: Vec<TTCore>) -> Self
Create TT from cores
Sourcepub fn from_vectors(vectors: Vec<Vec<f64>>) -> Self
pub fn from_vectors(vectors: Vec<Vec<f64>>) -> Self
Create rank-1 TT from vectors
Sourcepub fn to_dense(&self) -> DenseTensor
pub fn to_dense(&self) -> DenseTensor
Convert to dense tensor
Sourcepub fn dot(&self, other: &TensorTrain) -> f64
pub fn dot(&self, other: &TensorTrain) -> f64
Dot product of two TTs
Sourcepub fn frobenius_norm(&self) -> f64
pub fn frobenius_norm(&self) -> f64
Frobenius norm: ||A||_F = sqrt(<A, A>)
Sourcepub fn add(&self, other: &TensorTrain) -> TensorTrain
pub fn add(&self, other: &TensorTrain) -> TensorTrain
Add two TTs (result has rank r1 + r2)
Sourcepub fn scale(&self, alpha: f64) -> TensorTrain
pub fn scale(&self, alpha: f64) -> TensorTrain
Scale by a constant
Sourcepub fn from_dense(tensor: &DenseTensor, config: &TensorTrainConfig) -> Self
pub fn from_dense(tensor: &DenseTensor, config: &TensorTrainConfig) -> Self
TT-SVD decomposition from dense tensor
Trait Implementations§
Source§impl Clone for TensorTrain
impl Clone for TensorTrain
Source§fn clone(&self) -> TensorTrain
fn clone(&self) -> TensorTrain
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 TensorTrain
impl RefUnwindSafe for TensorTrain
impl Send for TensorTrain
impl Sync for TensorTrain
impl Unpin for TensorTrain
impl UnwindSafe for TensorTrain
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