Skip to main content

pyTensorlab

pyTensorlab is a Python package for tensor computations and complex optimization. The packages provides the following:

  • data types to represent sparse, incomplete, structured and decomposed tensors efficiently;
  • tools to generate and work with these data types effectively and efficiently;
  • algorithms for computing the canonical polyadic decomposition, the multilinear singular value decomposition, the Tucker decomposition or low multilinear rank approximation and the tensor-train decomposition;
  • tensorization techniques relying on statistics or Hankelization;
  • visualization routines;
  • preconditioned Gauss-Newton type optimization methods for complex variables;
  • fully typed code, which facilitates development.

pyTensorlab is a reimplementation of the Matlab toolbox Tensorlab. Currently, the feature set is not identical. The Matlab toolbox also supports block term decompositions and has a structured data fusion framework which relies on a domain specific language to easily model coupled matrix and tensor decompositions and prior knowledge. On the other hand, pyTensorlab provides basic support for the TT decomposition and a more complete set of complex Gauss-Newton type optimization algorithms.

Getting Started

To install pyTensorlab, use:

$ pip install pytensorlab

pyTensorlab requires Python 3.10 to take advantage of new typing features. NumPy, SciPy and Numba for underly the main computations. Pymanopt is used for manifold-based optimization for low multilinear rank approximation and Vedo for visualization.

As an example, the canonical polyadic decomposition of a noisy rank-3 tensor can be computed as follows:

>>> import pytensorlab as tl
>>> import numpy as np
>>> shape = (10, 11, 12)
>>> Tpd = tl.PolyadicTensor.random(shape, 3)
>>> Tn = tl.noisy(np.array(Tpd), snr=20)
>>> Tres, info = tl.cpd(Tn, nterm=3)

Citation

If you are using pyTensorlab, please consider citing:

N. Vervliet, S. Hendrikx, R. Widdershoven, N. Govindarajan, S. Sofi, L. De Lathauwer, "pyTensorlab 2025.10," Oct. 2025. Available online at www.pytensorlab.net.

Contributors

We would like to thank all contributors:

  • Ayvaz, Muzaffer
  • Boussé, Martijn
  • De Lathauwer, Lieven
  • Devogel, Andreas
  • Govindarajan, Nithin
  • Hendrikx, Stijn
  • Iannacito, Martina
  • Seeuws, Nick
  • Sofi, Shakir
  • Vermeylen, Charlotte
  • Vervliet, Nico
  • Widdershoven, Raphaël

Metadata

Release files for pyTensorlab 2025.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyTensorlab 2025.12.0
File Size Uploaded
pytensorlab-2025.12.0.tar.gz 219.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyTensorlab 2025.12.0
File Interpreter ABI Platform
pytensorlab-2025.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 473.9 kB

Release files / pytensorlab-2025.12.0.tar.gz

Download URL pytensorlab-2025.12.0.tar.gz
Size 219.7 kB
Tags Source
SHA-256 checksum
How to use checksums
37c66348dbd271eb23ef39aa6607636b7a26274f07fd6f66fc3339801e807d34
BLAKE2b-256 checksum
How to use checksums
f6108ddb7cd7f5d45427108a75a4a82976c9431f174b33ec6043108eae2e2d03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.9.13 Linux/5.4.0-216-generic

Release files / pytensorlab-2025.12.0-py3-none-any.whl

Download URL pytensorlab-2025.12.0-py3-none-any.whl
Size 254.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
229b0d55cb81b44627fcd0fe7216e2f44b4c496ddb9ab039f8657bdfee10f0d0
BLAKE2b-256 checksum
How to use checksums
9ab485fdd8a71c61e4936540406d37400fd489b9f733234a698ec27c1f9cde61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.9.13 Linux/5.4.0-216-generic
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page