Skip to content

Latest commit

 

History

History
88 lines (62 loc) · 3.33 KB

README.md

File metadata and controls

88 lines (62 loc) · 3.33 KB

Welcome to the documentation of FunFact!

CI Coverage PyPI version Documentation Status License

Overview

FunFact is a Python package that enables flexible and concise expressions of tensor algebra through an Einstein notation-based syntax. A particular emphasis is on automating the design of matrix and tensor factorization models. It’s areas of applications 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 [email protected].

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.