trainsum – A Python package for quantics tensor trains

Paul Haubenwallner, Matthias Heller · SciPost Physics Codebases · 2026

We present trainsum, a Python package for computations with multidimensional quantics tensor trains. The package enables efficient approximation of tensors and functions by tensor trains, regardless of their shape or dimensionality, and supports analytic constructions of important objects, such as polynomials and Fourier transforms. Once represented in tensor train format, trainsum provides standard arithmetic operations, including addition, multiplication, and element-wise transformations. An Einstein-summation interface, closely aligned with NumPy’s einsum, enables concise specification of complex tensor train contractions and linear solvers. With support for multiple CPU and GPU backends (NumPy, CuPy, PyTorch), trainsum serves as a general-purpose framework for constructing and manipulating high-dimensional tensor representations in applications such as numerical simulation, data compression, machine learning, and data analysis.

Read the paper · More papers on PaperTik