Stack overview
The tensor4all Rust stack
A family of Rust libraries for tensor networks (quantics tensor trains, tensor cross interpolation, tree tensor networks) and the dense tensor backend they run on. This page shows how the pieces fit together and where to start reading.
Status as of 2026-10-13. The stack moves quickly; each repository's README is the source of truth.
For tensor network users
You want to compress a function into a QTT, run TCI, apply Fourier or shift operators, or contract tree tensor networks. You may be coming from the Julia packages. This guide maps what you know onto the Rust crates and tells you which entry point to use.
Read the user guide →For backend developers
You care about what happens below the algorithms: tensor contraction, batched linear algebra, execution contexts, C ABIs. Quantum chemistry codes that need fast strided contractions are a target audience. This guide goes down to tcontract and tlinalg.
Read the backend guide →The layer map
Each layer depends only on layers below it. Boxes link to the repository or its documentation. hataori sits beside the stack: it does not compute anything itself, it owns processes and threads and lends them to the layers that do.
The layers in brief
- Frontends. Rust programs use tensor4all-rs directly as a git dependency. Tensor4all.jl is a Julia frontend over the C API, maintained on a best effort basis for light use and teaching. A thin Python prototype (
tensor4all-py) also exists. - tensor4all-rs. The algorithms: tensor trains, TCI, quantics grids and operators, tree tensor networks, patching, HDF5 I/O. It holds two stacks on purpose (a TT and TCI stack and a network stack) with an explicit bridge between them.
- tenferro-rs. The tensor runtime: typed and dynamic tensors, eager and traced automatic differentiation, and CPU, GPU and XLA backends. tensor4all-rs reaches it through one adapter crate.
- Providers. Tensor-free numerical libraries that tenferro calls: cpueinsum for N-ary einsum, tcontract for binary contraction over arbitrary strides, and tlinalg for batched factorizations. They take borrowed strided views and an explicit execution context, so they are usable on their own, including from C.
- Foundation. strided-rs defines the strided view types every layer above passes around; faer and, optionally, a vendor BLAS and LAPACK do the dense arithmetic. tensor4all develops its own fork of faer, published as
t4a-faer, which carries strided and batched entry points, caller-owned workspaces, an explicit thread policy and fixes that upstream does not have. - hataori-rs. Data-parallel map and pmap over serial, Rayon, MPI and hybrid execution. Since no layer in the stack owns a global thread pool, hataori is where pools and MPI ranks come from.
Repositories and release status
Several layers are not on crates.io yet. Where a crate is unpublished, use it as a git dependency pinned to a revision.
| Repository | Role | Release | Docs |
|---|---|---|---|
| tensor4all-rs | TT, TCI, QTT, tree tensor networks, C API | git only | user guide |
| quanticsgrids-rs | quantics grids and coordinate conversion | crates.io 0.1.0 main is ahead | README |
| Tensor4all.jl | Julia frontend, best effort | git only | README |
| tenferro-rs | tensor runtime, autodiff, backends | crates.io 0.7.1 main is ahead | docs |
| computegraph-rs | graph IR used by traced AD | crates.io 0.1.0 | rustdoc |
| cpueinsum-rs | N-ary einsum with caller-supplied order | git only | README |
| tcontract-rs | binary strided contraction, TAPP C ABI | git only | README |
| tlinalg-rs | batched SVD, QR, LU, Cholesky, eigensolvers | git only | README |
| strided-rs | strided view types, permutation, kernels | crates.io 0.4.8 | README |
| t4a-faer | tensor4all fork of faer by Sarah Quinones, tuned for the stack | crates.io t4a-faer 0.24.4 | PATCHSET.md |
| hataori-rs | map and pmap over Rayon and MPI | git only | docs |
Benchmarks are kept in separate repositories so results can be keyed by commit and hardware: tenferro-benchmark, tcontract-benchmark, tlinalg-benchmark and tensor4all-benchmark.
Three ideas that run through every layer
- Explicit execution. No library in the stack starts a hidden global thread pool or changes behavior through environment variables. The caller creates a context (a Rayon pool, a backend, scratch memory) and passes it down. This is what lets an MPI program, a Julia session and a Rust test share one machine predictably.
- Tensor-free providers. The numerical kernels (tcontract, tlinalg) do not know about tensor types. They take borrowed strided views. The host above them owns allocation, dtype dispatch and placement. That keeps them small, testable on plain buffers and reusable from other codes.
- One shared vocabulary. All CPU layers exchange strided-rs views. A view made by tenferro can be handed to tcontract or tlinalg without conversion, which is why the whole stack pins the same strided-rs release.