{"id":19863432,"url":"https://github.com/sandialabs/pyttb","last_synced_at":"2026-01-05T20:09:41.500Z","repository":{"id":37971322,"uuid":"490526739","full_name":"sandialabs/pyttb","owner":"sandialabs","description":"Python Tensor Toolbox","archived":false,"fork":false,"pushed_at":"2025-07-10T21:25:42.000Z","size":1196,"stargazers_count":33,"open_issues_count":42,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-13T10:41:34.396Z","etag":null,"topics":["cp-decomposition","data-science","python","scr-2671","snl-data-analysis","tensors","tucker-decomposition"],"latest_commit_sha":null,"homepage":"https://pyttb.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandialabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.bib","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-05-10T03:21:22.000Z","updated_at":"2025-07-08T22:51:49.000Z","dependencies_parsed_at":"2023-12-23T17:16:51.162Z","dependency_job_id":"911551bd-46ae-4fef-8b34-0ff5c2dddbd8","html_url":"https://github.com/sandialabs/pyttb","commit_stats":{"total_commits":171,"total_committers":9,"mean_commits":19.0,"dds":0.5087719298245614,"last_synced_commit":"5751f02f631a78dcf0a06ec4f03dbda79eb5b98b"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/sandialabs/pyttb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2Fpyttb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2Fpyttb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2Fpyttb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2Fpyttb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandialabs","download_url":"https://codeload.github.com/sandialabs/pyttb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2Fpyttb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266682625,"owners_count":23967837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cp-decomposition","data-science","python","scr-2671","snl-data-analysis","tensors","tucker-decomposition"],"created_at":"2024-11-12T15:14:40.161Z","updated_at":"2026-01-05T20:09:36.475Z","avatar_url":"https://github.com/sandialabs.png","language":"Python","readme":"```\nCopyright 2025 National Technology \u0026 Engineering Solutions of Sandia,\nLLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the\nU.S. Government retains certain rights in this software.\n```\n[![Regression tests](https://github.com/sandialabs/pyttb/actions/workflows/regression-tests.yml/badge.svg)](https://github.com/sandialabs/pyttb/actions/workflows/regression-tests.yml)\n[![Coverage Status](https://coveralls.io/repos/github/sandialabs/pyttb/badge.svg)](https://coveralls.io/github/sandialabs/pyttb)\n[![pypi package](https://img.shields.io/pypi/v/pyttb?label=pypi%20package)](https://pypi.org/project/pyttb/)\n[![image](https://img.shields.io/pypi/pyversions/pyttb.svg)](https://pypi.python.org/pypi/pyttb)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n# pyttb: Python Tensor Toolbox\n\nWelcome to `pyttb`, a refactor of the \n[Tensor Toolbox for MATLAB](https://www.tensortoolbox.org) in Python.\n\nThis package contains data classes and methods for manipulating dense, \nsparse, and structured tensors, along with algorithms for computing \nlow-rank tensor decompositions:\n\n- Data Classes: \n[`tensor`](https://pyttb.readthedocs.io/en/stable/tensor.html \"dense tensors\"), \n[`sptensor`](https://pyttb.readthedocs.io/en/stable/sptensor.html \"sparse tensors\"), \n[`ktensor`](https://pyttb.readthedocs.io/en/stable/ktensor.html \"Kruskal tensors\"), \n[`ttensor`](https://pyttb.readthedocs.io/en/stable/ttensor.html \"Tucker tensors\"), \n[`tenmat`](https://pyttb.readthedocs.io/en/stable/tenmat.html \"matricized dense tensors\"), \n[`sptenmat`](https://pyttb.readthedocs.io/en/stable/sptenmat.html \"matricized sparse tensors\"), \n[`sumtensor`](https://pyttb.readthedocs.io/en/stable/sumtensor.html \"implicit sum of tensors\")\n- Algorithms:\n[`cp_als`](https://pyttb.readthedocs.io/en/stable/cpals.html \"CP decomposition via Alternating Least Squares\"),\n[`cp_apr`](https://pyttb.readthedocs.io/en/stable/cpapr.html \"CP decomposition via Alternating Poisson Regression\"), \n[`gcp_opt`](https://pyttb.readthedocs.io/en/stable/gcpopt.html \"Generalized CP decomposition\"), \n[`hosvd`](https://pyttb.readthedocs.io/en/stable/hosvd.html \"Tucker decomposition via Higher Order Singular Value Decomposition\"),\n[`tucker_als`](https://pyttb.readthedocs.io/en/stable/tuckerals.html \"Tucker decomposition via Alternating Least Squares\")\n\n## Quick Start\n\n### Installation\n```commandline\npython3 -m pip install pyttb\n```\n\n### Example\n```python\n\u003e\u003e\u003e import pyttb as ttb\n\u003e\u003e\u003e X = ttb.tenrand((2,2,2))\n\u003e\u003e\u003e type(X)\n\u003cclass 'pyttb.tensor.tensor'\u003e\n\u003e\u003e\u003e M = ttb.cp_als(X, rank=1)\nCP_ALS:\n Iter 0: f = 7.367245e-01 f-delta = 7.4e-01\n Iter 1: f = 7.503069e-01 f-delta = 1.4e-02\n Iter 2: f = 7.508240e-01 f-delta = 5.2e-04\n Iter 3: f = 7.508253e-01 f-delta = 1.3e-06\n Final f = 7.508253e-01\n ```\n\n### Memory layout\nFor historical reasons we use Fortran memory layouts, where numpy by default uses C.\nThis is relevant for indexing. In the future we hope to extend support for both.\n```python\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e c_order = np.arange(8).reshape((2,2,2))\n\u003e\u003e\u003e f_order = np.arange(8).reshape((2,2,2), order=\"F\")\n\u003e\u003e\u003e print(c_order[0,1,1])\n3\n\u003e\u003e\u003e print(f_order[0,1,1])\n6\n```\n\n\u003c!-- markdown-link-check-disable --\u003e\n### Getting Help\n- [Documentation](https://pyttb.readthedocs.io)\n- [Tutorials](https://pyttb.readthedocs.io/en/stable/tutorials.html)\n- [Info for users coming from MATLAB](https://pyttb.readthedocs.io/en/stable/for_matlab_users.html)\n- Learn about tensor decompositions: \n[tensor paper](https://doi.org/10.1137/07070111X \"Tensor Decompositions and Applications by Tamara G. Kolda, Brett W. Bader\"), \n[tensor book](https://www.mathsci.ai/post/tensor-textbook/ \"Tensor Decompositions for Data Science by Grey Balard and Tamara G. Kolda\") \n\u003c!-- markdown-link-check-enable --\u003e\n\n### Contributing\n- [Report a bug](https://github.com/sandialabs/pyttb/issues/new)\n- [Guide for contributors](CONTRIBUTING.md)\n- [List of contributors](CONTRIBUTORS.md)\n\n### Citing pyttb in your work \nIf you use pyttb in your work, please cite it using the citation info [here](CITATION.bib).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandialabs%2Fpyttb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandialabs%2Fpyttb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandialabs%2Fpyttb/lists"}