Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

tensor4all-simplett

Simple, efficient Tensor Train (MPS) implementation for numerical computation.

Key Types

  • TensorTrain — basic MPS with f64 and Complex64 support
  • SiteTensorTrain — center-canonical MPS with specified orthogonality center
  • VidalTensorTrain — Vidal canonical form with explicit singular values
  • CompressionOptions — controls tolerance and maximum bond dimension for compression

Example

use tensor4all_simplett::{AbstractTensorTrain, CompressionOptions, TensorTrain};

// Create a constant tensor train (all entries = 1.0) over a 2x3x4 grid
let tt = TensorTrain::<f64>::constant(&[2, 3, 4], 1.0);

// Evaluate at a specific multi-index
let value = tt.evaluate(&[0, 1, 2])?;
assert!((value - 1.0).abs() < 1e-15);

// Sum over all indices: 2 * 3 * 4 = 24
let total = tt.sum();
assert!((total - 24.0).abs() < 1e-10);

// Compress with tolerance
let options = CompressionOptions {
    tolerance: 1e-10,
    max_bond_dim: 20,
    ..Default::default()
};
let compressed = tt.compressed(&options)?;
assert!(compressed.rank() <= tt.rank());

Documentation