Skip to main content

Various eigendecomposition implementations wrapped for jax.

Project description

jeig - Eigendecompositions wrapped for jax

v0.1.0

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.

Speed comparison

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 is sufficient and you may wish to install manually as described in the pytorch docs.

Example usage

import jax
import jeig.eig as jeig

matrix = jax.random.normal(jax.random.PRNGKey(0), (8, 320, 320))

jeig.BACKEND_EIG = jeig.JAX
%timeit jeig.eig(matrix)

jeig.BACKEND_EIG = jeig.NUMPY
%timeit jeig.eig(matrix)

jeig.BACKEND_EIG = jeig.SCIPY
%timeit jeig.eig(matrix)

jeig.BACKEND_EIG = jeig.TORCH
%timeit jeig.eig(matrix)
376 ms ± 11.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
689 ms ± 11.2 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
414 ms ± 19 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
136 ms ± 4 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

Credit

The high-level eig function and the tests are adapted from fmmax. 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

jeig-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

jeig-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file jeig-0.1.0.tar.gz.

File metadata

  • Download URL: jeig-0.1.0.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

Hashes for jeig-0.1.0.tar.gz
Algorithm Hash digest
SHA256 27c9cc89d3aaba8964badc1bb481b14068444e0fc526af864f09a18540cf847d
MD5 e2948fb072e3b49113aec2ef8d4e4903
BLAKE2b-256 5c14a86050104925a242be4a664894da891a9bcf8caa0a50f4d7c250243a4722

See more details on using hashes here.

File details

Details for the file jeig-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jeig-0.1.0-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

Hashes for jeig-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3bcb9d317d3a98371db7283d1c2e0ff92078e65487f97e9df15a05b00889b76f
MD5 823d3333c3b0736aee7994a7385a4093
BLAKE2b-256 9b9db22b7b868aaf567561591aef88a758ed01e671bb5f91b66b08a1f0532a8a

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