jaxcont 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jaxcont-0.1.0/CITATION.cff +11 -0
- jaxcont-0.1.0/LICENSE +21 -0
- jaxcont-0.1.0/MANIFEST.in +2 -0
- jaxcont-0.1.0/PKG-INFO +165 -0
- jaxcont-0.1.0/README.md +115 -0
- jaxcont-0.1.0/examples/GALLERY_HEADER.rst +9 -0
- jaxcont-0.1.0/pyproject.toml +100 -0
- jaxcont-0.1.0/setup.cfg +4 -0
- jaxcont-0.1.0/setup.py +6 -0
- jaxcont-0.1.0/src/jaxcont/__init__.py +111 -0
- jaxcont-0.1.0/src/jaxcont/_version.py +3 -0
- jaxcont-0.1.0/src/jaxcont/api.py +478 -0
- jaxcont-0.1.0/src/jaxcont/bifurcations/__init__.py +18 -0
- jaxcont-0.1.0/src/jaxcont/bifurcations/detector.py +374 -0
- jaxcont-0.1.0/src/jaxcont/bifurcations/fold.py +108 -0
- jaxcont-0.1.0/src/jaxcont/bifurcations/fold_solve.py +152 -0
- jaxcont-0.1.0/src/jaxcont/bifurcations/hopf.py +148 -0
- jaxcont-0.1.0/src/jaxcont/bifurcations/period_doubling.py +99 -0
- jaxcont-0.1.0/src/jaxcont/bifurcations/taxonomy.py +90 -0
- jaxcont-0.1.0/src/jaxcont/core/__init__.py +21 -0
- jaxcont-0.1.0/src/jaxcont/core/continuation.py +250 -0
- jaxcont-0.1.0/src/jaxcont/core/natural_continuation.py +138 -0
- jaxcont-0.1.0/src/jaxcont/core/predictor_corrector.py +414 -0
- jaxcont-0.1.0/src/jaxcont/core/pseudo_arclength.py +271 -0
- jaxcont-0.1.0/src/jaxcont/core/scan_continuation.py +267 -0
- jaxcont-0.1.0/src/jaxcont/problems/__init__.py +7 -0
- jaxcont-0.1.0/src/jaxcont/problems/bvp.py +58 -0
- jaxcont-0.1.0/src/jaxcont/problems/equilibrium.py +86 -0
- jaxcont-0.1.0/src/jaxcont/problems/periodic.py +120 -0
- jaxcont-0.1.0/src/jaxcont/solvers/__init__.py +6 -0
- jaxcont-0.1.0/src/jaxcont/solvers/corrector.py +49 -0
- jaxcont-0.1.0/src/jaxcont/solvers/newton.py +172 -0
- jaxcont-0.1.0/src/jaxcont/stability/__init__.py +6 -0
- jaxcont-0.1.0/src/jaxcont/stability/eigenvalue.py +138 -0
- jaxcont-0.1.0/src/jaxcont/stability/floquet.py +117 -0
- jaxcont-0.1.0/src/jaxcont/utils/__init__.py +22 -0
- jaxcont-0.1.0/src/jaxcont/utils/config.py +344 -0
- jaxcont-0.1.0/src/jaxcont/utils/plotting.py +246 -0
- jaxcont-0.1.0/src/jaxcont.egg-info/PKG-INFO +165 -0
- jaxcont-0.1.0/src/jaxcont.egg-info/SOURCES.txt +54 -0
- jaxcont-0.1.0/src/jaxcont.egg-info/dependency_links.txt +1 -0
- jaxcont-0.1.0/src/jaxcont.egg-info/requires.txt +26 -0
- jaxcont-0.1.0/src/jaxcont.egg-info/top_level.txt +1 -0
- jaxcont-0.1.0/tests/test_adaptive_stepsize.py +515 -0
- jaxcont-0.1.0/tests/test_bifurcation_workflow.py +177 -0
- jaxcont-0.1.0/tests/test_bifurcations.py +45 -0
- jaxcont-0.1.0/tests/test_bisection.py +329 -0
- jaxcont-0.1.0/tests/test_bordered_newton.py +413 -0
- jaxcont-0.1.0/tests/test_continuation.py +72 -0
- jaxcont-0.1.0/tests/test_functional_api.py +201 -0
- jaxcont-0.1.0/tests/test_gpu_smoke.py +134 -0
- jaxcont-0.1.0/tests/test_newton.py +59 -0
- jaxcont-0.1.0/tests/test_newton_jit.py +234 -0
- jaxcont-0.1.0/tests/test_pseudo_arclength.py +474 -0
- jaxcont-0.1.0/tests/test_stability.py +144 -0
- jaxcont-0.1.0/tests/test_taxonomy.py +56 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use JaxCont in your research, please cite the archived release."
|
|
3
|
+
title: "JaxCont: Differentiable Continuation and Bifurcation Analysis in JAX"
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Ziaeemehr
|
|
7
|
+
given-names: Abolfazl
|
|
8
|
+
repository-code: "https://github.com/Ziaeemehr/JaxCont"
|
|
9
|
+
url: "https://jaxcont.readthedocs.io"
|
|
10
|
+
license: MIT
|
|
11
|
+
version: 0.1.0
|
jaxcont-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 JaxCont Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
jaxcont-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jaxcont
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: High-performance continuation and bifurcation analysis in JAX
|
|
5
|
+
Author-email: Abolfazl Ziaeemehr <a.ziaeemehr@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Ziaeemehr/JaxCont
|
|
8
|
+
Project-URL: Documentation, https://jaxcont.readthedocs.io
|
|
9
|
+
Project-URL: Repository, https://github.com/Ziaeemehr/JaxCont
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/Ziaeemehr/JaxCont/issues
|
|
11
|
+
Project-URL: Changelog, https://jaxcont.readthedocs.io/en/latest/changelog.html
|
|
12
|
+
Keywords: bifurcation,continuation,dynamical-systems,jax,numerical-analysis
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: jax>=0.3.0
|
|
26
|
+
Requires-Dist: jaxlib>=0.3.0
|
|
27
|
+
Requires-Dist: numpy>=1.21.0
|
|
28
|
+
Requires-Dist: scipy>=1.7.0
|
|
29
|
+
Requires-Dist: matplotlib>=3.5.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: mypy>=1.5.0; extra == "dev"
|
|
36
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
37
|
+
Requires-Dist: sphinx>=7.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: sphinx-book-theme>=1.1.0; extra == "dev"
|
|
39
|
+
Requires-Dist: sphinx-gallery>=0.19.0; extra == "dev"
|
|
40
|
+
Requires-Dist: jupyter>=1.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: ipython>=8.12.0; extra == "dev"
|
|
42
|
+
Requires-Dist: build>=1.2.0; extra == "dev"
|
|
43
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
44
|
+
Provides-Extra: docs
|
|
45
|
+
Requires-Dist: sphinx>=7.0.0; extra == "docs"
|
|
46
|
+
Requires-Dist: sphinx-book-theme>=1.1.0; extra == "docs"
|
|
47
|
+
Requires-Dist: sphinx-gallery>=0.19.0; extra == "docs"
|
|
48
|
+
Requires-Dist: myst-parser>=2.0.0; extra == "docs"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# JaxCont
|
|
52
|
+
|
|
53
|
+
**Vectorize whole continuation sweeps with `jax.vmap`, and differentiate
|
|
54
|
+
bifurcation locations with `jax.grad`.**
|
|
55
|
+
|
|
56
|
+
[](https://github.com/Ziaeemehr/JaxCont/actions/workflows/tests.yml)
|
|
57
|
+
[](https://jaxcont.readthedocs.io/latest/)
|
|
58
|
+
[](https://pypi.org/project/jaxcont/)
|
|
59
|
+
[](LICENSE)
|
|
60
|
+
|
|
61
|
+
JaxCont is an equilibrium continuation and bifurcation-analysis library built
|
|
62
|
+
around JAX transformations. Its whole-loop pseudo-arclength engine is a pure,
|
|
63
|
+
compiled computation: use `vmap` to compute ensembles of branches in one
|
|
64
|
+
batched kernel, `jacfwd` to differentiate through a sweep, or the implicit
|
|
65
|
+
`fold_parameter` solver for reverse-mode gradients of a fold location.
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
# One compiled kernel computes a branch for every design value.
|
|
69
|
+
branches = jax.vmap(run_branch)(design_values)
|
|
70
|
+
|
|
71
|
+
# A fold location can participate in gradient-based inverse design.
|
|
72
|
+
dp_dtheta = jax.grad(
|
|
73
|
+
lambda theta: jc.fold_parameter(f, u_guess, p_guess, theta)
|
|
74
|
+
)(theta)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The v0.1 series deliberately focuses on equilibria: natural and
|
|
78
|
+
pseudo-arclength continuation, fold and Hopf detection with refinement,
|
|
79
|
+
linear stability, and bifurcation diagrams. Periodic orbits, Floquet
|
|
80
|
+
multipliers, boundary-value problems, branch switching, and two-parameter
|
|
81
|
+
continuation are not part of the supported v0.1 API.
|
|
82
|
+
|
|
83
|
+
## Installation
|
|
84
|
+
|
|
85
|
+
JaxCont requires Python 3.9 or newer.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install jaxcont
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For a development checkout:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone https://github.com/Ziaeemehr/JaxCont.git
|
|
95
|
+
cd JaxCont
|
|
96
|
+
python -m pip install -e ".[dev]"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
JAX's platform-specific accelerator installation is documented in the
|
|
100
|
+
[JAX installation guide](https://docs.jax.dev/en/latest/installation.html).
|
|
101
|
+
|
|
102
|
+
## Quick start
|
|
103
|
+
|
|
104
|
+
Continue the positive branch of `u² + p = 0` through its fold at `p = 0`:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import jax.numpy as jnp
|
|
108
|
+
import jaxcont as jc
|
|
109
|
+
|
|
110
|
+
def saddle_node(u, p, args):
|
|
111
|
+
return u**2 + p
|
|
112
|
+
|
|
113
|
+
problem = jc.bif_problem(saddle_node, u0=jnp.array([1.0]), p0=-1.0)
|
|
114
|
+
result = jc.continuation(
|
|
115
|
+
problem,
|
|
116
|
+
p_span=(-1.0, 0.2),
|
|
117
|
+
settings=jc.ContinuationPar(ds=0.03, max_steps=200),
|
|
118
|
+
events=[jc.Fold()],
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
print(result.branch.params)
|
|
122
|
+
print([(event.kind, event.p) for event in result.events])
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`PseudoArclength(engine="scan")` is the default algorithm. It uses the
|
|
126
|
+
whole-loop compiled engine, computes stability in a vectorized post-pass, and
|
|
127
|
+
refines requested fold/Hopf events. Use `jc.Natural()` for natural-parameter
|
|
128
|
+
continuation or `jc.PseudoArclength(engine="legacy")` only when comparing with
|
|
129
|
+
the compatibility implementation.
|
|
130
|
+
|
|
131
|
+
See the [quickstart](https://jaxcont.readthedocs.io/en/latest/quickstart.html),
|
|
132
|
+
[Sphinx-Gallery examples](https://jaxcont.readthedocs.io/en/latest/auto_examples/index.html),
|
|
133
|
+
[`example_06_vmap_sweep.py`](examples/example_06_vmap_sweep.py), and
|
|
134
|
+
[`example_07_differentiable.py`](examples/example_07_differentiable.py) for the
|
|
135
|
+
full `vmap`, `jacfwd`, and inverse-design stories.
|
|
136
|
+
|
|
137
|
+
## Development
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
python -m pytest
|
|
141
|
+
make docs
|
|
142
|
+
python -m build
|
|
143
|
+
python -m twine check dist/*
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md). The project
|
|
147
|
+
roadmap and supported scope live in [notes/ROADMAP.md](notes/ROADMAP.md).
|
|
148
|
+
|
|
149
|
+
## Citation
|
|
150
|
+
|
|
151
|
+
If JaxCont supports your research, cite the archived release using the DOI in
|
|
152
|
+
the GitHub/Zenodo release record. Citation metadata is also provided in
|
|
153
|
+
[`CITATION.cff`](CITATION.cff). Until the first archive is minted:
|
|
154
|
+
|
|
155
|
+
```bibtex
|
|
156
|
+
@software{ziaeemehr_jaxcont_2026,
|
|
157
|
+
author = {Ziaeemehr, Abolfazl},
|
|
158
|
+
title = {JaxCont: Differentiable Continuation and Bifurcation Analysis in JAX},
|
|
159
|
+
year = {2026},
|
|
160
|
+
version = {0.1.0},
|
|
161
|
+
url = {https://github.com/Ziaeemehr/JaxCont}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
JaxCont is distributed under the [MIT License](LICENSE).
|
jaxcont-0.1.0/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# JaxCont
|
|
2
|
+
|
|
3
|
+
**Vectorize whole continuation sweeps with `jax.vmap`, and differentiate
|
|
4
|
+
bifurcation locations with `jax.grad`.**
|
|
5
|
+
|
|
6
|
+
[](https://github.com/Ziaeemehr/JaxCont/actions/workflows/tests.yml)
|
|
7
|
+
[](https://jaxcont.readthedocs.io/latest/)
|
|
8
|
+
[](https://pypi.org/project/jaxcont/)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
JaxCont is an equilibrium continuation and bifurcation-analysis library built
|
|
12
|
+
around JAX transformations. Its whole-loop pseudo-arclength engine is a pure,
|
|
13
|
+
compiled computation: use `vmap` to compute ensembles of branches in one
|
|
14
|
+
batched kernel, `jacfwd` to differentiate through a sweep, or the implicit
|
|
15
|
+
`fold_parameter` solver for reverse-mode gradients of a fold location.
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
# One compiled kernel computes a branch for every design value.
|
|
19
|
+
branches = jax.vmap(run_branch)(design_values)
|
|
20
|
+
|
|
21
|
+
# A fold location can participate in gradient-based inverse design.
|
|
22
|
+
dp_dtheta = jax.grad(
|
|
23
|
+
lambda theta: jc.fold_parameter(f, u_guess, p_guess, theta)
|
|
24
|
+
)(theta)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The v0.1 series deliberately focuses on equilibria: natural and
|
|
28
|
+
pseudo-arclength continuation, fold and Hopf detection with refinement,
|
|
29
|
+
linear stability, and bifurcation diagrams. Periodic orbits, Floquet
|
|
30
|
+
multipliers, boundary-value problems, branch switching, and two-parameter
|
|
31
|
+
continuation are not part of the supported v0.1 API.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
JaxCont requires Python 3.9 or newer.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install jaxcont
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For a development checkout:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git clone https://github.com/Ziaeemehr/JaxCont.git
|
|
45
|
+
cd JaxCont
|
|
46
|
+
python -m pip install -e ".[dev]"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
JAX's platform-specific accelerator installation is documented in the
|
|
50
|
+
[JAX installation guide](https://docs.jax.dev/en/latest/installation.html).
|
|
51
|
+
|
|
52
|
+
## Quick start
|
|
53
|
+
|
|
54
|
+
Continue the positive branch of `u² + p = 0` through its fold at `p = 0`:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import jax.numpy as jnp
|
|
58
|
+
import jaxcont as jc
|
|
59
|
+
|
|
60
|
+
def saddle_node(u, p, args):
|
|
61
|
+
return u**2 + p
|
|
62
|
+
|
|
63
|
+
problem = jc.bif_problem(saddle_node, u0=jnp.array([1.0]), p0=-1.0)
|
|
64
|
+
result = jc.continuation(
|
|
65
|
+
problem,
|
|
66
|
+
p_span=(-1.0, 0.2),
|
|
67
|
+
settings=jc.ContinuationPar(ds=0.03, max_steps=200),
|
|
68
|
+
events=[jc.Fold()],
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
print(result.branch.params)
|
|
72
|
+
print([(event.kind, event.p) for event in result.events])
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`PseudoArclength(engine="scan")` is the default algorithm. It uses the
|
|
76
|
+
whole-loop compiled engine, computes stability in a vectorized post-pass, and
|
|
77
|
+
refines requested fold/Hopf events. Use `jc.Natural()` for natural-parameter
|
|
78
|
+
continuation or `jc.PseudoArclength(engine="legacy")` only when comparing with
|
|
79
|
+
the compatibility implementation.
|
|
80
|
+
|
|
81
|
+
See the [quickstart](https://jaxcont.readthedocs.io/en/latest/quickstart.html),
|
|
82
|
+
[Sphinx-Gallery examples](https://jaxcont.readthedocs.io/en/latest/auto_examples/index.html),
|
|
83
|
+
[`example_06_vmap_sweep.py`](examples/example_06_vmap_sweep.py), and
|
|
84
|
+
[`example_07_differentiable.py`](examples/example_07_differentiable.py) for the
|
|
85
|
+
full `vmap`, `jacfwd`, and inverse-design stories.
|
|
86
|
+
|
|
87
|
+
## Development
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
python -m pytest
|
|
91
|
+
make docs
|
|
92
|
+
python -m build
|
|
93
|
+
python -m twine check dist/*
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md). The project
|
|
97
|
+
roadmap and supported scope live in [notes/ROADMAP.md](notes/ROADMAP.md).
|
|
98
|
+
|
|
99
|
+
## Citation
|
|
100
|
+
|
|
101
|
+
If JaxCont supports your research, cite the archived release using the DOI in
|
|
102
|
+
the GitHub/Zenodo release record. Citation metadata is also provided in
|
|
103
|
+
[`CITATION.cff`](CITATION.cff). Until the first archive is minted:
|
|
104
|
+
|
|
105
|
+
```bibtex
|
|
106
|
+
@software{ziaeemehr_jaxcont_2026,
|
|
107
|
+
author = {Ziaeemehr, Abolfazl},
|
|
108
|
+
title = {JaxCont: Differentiable Continuation and Bifurcation Analysis in JAX},
|
|
109
|
+
year = {2026},
|
|
110
|
+
version = {0.1.0},
|
|
111
|
+
url = {https://github.com/Ziaeemehr/JaxCont}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
JaxCont is distributed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
JaxCont example gallery
|
|
2
|
+
=======================
|
|
3
|
+
|
|
4
|
+
These executable examples progress from classical equilibrium continuation to
|
|
5
|
+
the capabilities that distinguish JaxCont: batched whole-branch computation
|
|
6
|
+
with :func:`jax.vmap` and differentiable bifurcation locations.
|
|
7
|
+
|
|
8
|
+
The documentation build generates a downloadable Python script and Jupyter
|
|
9
|
+
notebook for every example. Output execution is opt-in; see ``docs/README.md``.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "jaxcont"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "High-performance continuation and bifurcation analysis in JAX"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "Abolfazl Ziaeemehr", email = "a.ziaeemehr@gmail.com"}
|
|
15
|
+
]
|
|
16
|
+
keywords = ["bifurcation", "continuation", "dynamical-systems", "jax", "numerical-analysis"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
dependencies = [
|
|
30
|
+
"jax>=0.3.0",
|
|
31
|
+
"jaxlib>=0.3.0",
|
|
32
|
+
"numpy>=1.21.0",
|
|
33
|
+
"scipy>=1.7.0",
|
|
34
|
+
"matplotlib>=3.5.0",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=7.4.0",
|
|
40
|
+
"pytest-cov>=4.1.0",
|
|
41
|
+
"black>=23.0.0",
|
|
42
|
+
"flake8>=6.0.0",
|
|
43
|
+
"mypy>=1.5.0",
|
|
44
|
+
"isort>=5.12.0",
|
|
45
|
+
"sphinx>=7.0.0",
|
|
46
|
+
"sphinx-book-theme>=1.1.0",
|
|
47
|
+
"sphinx-gallery>=0.19.0",
|
|
48
|
+
"jupyter>=1.0.0",
|
|
49
|
+
"ipython>=8.12.0",
|
|
50
|
+
"build>=1.2.0",
|
|
51
|
+
"twine>=5.0.0",
|
|
52
|
+
]
|
|
53
|
+
docs = [
|
|
54
|
+
"sphinx>=7.0.0",
|
|
55
|
+
"sphinx-book-theme>=1.1.0",
|
|
56
|
+
"sphinx-gallery>=0.19.0",
|
|
57
|
+
"myst-parser>=2.0.0",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[project.urls]
|
|
61
|
+
Homepage = "https://github.com/Ziaeemehr/JaxCont"
|
|
62
|
+
Documentation = "https://jaxcont.readthedocs.io"
|
|
63
|
+
Repository = "https://github.com/Ziaeemehr/JaxCont"
|
|
64
|
+
"Bug Tracker" = "https://github.com/Ziaeemehr/JaxCont/issues"
|
|
65
|
+
Changelog = "https://jaxcont.readthedocs.io/en/latest/changelog.html"
|
|
66
|
+
|
|
67
|
+
[tool.setuptools.packages.find]
|
|
68
|
+
where = ["src"]
|
|
69
|
+
|
|
70
|
+
[tool.setuptools.dynamic]
|
|
71
|
+
version = {attr = "jaxcont._version.__version__"}
|
|
72
|
+
|
|
73
|
+
[tool.pytest.ini_options]
|
|
74
|
+
testpaths = ["tests"]
|
|
75
|
+
python_files = ["test_*.py"]
|
|
76
|
+
python_classes = ["Test*"]
|
|
77
|
+
python_functions = ["test_*"]
|
|
78
|
+
# Fast by default: no coverage instrumentation, slow tests excluded, and GPU
|
|
79
|
+
# tests excluded (they self-skip on CPU-only runners anyway, but excluding
|
|
80
|
+
# them here keeps `pytest` quiet-by-default on GPU dev machines too -- see
|
|
81
|
+
# tests/test_gpu_smoke.py). Run everything with `make test-all`; coverage
|
|
82
|
+
# with `make test-cov`; GPU smoke tests explicitly with `pytest -m gpu`.
|
|
83
|
+
addopts = "-q -m 'not slow and not gpu'"
|
|
84
|
+
|
|
85
|
+
[tool.black]
|
|
86
|
+
line-length = 100
|
|
87
|
+
target-version = ['py39', 'py310', 'py311']
|
|
88
|
+
include = '\.pyi?$'
|
|
89
|
+
|
|
90
|
+
[tool.isort]
|
|
91
|
+
profile = "black"
|
|
92
|
+
line_length = 100
|
|
93
|
+
multi_line_output = 3
|
|
94
|
+
|
|
95
|
+
[tool.mypy]
|
|
96
|
+
python_version = "3.9"
|
|
97
|
+
warn_return_any = true
|
|
98
|
+
warn_unused_configs = true
|
|
99
|
+
disallow_untyped_defs = false
|
|
100
|
+
ignore_missing_imports = true
|
jaxcont-0.1.0/setup.cfg
ADDED
jaxcont-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""
|
|
2
|
+
JaxCont: High-Performance Continuation and Bifurcation Analysis in JAX
|
|
3
|
+
|
|
4
|
+
A modern Python package for numerical continuation and bifurcation analysis
|
|
5
|
+
of dynamical systems, leveraging JAX's automatic differentiation and JIT
|
|
6
|
+
compilation for exceptional performance.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from jaxcont._version import __version__
|
|
10
|
+
|
|
11
|
+
__author__ = "Abolfazl Ziaeemehr"
|
|
12
|
+
__license__ = "MIT"
|
|
13
|
+
|
|
14
|
+
# Functional API -- the blessed public surface: bif_problem() + continuation()
|
|
15
|
+
from jaxcont.api import (
|
|
16
|
+
BifProblem,
|
|
17
|
+
bif_problem,
|
|
18
|
+
continuation,
|
|
19
|
+
ContinuationPar,
|
|
20
|
+
ContinuationAlgorithm,
|
|
21
|
+
PseudoArclength,
|
|
22
|
+
Natural,
|
|
23
|
+
Event,
|
|
24
|
+
Fold,
|
|
25
|
+
Hopf,
|
|
26
|
+
EventHit,
|
|
27
|
+
Branch,
|
|
28
|
+
ContinuationResult,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# Core imports
|
|
32
|
+
from jaxcont.core.continuation import (
|
|
33
|
+
ContinuationProblem,
|
|
34
|
+
ContinuationSolution,
|
|
35
|
+
equilibrium_continuation,
|
|
36
|
+
)
|
|
37
|
+
from jaxcont.core.predictor_corrector import PredictorCorrector
|
|
38
|
+
from jaxcont.core.natural_continuation import NaturalContinuation
|
|
39
|
+
from jaxcont.core.pseudo_arclength import PseudoArclengthContinuation
|
|
40
|
+
|
|
41
|
+
# Problem definitions
|
|
42
|
+
from jaxcont.problems.equilibrium import EquilibriumProblem
|
|
43
|
+
|
|
44
|
+
# Differentiable fold solver (reverse-mode grad of a fold location via the
|
|
45
|
+
# implicit function theorem -- see examples/example_07_differentiable.py)
|
|
46
|
+
from jaxcont.bifurcations.fold_solve import fold_point, fold_parameter
|
|
47
|
+
|
|
48
|
+
# Bifurcation detection
|
|
49
|
+
from jaxcont.bifurcations.detector import BifurcationDetector
|
|
50
|
+
from jaxcont.bifurcations.fold import FoldBifurcation
|
|
51
|
+
from jaxcont.bifurcations.hopf import HopfBifurcation
|
|
52
|
+
|
|
53
|
+
# Solvers
|
|
54
|
+
from jaxcont.solvers.newton import NewtonSolver
|
|
55
|
+
from jaxcont.solvers.corrector import Corrector
|
|
56
|
+
|
|
57
|
+
# Stability analysis
|
|
58
|
+
from jaxcont.stability.eigenvalue import compute_eigenvalues, analyze_stability
|
|
59
|
+
|
|
60
|
+
# NOTE: v0.1.0 ships equilibria only. Periodic-orbit / Floquet / BVP / period-
|
|
61
|
+
# doubling APIs are experimental stubs and are intentionally NOT exported at
|
|
62
|
+
# the top level (see the project roadmap). They remain importable from their
|
|
63
|
+
# submodules for development, e.g.:
|
|
64
|
+
# from jaxcont.problems.periodic import PeriodicOrbitProblem
|
|
65
|
+
# from jaxcont.stability.floquet import compute_floquet_multipliers
|
|
66
|
+
|
|
67
|
+
# Utilities
|
|
68
|
+
from jaxcont.utils.config import Config
|
|
69
|
+
from jaxcont.utils.plotting import plot_bifurcation_diagram, plot_continuation
|
|
70
|
+
|
|
71
|
+
__all__ = [
|
|
72
|
+
# Functional API (blessed surface)
|
|
73
|
+
"BifProblem",
|
|
74
|
+
"bif_problem",
|
|
75
|
+
"continuation",
|
|
76
|
+
"ContinuationPar",
|
|
77
|
+
"ContinuationAlgorithm",
|
|
78
|
+
"PseudoArclength",
|
|
79
|
+
"Natural",
|
|
80
|
+
"Event",
|
|
81
|
+
"Fold",
|
|
82
|
+
"Hopf",
|
|
83
|
+
"EventHit",
|
|
84
|
+
"Branch",
|
|
85
|
+
"ContinuationResult",
|
|
86
|
+
"fold_point",
|
|
87
|
+
"fold_parameter",
|
|
88
|
+
# Core
|
|
89
|
+
"ContinuationProblem",
|
|
90
|
+
"ContinuationSolution",
|
|
91
|
+
"equilibrium_continuation",
|
|
92
|
+
"PredictorCorrector",
|
|
93
|
+
"NaturalContinuation",
|
|
94
|
+
"PseudoArclengthContinuation",
|
|
95
|
+
# Problems
|
|
96
|
+
"EquilibriumProblem",
|
|
97
|
+
# Bifurcations
|
|
98
|
+
"BifurcationDetector",
|
|
99
|
+
"FoldBifurcation",
|
|
100
|
+
"HopfBifurcation",
|
|
101
|
+
# Solvers
|
|
102
|
+
"NewtonSolver",
|
|
103
|
+
"Corrector",
|
|
104
|
+
# Stability
|
|
105
|
+
"compute_eigenvalues",
|
|
106
|
+
"analyze_stability",
|
|
107
|
+
# Utilities
|
|
108
|
+
"Config",
|
|
109
|
+
"plot_bifurcation_diagram",
|
|
110
|
+
"plot_continuation",
|
|
111
|
+
]
|