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 for accelerating the design of matrix and tensor factorization algorithms. It features a powerful programming interface that augments the NumPy APIs with Einstein notations for writing very 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-0.9.3.tar.gz (53.4 kB view details)

Uploaded Source

File details

Details for the file funfact-0.9.3.tar.gz.

File metadata

  • Download URL: funfact-0.9.3.tar.gz
  • Upload date:
  • Size: 53.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for funfact-0.9.3.tar.gz
Algorithm Hash digest
SHA256 45a99a5f1fbf34aefc7429d39ccba8994c6d505340a120e0a400d617322fe289
MD5 030d206d20a237a54ff07729a4e9c5ba
BLAKE2b-256 1d928a7f844871a4f54f6b8a5d133b1e3ab865907052d8fbfd4c102a7fa50490

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