Skip to main content

A Python package for tensor computations.

Project description

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. Hendrickx, 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
  • Hendrickx, Stijn
  • Iannacito, Martina
  • Seeuws, Nick
  • Sofi, Shakir
  • Vermeylen, Charlotte
  • Vervliet, Nico
  • Widdershoven, Raphaël

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytensorlab-2025.10.2b0.tar.gz (219.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytensorlab-2025.10.2b0-py3-none-any.whl (254.3 kB view details)

Uploaded Python 3

File details

Details for the file pytensorlab-2025.10.2b0.tar.gz.

File metadata

  • Download URL: pytensorlab-2025.10.2b0.tar.gz
  • Upload date:
  • Size: 219.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.9.13 Linux/5.4.0-216-generic

File hashes

Hashes for pytensorlab-2025.10.2b0.tar.gz
Algorithm Hash digest
SHA256 6e9130d63d94eae515945ab25915b08a83c36d8e1a372608b5b68f8377e788a6
MD5 f0cdccb2bb265e8f01e6358f5ec6b60a
BLAKE2b-256 fb206a72d312f0725cf7637a5b8a50bac05a0dddbc33b6776c094ad81fa9bb32

See more details on using hashes here.

File details

Details for the file pytensorlab-2025.10.2b0-py3-none-any.whl.

File metadata

  • Download URL: pytensorlab-2025.10.2b0-py3-none-any.whl
  • Upload date:
  • Size: 254.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.9.13 Linux/5.4.0-216-generic

File hashes

Hashes for pytensorlab-2025.10.2b0-py3-none-any.whl
Algorithm Hash digest
SHA256 063cf0e2432c7bc26f9dc43beedd05fa8a786605a57d8026a21af08149d99e74
MD5 5e84e42ee88ca00e23b3a090644a1cbc
BLAKE2b-256 2eef166c046d6516af66a7507702535adbb01a29d85d0ed82fa9be94a3b675fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page