Skip to main content

Functional factorization for matrices and tensors

Project description

FunFact: Build Your Own Tensor Decomposition Model in a Breeze

CI Coverage PyPI version Documentation Status License

FunFact is a Python package that aims to simplify the design of matrix and tensor factorization algorithms. It features a powerful programming interface that augments the NumPy API with Einstein notations for writing concise tensor expressions. Given an arbitrary forward calculation scheme, the package will solve the corresponding inverse problem using stochastic gradient descent, automatic differentiation, and multi-replica vectorization. Its application areas include quantum circuit synthesis, tensor decomposition, and neural network compression. It is GPU- and parallelization-ready thanks to modern numerical linear algebra backends such as JAX/TensorFlow and PyTorch.

Quick start guide

Install from pip:

pip install funfact

Define tensors and indices:

import funfact as ff
import numpy as np
a = ff.tensor('a', 10, 2)
b = ff.tensor('b', 2, 20)
i, j, k = ff.indices('i, j, k')

Create a tensor expression (note that this only specifies the algebra but does not carry out the computation immediately):

tsrex = a[i, k] * b[k, j]

Find a rank-2 approximation of a matrix according to the expression:

target = np.random.randn(10, 20)
ff.factorize(target, tsrex)

How to cite

If you use this package for a publication (either in-paper or electronically), please cite it using the following DOI: https://doi.org/10.11578/dc.20210922.1

Contributors

Current developers:

Previou contributors:

Copyright

FunFact Copyright (c) 2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Intellectual Property Office at IPO@lbl.gov.

NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.

Funding Acknowledgment

This work was supported by the Laboratory Directed Research and Development Program of Lawrence Berkeley National Laboratory under U.S. Department of Energy Contract No. DE-AC02-05CH11231.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

funfact-1.0rc2.tar.gz (57.6 kB view details)

Uploaded Source

File details

Details for the file funfact-1.0rc2.tar.gz.

File metadata

  • Download URL: funfact-1.0rc2.tar.gz
  • Upload date:
  • Size: 57.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.12

File hashes

Hashes for funfact-1.0rc2.tar.gz
Algorithm Hash digest
SHA256 e94a26d2d39b7537f24c962aaf6b1789b1e7ec8f87dd9858599ae33fe0484f9c
MD5 b384b8909993f0e3200411f9055ed23f
BLAKE2b-256 5caa7633021d47d91bb78598f56391bab27eef2ee6f450bde8b0e54dafb4366a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page