Expand description
Tensor Train (MPS) library for numerical tensor networks.
A tensor train (TT), also known as a Matrix Product State (MPS), decomposes a high-dimensional tensor into a chain of rank-3 cores:
T[i0, i1, ..., iL-1] = A0[i0] * A1[i1] * ... * A_{L-1}[i_{L-1}]where each Ak[ik] is a matrix of shape (r_{k-1}, r_k) and the
bond dimensions r_k control the approximation accuracy.
§Main types
| Type | Purpose |
|---|---|
TensorTrain | Primary tensor train container |
AbstractTensorTrain | Common interface (evaluate, sum, norm) |
CompressionOptions | Controls compression accuracy/cost trade-off |
TTCache | Caches partial contractions for repeated evaluation |
SiteTensorTrain | Center-canonical form for sweeping algorithms |
VidalTensorTrain | Vidal canonical form with explicit singular values |
Tensor3 / Tensor3Ops | Rank-3 core tensors and their operations |
§Typical workflow
use tensor4all_simplett::{TensorTrain, AbstractTensorTrain, CompressionOptions};
// 1. Create a tensor train (e.g. constant function)
let tt = TensorTrain::<f64>::constant(&[2, 3, 2], 1.0);
assert_eq!(tt.len(), 3);
// 2. Evaluate at a specific multi-index
let value = tt.evaluate(&[0, 1, 1]).unwrap();
assert!((value - 1.0).abs() < 1e-12);
// 3. Sum over all indices: 1.0 * 2 * 3 * 2 = 12.0
let sum = tt.sum();
assert!((sum - 12.0).abs() < 1e-10);
// 4. Compress to reduce bond dimensions
let compressed = tt.compressed(&CompressionOptions::default()).unwrap();
let val2 = compressed.evaluate(&[0, 1, 1]).unwrap();
assert!((val2 - 1.0).abs() < 1e-10);Re-exports§
pub use cache::TTCache;pub use canonical::center_canonicalize;pub use canonical::SiteTensorTrain;pub use compression::CompressionMethod;pub use compression::CompressionOptions;pub use contraction::dot;pub use contraction::ContractionOptions;pub use error::Result;pub use error::TensorTrainError;pub use tensortrain::TensorTrain;pub use traits::AbstractTensorTrain;pub use traits::TTScalar;pub use types::tensor3_from_data;pub use types::tensor3_zeros;pub use types::LocalIndex;pub use types::MultiIndex;pub use types::Tensor3;pub use types::Tensor3Ops;pub use vidal::DiagMatrix;pub use vidal::InverseTensorTrain;pub use vidal::VidalTensorTrain;
Modules§
- arithmetic
- Arithmetic operations for tensor trains
- cache
- Cached tensor train evaluation
- canonical
- Canonical forms for tensor trains
- compression
- Compression algorithms for tensor trains
- contraction
- Contraction operations for tensor trains
- error
- Error types for tensor train operations
- mpo
- MPO (Matrix Product Operator) contraction algorithms
- tensor
- Fixed-rank tensor type backed by
tenferro_tensor::TypedTensor<T>. - tensortrain
- TensorTrain implementation
- traits
- Abstract traits for tensor train objects
- types
- Core types for tensor train operations
- vidal
- Vidal and Inverse tensor train representations