Various eigendecomposition implementations wrapped for jax.
Project description
jeig - Eigendecompositions wrapped for jax
v0.1.3
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.3.tar.gz
.
File metadata
- Download URL: jeig-0.1.3.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5470b3c2ed708460787e934c38de4a9d2436cfe8ed72707794ff75266078525 |
|
MD5 | aab32a718d044e2de0ebd8dade5d880d |
|
BLAKE2b-256 | 3bf0685f873a59af378e157713bbf5e82a8767504557a48d3c011695b9d60293 |
File details
Details for the file jeig-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: jeig-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 396058c06afad174e8cf0fd259bf2f15270fb302775b107594ceb4899d05bcde |
|
MD5 | 45f52155dd2a2287b5d575abda3e8759 |
|
BLAKE2b-256 | 142e96e1b87fc5974655b4d65c8d4dd5f023e7cc79f704d76cc7c90d644b0a89 |