Tensor-free randomized HOSVD (randomized Tucker decomposition)
Project description
TensorRSVD
Tensor-free randomized Higher-Order SVD (Tucker decomposition).
TensorRSVD computes Tucker decompositions of high-dimensional tensors that are defined as Python functions without ever forming the dense tensor in memory. It uses randomized linear algebra (Halko et al. 2011) to approximate the dominant factor matrices mode-by-mode, scaling to tensors that would be impossible to store explicitly.
Installation
pip install tensorrsvd
Optional backends for GPU or JIT-compiled acceleration:
pip install "tensorrsvd[jax]" # JAX (CPU / GPU / TPU)
pip install "tensorrsvd[jaxcuda12]" # JAX with CUDA 12
pip install "tensorrsvd[jaxcuda13]" # JAX with CUDA 13
pip install "tensorrsvd[cupy]" # CuPy (NVIDIA GPU, CUDA required)
Note: CuPy wheels are CUDA-version-specific. If the above does not match your CUDA installation, install CuPy manually following the CuPy installation guide.
Quick start
import numpy as np
from tensorrsvd import ho_rsvd
# Define your tensor as a callable
def my_tensor(x0, x1, x2):
return x0 - x1 + x2
# Compute the randomized Tucker factors
U_list, S_list = ho_rsvd(
tensor=my_tensor,
tensor_shape=(64, 64, 64),
dtype=np.float64,
rank=4,
num_oversamples=10,
num_idxs=3,
)
# U_list[i] has shape (n_i, rank_i) with orthonormal columns
# S_list[i] has shape (rank_i,) (descending singular values)
print([U.shape for U in U_list]) # [(64, 4), (64, 4), (64, 4)]
Switch to a JAX or CuPy backend by passing backend="jax" or backend="cupy".
Documentation
Full documentation (installation, user guide, theory, and API reference, etc.) is available at tensorrsvd.readthedocs.io.
References
-
N. Halko, P. G. Martinsson, and J. A. Tropp, Finding Structure with Randomness: Probabilistic Algorithms for Constructing Approximate Matrix Decompositions, SIAM Review, 53(2):217–288, 2011. doi:10.1137/090771806
-
L. De Lathauwer, B. De Moor, and J. Vandewalle, A Multilinear Singular Value Decomposition, SIAM Journal on Matrix Analysis and Applications, 21(4):1253–1278, 2000. doi:10.1137/S0895479896305696
License
MIT (see LICENSE)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tensorrsvd-0.2.1.tar.gz.
File metadata
- Download URL: tensorrsvd-0.2.1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a6c1f225a3ae6324fa9586ca2364749313777053e1c937411ad2c9c63f566c1
|
|
| MD5 |
eae7981f9f44dd6e01a2ec3c3c3603e3
|
|
| BLAKE2b-256 |
8c100348cee05d8845b0194c497e57a492bed01eb806667813fa351bc6cfbb4b
|
Provenance
The following attestation bundles were made for tensorrsvd-0.2.1.tar.gz:
Publisher:
publish.yml on PaulVirally/TensorRSVD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tensorrsvd-0.2.1.tar.gz -
Subject digest:
7a6c1f225a3ae6324fa9586ca2364749313777053e1c937411ad2c9c63f566c1 - Sigstore transparency entry: 1207854077
- Sigstore integration time:
-
Permalink:
PaulVirally/TensorRSVD@8bc49bbeea5104d1c1e5303f88dde18e25bba767 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/PaulVirally
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8bc49bbeea5104d1c1e5303f88dde18e25bba767 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tensorrsvd-0.2.1-py3-none-any.whl.
File metadata
- Download URL: tensorrsvd-0.2.1-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0a8093a260f320251983fa0a3a42f7f2087bc9dbe9db87b5bd39be3a7598167
|
|
| MD5 |
89cdcf06d22dba26965f7628fa8dd1cf
|
|
| BLAKE2b-256 |
dc2eb176d2de06ffd475f03dbb84dfd99d79ff0834b560c2da8e0bcbe6258ca4
|
Provenance
The following attestation bundles were made for tensorrsvd-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on PaulVirally/TensorRSVD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tensorrsvd-0.2.1-py3-none-any.whl -
Subject digest:
f0a8093a260f320251983fa0a3a42f7f2087bc9dbe9db87b5bd39be3a7598167 - Sigstore transparency entry: 1207854101
- Sigstore integration time:
-
Permalink:
PaulVirally/TensorRSVD@8bc49bbeea5104d1c1e5303f88dde18e25bba767 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/PaulVirally
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8bc49bbeea5104d1c1e5303f88dde18e25bba767 -
Trigger Event:
push
-
Statement type: