Differentiable eigenvalue decomposition with JAX (CPU/GPU)
Project description
Differentiable Generalized Eigenvalue Decomposition
Standalone implementation of differentiable eigenvalue decomposition with CPU (LAPACK) and GPU (cuSOLVER) backends. Extracted from pyscfad.
Features
- Generalized Problems:
A @ V = B @ V @ diag(W), etc. - JAX Integrated: Full support for
jit,vmap,grad, andjvp. - High Performance: Optimized LAPACK (CPU) and cuSOLVER (GPU) kernels.
- Precision:
float32/64andcomplex64/128. - Degeneracy Handling: Configurable
deg_threshfor stable gradients.
Installation & Quick Start
# Install from source
pip install .
# For GPU support in this environment
pip install .[cuda-local]
Usage Example
import jax
import jax.numpy as jnp
from eigh import eigh
jax.config.update("jax_enable_x64", True)
A = jnp.array([[2., 1.], [1., 2.]])
w, v = eigh(A) # Standard
grad = jax.grad(lambda A: eigh(A)[0].sum())(A) # Differentiable
API Reference
eigh(a, b=None, *, lower=True, eigvals_only=False, type=1, deg_thresh=1e-9)Scipy-compatible interface.typesupports 1:A@v=B@v@λ, 2:A@B@v=v@λ, 3:B@A@v=v@λ.eigh_gen(a, b, *, lower=True, itype=1, deg_thresh=1e-9)Lower-level generalized solver.
Degenerate Eigenvalues & Gradients
Individual eigenvalue gradients are ill-defined for degenerate (repeated) eigenvalues. However, symmetric functions (like sum, var, trace) have stable gradients. The deg_thresh parameter (default 1e-9) masks divisions by near-zero gaps to maintain stability.
Development & Testing
- Requirements: CMake 3.18+, C++17, JAX, NumPy, LAPACK/CUDA.
- Tests:
pytest tests/test_eigh.py # Core functionality pytest tests/test_eigh_gen.py # Generalized itypes pytest tests/test_eigh_jit.py # JIT & vmap
- GPU Setup:
source setup_gpu_env_clean.sh ./run_gpu.sh python example_simple.py
License & Citation
Apache License 2.0. If used in research, please cite:
@software{pyscfad,
author = {Zhang, Xing},
title = {PySCFad: Automatic Differentiation for PySCF},
url = {https://github.com/fishjojo/pyscfad},
year = {2021-2025}
}
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 Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eigh-0.1.0.tar.gz.
File metadata
- Download URL: eigh-0.1.0.tar.gz
- Upload date:
- Size: 285.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
605396016f4f3a5db1bc9796d76b015366b50e6b993c4495b6fc17df3c800267
|
|
| MD5 |
70e0db7883582901ec235cf54a510aa3
|
|
| BLAKE2b-256 |
d09d3916368dcedaa47a207ad184276a189a510d3bd264c40b989ee5924af6c4
|
File details
Details for the file eigh-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: eigh-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 12.0 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07908c693c1a067ce2afce340f6ea2331239c93da51c8f20ae8762b4711a9072
|
|
| MD5 |
c968f325313908b6f8989b6e2933445e
|
|
| BLAKE2b-256 |
52d7c9ba88b132f1883d053ae5d2d9a6e23480aafe8995394cfdd3be37893d55
|
File details
Details for the file eigh-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: eigh-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 58.0 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17f5a2648613c9b54e31dbcb09685f10c4f928d9f2d74cab24692b3d329556ad
|
|
| MD5 |
3ced7984cba2bf8bf723902a970dbcd4
|
|
| BLAKE2b-256 |
d3b9149810c38e982858c48e843882c355baaafaa17c768a41e74773b8fb9430
|
File details
Details for the file eigh-0.1.0-cp313-cp313-macosx_10_15_x86_64.whl.
File metadata
- Download URL: eigh-0.1.0-cp313-cp313-macosx_10_15_x86_64.whl
- Upload date:
- Size: 61.5 kB
- Tags: CPython 3.13, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c5b9934cecddd6bc130a362d1b0edd4675a5a65ca1fbfa4fa600d4c0d7a0818
|
|
| MD5 |
14caa2b65eda8b14b7ce0a53cdd21276
|
|
| BLAKE2b-256 |
b834ae98e8bdfa4dffcc01ea66f77b0886c48fc2ef641e4bbe0d3897803afe7d
|
File details
Details for the file eigh-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: eigh-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 12.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
614173ec434f021ad2b89517f8daf43cfd745070b77681de567da30cc61be329
|
|
| MD5 |
43096232a4c3035a0d39ec96ffe9ee47
|
|
| BLAKE2b-256 |
501a4ea5a934af90f50d63d97919a74b1a8066ec0f11b68e2a1d0e5cd5d88217
|
File details
Details for the file eigh-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: eigh-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 58.0 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2809042da311e020bed77375ae2eed00d1f2aa4000709c9ffecec65ca222edf
|
|
| MD5 |
86f54c586bc72bfa3813c332c079162a
|
|
| BLAKE2b-256 |
72f829c3f05d589d81aca31cc7369eb95e640134d5005641b1fdf75d5131b095
|
File details
Details for the file eigh-0.1.0-cp312-cp312-macosx_10_15_x86_64.whl.
File metadata
- Download URL: eigh-0.1.0-cp312-cp312-macosx_10_15_x86_64.whl
- Upload date:
- Size: 61.4 kB
- Tags: CPython 3.12, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2207e0177d23d5428ec9d54d7f4d699186e3eca8b5cbf1e4bad8af1bc2663c57
|
|
| MD5 |
175483485e995e8379a71cc2c1818f58
|
|
| BLAKE2b-256 |
df1554bb7bd790b4a919249dc1751551cda8346e36de6600e01f5200fac221c9
|
File details
Details for the file eigh-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: eigh-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 12.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3563ed02001afa20d52ab54c257bbc73b1a9febe648efd8320712c03c35bab3
|
|
| MD5 |
2a13a335e41fb5efdd1fdea2780c695d
|
|
| BLAKE2b-256 |
ef3280c6c020dce51cebfd28d22903dacb4f197fa4c24f983dcfef1b3ad00e2c
|
File details
Details for the file eigh-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: eigh-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 58.4 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3653a71128abc6ec3dedf8757aab67dce2e292090564fd61c609068940693396
|
|
| MD5 |
f73e4203b5f706733d860db7d525c81b
|
|
| BLAKE2b-256 |
9c2323487b3d60fc1636eb7bddf8a43ad7ff899d748fffaf501606db09b7fbcd
|
File details
Details for the file eigh-0.1.0-cp311-cp311-macosx_10_15_x86_64.whl.
File metadata
- Download URL: eigh-0.1.0-cp311-cp311-macosx_10_15_x86_64.whl
- Upload date:
- Size: 61.8 kB
- Tags: CPython 3.11, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a95f67adf579ceaddb7f2b14817e86b50d0314ce8b117faccece8b746e938f6
|
|
| MD5 |
cfd9fa15629479c9bdca2300d8d223b1
|
|
| BLAKE2b-256 |
6f831372cfcec0652b704de83488e8326db46bb3a4867c3b0e3d070b805949b0
|
File details
Details for the file eigh-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: eigh-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 12.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a69010f5d971c5caa7a1e2dc6bdd2b68702c2c9573cdaed35173dc14b4d7515
|
|
| MD5 |
6798dc8dadd3c17a9ec61112f4deed5b
|
|
| BLAKE2b-256 |
e484ab21ae10d4655b5c76dd2b38584b0d52f259f70d60dcde49a9d732a13a7a
|
File details
Details for the file eigh-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: eigh-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 58.1 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9a4066e5530569d8437c55eb5fead577c70fafae02821c7f8a511c746787962
|
|
| MD5 |
65a0051052ba42a78cde2c10aafdcdf5
|
|
| BLAKE2b-256 |
d59d1174e66eabc49fb62763ac1fef8dbbfe7cad09d466694abbc95f5274b8a4
|
File details
Details for the file eigh-0.1.0-cp310-cp310-macosx_10_15_x86_64.whl.
File metadata
- Download URL: eigh-0.1.0-cp310-cp310-macosx_10_15_x86_64.whl
- Upload date:
- Size: 61.5 kB
- Tags: CPython 3.10, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
063d067eccec05472adb3d91340fb5125b6f7d18aecbb36cef0e6ea809ac9606
|
|
| MD5 |
c560e92605a00eb7b784b9d47c905f86
|
|
| BLAKE2b-256 |
29b8a1679a16f946c9a2f013de3ce8c6148f42bc9d2a5daf628e3f1ed40f94b9
|