Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/markdown-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/github-action-markdown-link-check@v1
- uses: gaurav-nelson/github-action-markdown-link-check@v1
2 changes: 1 addition & 1 deletion CITATION.bib
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ @misc{pyttb
author = {Dunlavy, Daniel M. and Johnson, Nicholas T. and others},
month = oct,
title = {{pyttb: Python Tensor Toolbox, v1.8.0}},
url = {https://github.com/sandialab/pyttb},
url = {https://github.com/sandialabs/pyttb},
year = {2024}
}
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
```
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.
```

# Python Tensor Toolbox Contributor Guide

## Issues
Expand Down
78 changes: 55 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```
Copyright 2022 National Technology & Engineering Solutions of Sandia,
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.
```
Expand All @@ -12,32 +12,64 @@ U.S. Government retains certain rights in this software.

# pyttb: Python Tensor Toolbox

Welcome to `pyttb`, a set of Python classes and methods functions for
manipulating dense, sparse, and structured tensors, along with algorithms
for computing low-rank tensor models.
Welcome to `pyttb`, a refactor of the
[Tensor Toolbox for MATLAB](https://www.tensortoolbox.org) in Python.

**Tensor Classes:**
* `tensor`: dense tensors
* `sptensor`: sparse tensors
* `ktensor`: Kruskal tensors
* `tenmat`: matricized tensors
* `ttensor`: Tucker tensors
This package contains data classes and methods for manipulating dense,
sparse, and structured tensors, along with algorithms for computing
low-rank tensor decompositions:

**Tensor Algorithms:**
* `cp_als`, `cp_apr`: Canonical Polyadic (CP) decompositions
* `tucker_als`: Tucker decompostions
- Data Classes:
[`tensor`](https://pyttb.readthedocs.io/en/stable/tensor.html "dense tensors"),
[`sptensor`](https://pyttb.readthedocs.io/en/stable/sptensor.html "sparse tensors"),
[`ktensor`](https://pyttb.readthedocs.io/en/stable/ktensor.html "Kruskal tensors"),
[`ttensor`](https://pyttb.readthedocs.io/en/stable/ttensor.html "Tucker tensors"),
[`tenmat`](https://pyttb.readthedocs.io/en/stable/tenmat.html "matricized dense tensors"),
[`sptenmat`](https://pyttb.readthedocs.io/en/stable/sptenmat.html "matricized sparse tensors"),
[`sumtensor`](https://pyttb.readthedocs.io/en/stable/sumtensor.html "implicit sum of tensors")
- Algorithms:
[`cp_als`](https://pyttb.readthedocs.io/en/stable/cpals.html "CP decomposition via Alternating Least Squares"),
[`cp_apr`](https://pyttb.readthedocs.io/en/stable/cpapr.html "CP decomposition via Alternating Poisson Regression"),
[`gcp_opt`](https://pyttb.readthedocs.io/en/stable/gcpopt.html "Generalized CP decomposition"),
[`hosvd`](https://pyttb.readthedocs.io/en/stable/hosvd.html "Tucker decomposition via Higher Order Singular Value Decomposition"),
[`tucker_als`](https://pyttb.readthedocs.io/en/stable/tuckerals.html "Tucker decompostion via Alternating Least Squares")

# Getting Started
For full details see our [documentation](https://pyttb.readthedocs.io).
## Quick Start
We are on pypi
```commandline
pip install pyttb
```
or install from source

### Installation
```commandline
pip install .
python3 -m pip install pyttb
```

# Contributing
Check out our [contributing guide](CONTRIBUTING.md).
### Example
```python
>>> 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
```

<!-- markdown-link-check-disable -->
### Getting Help
- [Documentation](https://pyttb.readthedocs.io)
- [Tutorials](https://pyttb.readthedocs.io/en/stable/tutorials.html)
- [Info for users coming from MATLAB](https://pyttb.readthedocs.io/en/stable/for_matlab_users.html)
- Learn about tensor decompositions:
[tensor paper](https://doi.org/10.1137/07070111X "Tensor Decompositions and Applications by Tamara G. Kolda, Brett W. Bader"),
[tensor book](https://www.mathsci.ai/post/tensor-textbook/ "Tensor Decompositions for Data Science by Grey Balard and Tamara G. Kolda")
<!-- markdown-link-check-enable -->

### Contributing
- [Report a bug](https://github.com/sandialabs/pyttb/issues/new)
- [Guide for contributors](CONTRIBUTING.md)
- [List of contributors](CONTRIBUTORS.md)

### Citing pyttb in your work
If you use pyttb in your work, please cite it using the citation info [here](CITATION.bib).
Loading