Skip to main content

Module algorithm

Module algorithm 

Source
Expand description

Algorithm selection types for tensor train operations.

This module provides enums for selecting algorithms in various tensor train operations. These types are designed to be FFI-friendly (representable as C integers).

§Design Philosophy

Following ITensors.jl’s pattern, algorithms are represented as static types. Unlike ITensors.jl which uses symbol-based dispatch (Algorithm"svd"), we use Rust enums for:

  • Compile-time exhaustiveness checking
  • Easy FFI mapping to C integers
  • Clear documentation of available algorithms

§Example

use tensor4all_treetn::algorithm::{ContractionAlgorithm, CanonicalForm};

// Select contraction algorithm
let alg = ContractionAlgorithm::ZipUp;

// Select canonical form
let form = CanonicalForm::Unitary;

Enums§

CanonicalForm
Canonical form for tensor train / tree tensor network.
CompressionAlgorithm
Algorithm for tensor train compression.
ContractionAlgorithm
Algorithm for tensor train contraction (TT-TT or MPO-MPO).