Various eigendecomposition implementations wrapped for jax.
Project description
jeig - Eigendecompositions wrapped for jax
v0.1.1
Overview
This package wraps eigendecompositions as provided by jax, numpy, scipy, and torch for use with jax. Depending upon your system and your versions of these packages, you may observe significant speed differences.
Install
jeig can be installed via pip,
pip install jeig
This will also install torch. If you only need torch for use with jeig, then the CPU-only version could be sufficient and you may wish to install manually as described in the pytorch docs.
Example usage
import jax
import jeig
matrix = jax.random.normal(jax.random.PRNGKey(0), (8, 320, 320))
jeig.set_backend("jax")
%timeit jeig.eig(matrix)
jeig.set_backend("numpy")
%timeit jeig.eig(matrix)
jeig.set_backend("scipy")
%timeit jeig.eig(matrix)
jeig.set_backend("torch")
%timeit jeig.eig(matrix)
916 ms ± 101 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
1.47 s ± 165 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
782 ms ± 75.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
150 ms ± 10.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
Credit
The torch implementation of eigendecomposition is due to a comment by @YouJiacheng.
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
Built Distribution
File details
Details for the file jeig-0.1.1.tar.gz
.
File metadata
- Download URL: jeig-0.1.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f059be77ed91d2f3a9b2b02b7941389614f423c152b114956f4fb28f53522859 |
|
MD5 | 5f20fbbb7dceb163c0041c148c6e8850 |
|
BLAKE2b-256 | 93ea03c5bc01aeef1818dc56f0fafa0d0bee04b95fc0f8806be8f86f9c0ad567 |
File details
Details for the file jeig-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: jeig-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2ad43ce6ec3b93715f7eba40697aa3994efda4957ecddaaa12e10e6e4b16f08 |
|
MD5 | 9afb3ee8eddce5fa476ae08909e5c3e2 |
|
BLAKE2b-256 | 477b9534b2ba07e2be01361e4277f9d55a7f0f2999c5f25e7b21d754f2073d1f |