Skip to main content

Various eigendecomposition implementations wrapped for jax.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

jeig - Eigendecompositions wrapped for jax

Continuous integration PyPI version

Overview

This package wraps eigendecompositions as provided by jax, cusolver, magma, numpy, scipy, and torch for use with jax. Depending upon your system and your versions of these packages, you may observe significant speed differences. The following were obtained using jax 0.8.0 on a system with 28-core Intel Xeon w7-3465X and NVIDIA RTX4090.

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 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), (1, 2048, 2048)).astype(complex)

%timeit jax.block_until_ready(jeig.eig(matrix, backend="cusolver"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="lapack"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="magma"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="torch"))
1.31 s ± 43 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
5.44 s ± 379 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
11.1 s ± 937 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
4.93 s ± 92.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

The default torch backend has good performance when performing batched eigendecomposition on many-core CPUs.

matrix = jax.random.normal(jax.random.PRNGKey(0), (8, 2048, 2048)).astype(complex)

%timeit jax.block_until_ready(jeig.eig(matrix, backend="cusolver"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="lapack"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="magma"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="torch"))
10.4 s ± 116 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
48.1 s ± 6.74 s per loop (mean ± std. dev. of 7 runs, 1 loop each)
1min 33s ± 1.49 s per loop (mean ± std. dev. of 7 runs, 1 loop each)
7.18 s ± 91.6 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

jeig-0.5.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jeig-0.5.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jeig-0.5.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for jeig-0.5.0.tar.gz
Algorithm Hash digest
SHA256 997e90743e0f08af1c423d7902b04883f1a32ee2437a641c761ba60ecb38986f
MD5 87fa52c5e227907fc7f3a0e334b79c45
BLAKE2b-256 88245e4dc1bdf39b3491eee0071d6a344e85b3bc901b36dbd1dcfb9a2c09ff61

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jeig-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for jeig-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb9e1156be5da886a8a06ad4fe0455de4a45b261a685a175a8f1b83ffed1d55c
MD5 4bd724ab3ac9b3773c3c537edcad5838
BLAKE2b-256 313cf5761c62b0eb9f2e731068c90d4b188fede6559a1dcd52f92f9d0546b85f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page