Skip to main content
Copyright 2025 National Technology & Engineering Solutions of Sandia,
LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
U.S. Government retains certain rights in this software.

Regression tests Coverage Status pypi package image Ruff Code style: black

pyttb: Python Tensor Toolbox

Welcome to pyttb, a refactor of the Tensor Toolbox for MATLAB in Python.

This package contains data classes and methods for manipulating dense, sparse, and structured tensors, along with algorithms for computing low-rank tensor decompositions:

Quick Start

Installation

python3 -m pip install pyttb

Example

>>> import pyttb as ttb
>>> X = ttb.tenrand((2,2,2))
>>> type(X)
<class 'pyttb.tensor.tensor'>
>>> M = ttb.cp_als(X, rank=1)
CP_ALS:
 Iter 0: f = 7.367245e-01 f-delta = 7.4e-01
 Iter 1: f = 7.503069e-01 f-delta = 1.4e-02
 Iter 2: f = 7.508240e-01 f-delta = 5.2e-04
 Iter 3: f = 7.508253e-01 f-delta = 1.3e-06
 Final f = 7.508253e-01

Memory layout

For historical reasons we use Fortran memory layouts, where numpy by default uses C. This is relevant for indexing. In the future we hope to extend support for both.

>>> import numpy as np
>>> c_order = np.arange(8).reshape((2,2,2))
>>> f_order = np.arange(8).reshape((2,2,2), order="F")
>>> print(c_order[0,1,1])
3
>>> print(f_order[0,1,1])
6

Getting Help

Contributing

Citing pyttb in your work

If you use pyttb in your work, please cite it using the citation info here.

Metadata

Release files for pyttb 1.8.6

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

Source distribution (sdist)

Source distribution for pyttb 1.8.6
File Size Uploaded Provenance Actions
pyttb-1.8.6.tar.gz 189.8 kB With provenance Details for pyttb-1.8.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyttb 1.8.6
File Interpreter ABI Platform Actions
pyttb-1.8.6-py3-none-any.whl Python 3 none any Details for pyttb-1.8.6-py3-none-any.whl

Total release size: 343.7 kB

Release files / pyttb-1.8.6.tar.gz

Download URL pyttb-1.8.6.tar.gz
Size 189.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c23f00247e3cbb6052445556142475f04cb44a611a9d480a142ac891d3273b90
BLAKE2b-256 checksum
How to use checksums
181d47b961cca22825a3f624edc2b59df0fa931e60d3c0cd1f9689c78131c657
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / pyttb-1.8.6-py3-none-any.whl

Download URL pyttb-1.8.6-py3-none-any.whl
Size 153.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5e32ec8606fa15c2ecf7359282407d06cc589fdd83fd1341f351b4e7ee95194
BLAKE2b-256 checksum
How to use checksums
a4cea9e5cdaac7b8f0207f5385678283d37ec0face276fea038df7c36b663512
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Security for pyttb 1.8.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyttb-1.8.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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