pub struct InverseTensorTrain<T: TTScalar> { /* private fields */ }Expand description
Inverse Tensor Train representation
Similar to VidalTensorTrain but stores inverse singular values instead. This is useful for algorithms that need to efficiently apply inverse operations during local updates.
§Examples
use tensor4all_simplett::{TensorTrain, AbstractTensorTrain, InverseTensorTrain};
// Build a simple tensor train and convert to inverse form.
let tt = TensorTrain::<f64>::constant(&[2, 3], 1.0);
let inv = InverseTensorTrain::from_tensor_train(&tt).unwrap();
assert_eq!(inv.len(), 2);
// Converting back preserves tensor train values.
let tt2 = inv.to_tensor_train();
let val = tt2.evaluate(&[0, 1]).unwrap();
assert!((val - 1.0).abs() < 1e-12);
// The sum is also preserved: 1.0 * 2 * 3 = 6.0
assert!((tt2.sum() - 6.0).abs() < 1e-10);Implementations§
Source§impl<T: TTScalar + Scalar + Default> InverseTensorTrain<T>
impl<T: TTScalar + Scalar + Default> InverseTensorTrain<T>
Sourcepub fn from_vidal(vidal: &VidalTensorTrain<T>) -> Result<Self>
pub fn from_vidal(vidal: &VidalTensorTrain<T>) -> Result<Self>
Create an InverseTensorTrain from a VidalTensorTrain
Sourcepub fn from_tensor_train(tt: &TensorTrain<T>) -> Result<Self>where
T: ComplexFloat + BackendLinalgScalar + Copy + 'static,
<T as TensorScalar>::Real: TensorScalar + ToPrimitive,
pub fn from_tensor_train(tt: &TensorTrain<T>) -> Result<Self>where
T: ComplexFloat + BackendLinalgScalar + Copy + 'static,
<T as TensorScalar>::Real: TensorScalar + ToPrimitive,
Create an InverseTensorTrain from a regular TensorTrain
Sourcepub fn inverse_singular_values(&self, i: usize) -> &DiagMatrix
pub fn inverse_singular_values(&self, i: usize) -> &DiagMatrix
Get the inverse singular values between sites i and i+1
Sourcepub fn all_inverse_singular_values(&self) -> &[DiagMatrix] ⓘ
pub fn all_inverse_singular_values(&self) -> &[DiagMatrix] ⓘ
Get all inverse singular value matrices
Sourcepub fn site_tensors_mut(&mut self) -> &mut [Tensor3<T>] ⓘ
pub fn site_tensors_mut(&mut self) -> &mut [Tensor3<T>] ⓘ
Get mutable access to site tensors
Sourcepub fn set_two_site_tensors(
&mut self,
i: usize,
tensor1: Tensor3<T>,
inv_sv: DiagMatrix,
tensor2: Tensor3<T>,
) -> Result<()>
pub fn set_two_site_tensors( &mut self, i: usize, tensor1: Tensor3<T>, inv_sv: DiagMatrix, tensor2: Tensor3<T>, ) -> Result<()>
Set two adjacent site tensors along with their inverse singular values
Sourcepub fn to_tensor_train(&self) -> TensorTrain<T>
pub fn to_tensor_train(&self) -> TensorTrain<T>
Convert to a regular TensorTrain
Trait Implementations§
Source§impl<T: TTScalar + Scalar + Default> AbstractTensorTrain<T> for InverseTensorTrain<T>
impl<T: TTScalar + Scalar + Default> AbstractTensorTrain<T> for InverseTensorTrain<T>
Source§impl<T: Clone + TTScalar> Clone for InverseTensorTrain<T>
impl<T: Clone + TTScalar> Clone for InverseTensorTrain<T>
Source§fn clone(&self) -> InverseTensorTrain<T>
fn clone(&self) -> InverseTensorTrain<T>
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<T> Freeze for InverseTensorTrain<T>
impl<T> RefUnwindSafe for InverseTensorTrain<T>where
T: RefUnwindSafe,
impl<T> Send for InverseTensorTrain<T>
impl<T> Sync for InverseTensorTrain<T>
impl<T> Unpin for InverseTensorTrain<T>where
T: Unpin,
impl<T> UnsafeUnpin for InverseTensorTrain<T>
impl<T> UnwindSafe for InverseTensorTrain<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more