Copyright 2024 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.
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:
- Data Classes:
tensor
,sptensor
,ktensor
,ttensor
,tenmat
,sptenmat
,sumtensor
- Algorithms:
cp_als
,cp_apr
,gcp_opt
,hosvd
,tucker_als
python3 -m pip install pyttb
>>> 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
- Documentation
- Tutorials
- Info for users coming from MATLAB
- Learn about tensor decompositions: tensor paper, tensor book
If you use pyttb in your work, please cite it using the citation info here.