Name | jeig JSON |
Version |
0.1.3
JSON |
| download |
home_page | None |
Summary | Various eigendecomposition implementations wrapped for jax. |
upload_time | 2024-10-11 21:00:51 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | BSD 3-Clause License Copyright (c) 2024, Martin Schubert Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
jax
eigendecomposition
eig
torch
scipy
numpy
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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.
![Speed comparison](https://github.com/mfschubert/jeig/blob/main/docs/speed.png?raw=true)
## 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](https://pytorch.org/get-started/locally/).
## Example usage
```python
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](https://github.com/google/jax/issues/10180#issuecomment-1092098074) by @YouJiacheng.
Raw data
{
"_id": null,
"home_page": null,
"name": "jeig",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "Martin Schubert <mfschubert@gmail.com>",
"keywords": "jax, eigendecomposition, eig, torch, scipy, numpy",
"author": null,
"author_email": "Martin Schubert <mfschubert@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/3b/f0/685f873a59af378e157713bbf5e82a8767504557a48d3c011695b9d60293/jeig-0.1.3.tar.gz",
"platform": null,
"description": "# jeig - Eigendecompositions wrapped for jax\n`v0.1.3`\n\n## Overview\n\nThis 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.\n\n![Speed comparison](https://github.com/mfschubert/jeig/blob/main/docs/speed.png?raw=true)\n\n## Install\njeig can be installed via pip,\n```\npip install jeig\n```\nThis 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](https://pytorch.org/get-started/locally/).\n\n## Example usage\n\n```python\nimport jax\nimport jeig\n\nmatrix = jax.random.normal(jax.random.PRNGKey(0), (8, 320, 320))\n\njeig.set_backend(\"jax\")\n%timeit jeig.eig(matrix)\n\njeig.set_backend(\"numpy\")\n%timeit jeig.eig(matrix)\n\njeig.set_backend(\"scipy\")\n%timeit jeig.eig(matrix)\n\njeig.set_backend(\"torch\")\n%timeit jeig.eig(matrix)\n```\n```\n916 ms \u00b1 101 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n1.47 s \u00b1 165 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n782 ms \u00b1 75.4 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n150 ms \u00b1 10.9 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n```\n\n## Credit\nThe torch implementation of eigendecomposition is due to a [comment](https://github.com/google/jax/issues/10180#issuecomment-1092098074) by @YouJiacheng.\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License Copyright (c) 2024, Martin Schubert Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
"summary": "Various eigendecomposition implementations wrapped for jax.",
"version": "0.1.3",
"project_urls": null,
"split_keywords": [
"jax",
" eigendecomposition",
" eig",
" torch",
" scipy",
" numpy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "142e96e1b87fc5974655b4d65c8d4dd5f023e7cc79f704d76cc7c90d644b0a89",
"md5": "45f52155dd2a2287b5d575abda3e8759",
"sha256": "396058c06afad174e8cf0fd259bf2f15270fb302775b107594ceb4899d05bcde"
},
"downloads": -1,
"filename": "jeig-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "45f52155dd2a2287b5d575abda3e8759",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5921,
"upload_time": "2024-10-11T21:00:50",
"upload_time_iso_8601": "2024-10-11T21:00:50.211761Z",
"url": "https://files.pythonhosted.org/packages/14/2e/96e1b87fc5974655b4d65c8d4dd5f023e7cc79f704d76cc7c90d644b0a89/jeig-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3bf0685f873a59af378e157713bbf5e82a8767504557a48d3c011695b9d60293",
"md5": "aab32a718d044e2de0ebd8dade5d880d",
"sha256": "e5470b3c2ed708460787e934c38de4a9d2436cfe8ed72707794ff75266078525"
},
"downloads": -1,
"filename": "jeig-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "aab32a718d044e2de0ebd8dade5d880d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5906,
"upload_time": "2024-10-11T21:00:51",
"upload_time_iso_8601": "2024-10-11T21:00:51.571163Z",
"url": "https://files.pythonhosted.org/packages/3b/f0/685f873a59af378e157713bbf5e82a8767504557a48d3c011695b9d60293/jeig-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-11 21:00:51",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "jeig"
}