dynamiqs 0.2.2__tar.gz → 0.2.3__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.
- dynamiqs-0.2.3/CONTRIBUTING.md +159 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/LICENSE +3 -0
- dynamiqs-0.2.3/NOTICE +33 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/PKG-INFO +19 -18
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/README.md +7 -7
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/README_PYPI.md +13 -13
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/community/citing.md +2 -2
- dynamiqs-0.2.3/docs/community/contributing.md +161 -0
- dynamiqs-0.2.3/docs/documentation/advanced_examples/kerr-oscillator.md +381 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/getting_started/examples.md +1 -1
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/getting_started/whatis.md +2 -2
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/index.md +4 -2
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/python_api/index.md +2 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/stylesheets/extra.css +16 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/stylesheets/theme.css +8 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/__init__.py +1 -1
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/__init__.py +2 -1
- dynamiqs-0.2.3/dynamiqs/integrators/_utils.py +192 -0
- dynamiqs-0.2.3/dynamiqs/integrators/apis/floquet.py +181 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/mepropagator.py +28 -51
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/mesolve.py +32 -52
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/sepropagator.py +9 -11
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/sesolve.py +17 -29
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/diffrax_integrator.py +11 -9
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/expm_integrator.py +1 -1
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/interfaces.py +5 -0
- dynamiqs-0.2.3/dynamiqs/integrators/floquet/floquet_integrator.py +51 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/mesolve/rouchon_integrator.py +4 -4
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/wigner.py +1 -1
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/random.py +1 -1
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/result.py +52 -1
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/solver.py +7 -7
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/time_array.py +22 -13
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/jax_utils.py +1 -1
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/operators.py +47 -41
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/optimal_control.py +1 -1
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/quantum_utils/general.py +29 -21
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/states.py +24 -22
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/vectorization.py +12 -4
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/mkdocs.yml +5 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/pyproject.toml +6 -4
- dynamiqs-0.2.3/tests/floquet/floquet_qubit.py +99 -0
- dynamiqs-0.2.3/tests/floquet/test_adaptive.py +34 -0
- dynamiqs-0.2.3/tests/floquet/test_batching.py +32 -0
- dynamiqs-0.2.3/tests/sesolve/__init__.py +0 -0
- dynamiqs-0.2.3/tests/utils/__init__.py +0 -0
- dynamiqs-0.2.2/CONTRIBUTING.md +0 -91
- dynamiqs-0.2.2/docs/community/contributing.md +0 -95
- dynamiqs-0.2.2/dynamiqs/integrators/_utils.py +0 -209
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/.github/workflows/ci.yml +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/.github/workflows/publish-doc.yml +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/.gitignore +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/.pre-commit-config.yaml +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/CNAME +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/community/index.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/community/lets-talk.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/conftest.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/batching-simulations.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/closed-systems.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/computing-gradients.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/open-systems.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/time-dependent-operators.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/workflow.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/getting_started/installation.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/getting_started/sharp-bits.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/figs_code/.gitkeep +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/figs_docs/.gitkeep +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/generate_python_api.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/glossary.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/hooks.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/index.md +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/javascripts/katex.js +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/favicon.png +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/favicon.svg +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-large.png +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-typeface-darktype.png +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-typeface-lighttype.png +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-white-large.png +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-white.png +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo.png +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/overrides/home.html +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/overrides/main.html +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/overrides/partials/content.html +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/overrides/partials/header.html +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/remove_figs.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/stylesheets/home.css +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/class.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/admonition.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/attributes.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/examples.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/functions.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/parameters.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/raises.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/returns.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/function.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/module.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/table.html.jinja +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/_checks.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/_utils.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/conftest.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/dark/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/dark/dark.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/gradient.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/smesolve.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/abstract_integrator.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/save_mixin.py +0 -0
- {dynamiqs-0.2.2/dynamiqs/integrators/mepropagator → dynamiqs-0.2.3/dynamiqs/integrators/floquet}/__init__.py +0 -0
- {dynamiqs-0.2.2/dynamiqs/integrators/mesolve → dynamiqs-0.2.3/dynamiqs/integrators/mepropagator}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/mepropagator/expm_integrator.py +0 -0
- {dynamiqs-0.2.2/dynamiqs/integrators/sepropagator → dynamiqs-0.2.3/dynamiqs/integrators/mesolve}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/mesolve/diffrax_integrator.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/mesolve/expm_integrator.py +0 -0
- {dynamiqs-0.2.2/dynamiqs/integrators/sesolve → dynamiqs-0.2.3/dynamiqs/integrators/sepropagator}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/sepropagator/diffrax_integrator.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/sepropagator/expm_integrator.py +0 -0
- {dynamiqs-0.2.2/dynamiqs/integrators/smesolve → dynamiqs-0.2.3/dynamiqs/integrators/sesolve}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/sesolve/diffrax_integrator.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/sesolve/expm_integrator.py +0 -0
- {dynamiqs-0.2.2/tests → dynamiqs-0.2.3/dynamiqs/integrators/smesolve}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/options.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/__init__.py +5 -5
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/colormaps.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/fock.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/hinton.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/misc.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/utils.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/progress_meter.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/quantum_utils/__init__.py +21 -21
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/quantum_utils/wigner.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/pytest.ini +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/README.md +0 -0
- {dynamiqs-0.2.2/tests/mepropagator → dynamiqs-0.2.3/tests}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/conftest.py +0 -0
- {dynamiqs-0.2.2/tests/mesolve → dynamiqs-0.2.3/tests/floquet}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/integrator_tester.py +0 -0
- {dynamiqs-0.2.2/tests/sepropagator → dynamiqs-0.2.3/tests/mepropagator}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mepropagator/mepropagator_utils.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mepropagator/test_batching.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mepropagator/test_expm.py +0 -0
- {dynamiqs-0.2.2/tests/sesolve → dynamiqs-0.2.3/tests/mesolve}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/open_system.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_adaptive.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_batching.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_euler.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_expm.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_rouchon.py +0 -0
- {dynamiqs-0.2.2/tests/utils → dynamiqs-0.2.3/tests/sepropagator}/__init__.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sepropagator/test_sepropagator.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/closed_system.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/test_adaptive.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/test_batching.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/test_euler.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/test_expm.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/system.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/test_plot.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/test_time_array.py +0 -0
- {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/utils/test_utils.py +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Contributing to Dynamiqs
|
|
2
|
+
|
|
3
|
+
We warmly welcome all contributions. If you're a junior developer or physicist, you can start with a small utility function, and move on to bigger problems as you discover the library's internals. If you're more experienced and want to implement more advanced features, don't hesitate to [get in touch](https://github.com/dynamiqs/dynamiqs#lets-talk) to discuss what would suit you.
|
|
4
|
+
|
|
5
|
+
To contribute efficiently, a few guidelines are compiled below.
|
|
6
|
+
|
|
7
|
+
## 1. Requirements
|
|
8
|
+
|
|
9
|
+
The project was written using Python 3.9+, you must have a compatible version of Python (i.e. >= 3.9) installed on your computer.
|
|
10
|
+
|
|
11
|
+
## 2. Setup
|
|
12
|
+
|
|
13
|
+
Clone the repository and dive in:
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
git clone git@github.com:dynamiqs/dynamiqs.git
|
|
17
|
+
cd dynamiqs
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
To install the library with all its dependencies, as well as the developer dependencies:
|
|
21
|
+
|
|
22
|
+
- **If you use `uv`**, just run:
|
|
23
|
+
```shell
|
|
24
|
+
uv sync --extra dev
|
|
25
|
+
```
|
|
26
|
+
- **If you use `pip`**, we strongly recommend creating a virtual environment to install the project dependencies. You can then install the library in editable mode:
|
|
27
|
+
```shell
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 3. Workflow
|
|
32
|
+
|
|
33
|
+
### Github flow
|
|
34
|
+
|
|
35
|
+
We use the GitHub flow branch-based workflow to collaborate on the library. If you're unfamiliar with open-source development, you can follow the [GitHub flow tutorial](https://docs.github.com/en/get-started/using-github/github-flow). Briefly, to add a change you should: fork the repository, create a branch, make and commit your changes, create a pull request (PR), address review comments, and merge the PR.
|
|
36
|
+
|
|
37
|
+
### Planning your change
|
|
38
|
+
|
|
39
|
+
If you are planning a large change (more than one hundred lines of code), it is usually more efficient to discuss it with us beforehand. This way, we can agree on the API and the main logic. For structural or significant changes, we typically write and iterate on small RFCs (Requests for Comments). For large change, please separate the logical building blocks of your change into distinct pull requests as much as possible. Long PRs are harder to review, and breaking them down will make everyone's life easier.
|
|
40
|
+
|
|
41
|
+
If the proposed change is necessary for your work and has not been reviewed within reasonable time (a few working days), don’t hesitate to ping the main developers directly on the PR.
|
|
42
|
+
|
|
43
|
+
### Developer tools
|
|
44
|
+
|
|
45
|
+
We use a variety of modern formatting and linting tools, as well as automated tests, to ensure high code quality and to identify bugs early in the development process. These tests can be run either together or individually using the `task` CLI tool, which is installed as part of the development dependencies.
|
|
46
|
+
|
|
47
|
+
Typically you should ensure all tasks run smoothly before submitting a new PR:
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
task all
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Here is a list of available tasks:
|
|
54
|
+
|
|
55
|
+
```shell
|
|
56
|
+
> task --list
|
|
57
|
+
lint lint the code (ruff)
|
|
58
|
+
format auto-format the code (ruff)
|
|
59
|
+
codespell check for misspellings (codespell)
|
|
60
|
+
clean clean the code (ruff + codespell)
|
|
61
|
+
test run the unit tests suite (pytest)
|
|
62
|
+
doctest-code check code docstrings examples (doctest)
|
|
63
|
+
doctest-docs check documentation examples (doctest)
|
|
64
|
+
doctest check all examples (doctest)
|
|
65
|
+
docbuild build the documentation website
|
|
66
|
+
docserve preview documentation website with hot-reloading
|
|
67
|
+
all run all tasks before a commit (ruff + codespell + pytest + doctest)
|
|
68
|
+
ci run all the CI checks
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Run tasks automatically before each commit
|
|
72
|
+
|
|
73
|
+
Alternatively, you can use `pre-commit` to automatically run the cleaning tasks (ruff + codespell) before each commit:
|
|
74
|
+
|
|
75
|
+
```shell
|
|
76
|
+
pip install pre-commit
|
|
77
|
+
pre-commit install
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Build the documentation
|
|
81
|
+
|
|
82
|
+
The documentation is built using [MkDocs](https://www.mkdocs.org/) and the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme. MkDocs generates a static website based on the markdown files in the `docs/` directory.
|
|
83
|
+
|
|
84
|
+
To preview the changes to the documentation as you edit the docstrings or the markdown files in `docs/`, we recommend starting a live preview server, which will automatically rebuild the website upon modifications:
|
|
85
|
+
|
|
86
|
+
```shell
|
|
87
|
+
task docserve
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Open <http://localhost:8000/> in your web browser to preview the documentation website.
|
|
91
|
+
|
|
92
|
+
You can build the static documentation website locally with:
|
|
93
|
+
|
|
94
|
+
```shell
|
|
95
|
+
task docbuild
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This will create a `site/` directory with the contents of the documentation website. You can then simply open `site/index.html` in your web browser to view the documentation website.
|
|
99
|
+
|
|
100
|
+
## 4. Style guide
|
|
101
|
+
|
|
102
|
+
This project adheres to PEP 8 guidelines. The maximum line length is **88** characters, and we recommend setting this limit in your IDE. Generally, our automatic cleaning task (`task clean`) will address most basic styling issues. If you have any remaining doubts, you can follow the conventions used throughout the library by looking at various files.
|
|
103
|
+
|
|
104
|
+
We strive to keep the codebase as maintainable, readable, and unified as possible. We would appreciate your help by following these guidelines in your next PR.
|
|
105
|
+
|
|
106
|
+
### Writing a PR
|
|
107
|
+
|
|
108
|
+
The main goal to keep in mind is that if someone reads a past PR, they should quickly gain a clear understanding of what the change was.
|
|
109
|
+
|
|
110
|
+
- Use a lower case name for your branch name.
|
|
111
|
+
- Choose a clear and precise title for your PR. We use the squash and merge strategy to incorporate changes, so the title of your PR will become the commit title in the `main` branch history. Refer to the [commit history of the `main` branch](https://github.com/dynamiqs/dynamiqs/commits/main/) for inspiration.
|
|
112
|
+
- If, after multiple reviews and iterations, the content of the PR no longer corresponds to the original description, please update the description.
|
|
113
|
+
|
|
114
|
+
### Adding a new function
|
|
115
|
+
|
|
116
|
+
When writing your function:
|
|
117
|
+
|
|
118
|
+
- Type all arguments of your function, and its return type.
|
|
119
|
+
- When typing a public function, use `ArrayLike` for array inputs (and `jnp.asarray()` to convert to a proper array), and `Array` for array outputs. See [JAX typing best practices](https://jax.readthedocs.io/en/latest/jax.typing.html#jax-typing-best-practices).
|
|
120
|
+
- Ensure you run `task docserve` to verify how the documentation for your function appears, and correct any issues with rendering.
|
|
121
|
+
- To type an array shape, use `...` to denote possible batch dimensions, use `n` for the Hilbert space dimension.
|
|
122
|
+
- To add an axis to an array, favor `[None, ...]` over `unsqueeze`.
|
|
123
|
+
- Favor `(...).sum(0)` over `jnp.sum(..., 0)`.
|
|
124
|
+
|
|
125
|
+
Make sure to add your function:
|
|
126
|
+
|
|
127
|
+
1. to the `__all__` variable at the top of the file (this is how we control namespaces to have everything available under `dq.*`),
|
|
128
|
+
2. to the `dynamiqs/mkdocs.yml` file (so it appears in the documentation and navigation),
|
|
129
|
+
3. to the `dynamiqs/docs/python_api/index.md` file (so it appears on the Python API page, which lists all the functions of the library).
|
|
130
|
+
|
|
131
|
+
### Writing a docstring
|
|
132
|
+
|
|
133
|
+
We use [Google-style docstrings](https://google.github.io/styleguide/pyguide.html#s3.8.1-comments-in-doc-strings) (see examples [here](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)) with a few quirks.
|
|
134
|
+
|
|
135
|
+
- Headers can include (in this order and with these names): `Args`, `Returns`, `Raises`, `Examples`, `See also`.
|
|
136
|
+
- You can use the admonitions (colored blocks in the documentation) `Note` and `Warning` if relevant.
|
|
137
|
+
- Avoid using `The` in arguments description, for example change `x: The quantum state.` to `x: Quantum state.`.
|
|
138
|
+
- Specify arguments type in `_(...)_` after the argument name and _only if it is necessary_. Adding a type can for example be useful to add a shape information for an array, or because the argument typing in the function signature is opaque.
|
|
139
|
+
|
|
140
|
+
### Documentation
|
|
141
|
+
|
|
142
|
+
- For internal links, use `[dq.Options][dynamiqs.Options]` for a class, `[dq.sesolve()][dynamiqs.sesolve]` for a function (explicitely include `()` in the function name), and `(doc page)(relative/path/to/file.md)` for another documentation page (note the parentheses instead of brackets).
|
|
143
|
+
- If you want to add an icon somewhere, use one of the `:material-*` (search the list [here](https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/)).
|
|
144
|
+
|
|
145
|
+
### Exceptions message
|
|
146
|
+
|
|
147
|
+
- Use one or multiple sentences starting with a capital letter and ending with a period.
|
|
148
|
+
- Use backticks ``` ` ``` to refer to a variable name or a function. Use `'` to refer to a string.
|
|
149
|
+
- Many exceptions arise from incorrect argument input; they should typically follow the format: `"Argument ... must ..., but ..."`.
|
|
150
|
+
|
|
151
|
+
Examples:
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
raise ValueError(f'Argument `H` must have shape (n, n), but has shape H.shape={H.shape}.')
|
|
155
|
+
raise ValueError(
|
|
156
|
+
"Argument `matmul_precision` should be a string 'low', 'high', or"
|
|
157
|
+
f" 'highest', but is '{matmul_precision}'."
|
|
158
|
+
)
|
|
159
|
+
```
|
|
@@ -199,3 +199,6 @@
|
|
|
199
199
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
200
|
See the License for the specific language governing permissions and
|
|
201
201
|
limitations under the License.
|
|
202
|
+
|
|
203
|
+
This project also includes code derived from QuTiP, licensed under the BSD 3-Clause
|
|
204
|
+
License. The BSD 3-Clause License can be found in the `NOTICE` file.
|
dynamiqs-0.2.3/NOTICE
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
=======================================================================
|
|
2
|
+
QuTiP's 3-Clause BSD License
|
|
3
|
+
=======================================================================
|
|
4
|
+
|
|
5
|
+
This project contains code derived from QuTiP, which is licensed under the BSD 3-Clause License. The original license is reproduced below:
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2011 to 2022 inclusive, QuTiP developers and contributors.
|
|
8
|
+
All rights reserved.
|
|
9
|
+
|
|
10
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
11
|
+
are permitted provided that the following conditions are met:
|
|
12
|
+
|
|
13
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
14
|
+
list of conditions and the following disclaimer.
|
|
15
|
+
|
|
16
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
17
|
+
this list of conditions and the following disclaimer in the documentation
|
|
18
|
+
and/or other materials provided with the distribution.
|
|
19
|
+
|
|
20
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
|
21
|
+
may be used to endorse or promote products derived from this software without
|
|
22
|
+
specific prior written permission.
|
|
23
|
+
|
|
24
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
25
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
26
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
28
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
29
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
30
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
31
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
32
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
33
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: dynamiqs
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: High-performance quantum systems simulation with JAX (GPU-accelerated & differentiable solvers).
|
|
5
|
-
Author-email: Pierre Guilmin <pierreguilmin@gmail.com>, Ronan Gautier <ron.gautier@gmail.com>, Adrien Bocquet <adrienbocquet38@gmail.com>, Elie Genois <elie.genois@usherbrooke.ca>
|
|
5
|
+
Author-email: Pierre Guilmin <pierreguilmin@gmail.com>, Ronan Gautier <ron.gautier@gmail.com>, Adrien Bocquet <adrienbocquet38@gmail.com>, Elie Genois <elie.genois@usherbrooke.ca>, Daniel Weiss <daniel.kamrath.weiss@gmail.com>
|
|
6
6
|
Requires-Python: >=3.9
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -16,7 +16,7 @@ Requires-Dist: matplotlib
|
|
|
16
16
|
Requires-Dist: tqdm
|
|
17
17
|
Requires-Dist: jax<0.4.34
|
|
18
18
|
Requires-Dist: jaxlib
|
|
19
|
-
Requires-Dist: jaxtyping
|
|
19
|
+
Requires-Dist: jaxtyping<=0.2.34
|
|
20
20
|
Requires-Dist: diffrax>=0.5.1
|
|
21
21
|
Requires-Dist: equinox
|
|
22
22
|
Requires-Dist: pillow
|
|
@@ -24,7 +24,7 @@ Requires-Dist: cmasher>=1.8.0
|
|
|
24
24
|
Requires-Dist: ipython
|
|
25
25
|
Requires-Dist: tqdm
|
|
26
26
|
Requires-Dist: taskipy ; extra == "dev"
|
|
27
|
-
Requires-Dist: ruff ; extra == "dev"
|
|
27
|
+
Requires-Dist: ruff>=0.8 ; extra == "dev"
|
|
28
28
|
Requires-Dist: codespell ; extra == "dev"
|
|
29
29
|
Requires-Dist: pytest>=8.0 ; extra == "dev"
|
|
30
30
|
Requires-Dist: pytest-sugar ; extra == "dev"
|
|
@@ -41,6 +41,7 @@ Requires-Dist: sybil>=6 ; extra == "dev"
|
|
|
41
41
|
Requires-Dist: black ; extra == "dev"
|
|
42
42
|
Requires-Dist: flit ; extra == "dev"
|
|
43
43
|
Requires-Dist: mike ; extra == "dev"
|
|
44
|
+
Requires-Dist: optax ; extra == "dev"
|
|
44
45
|
Project-URL: Documentation, https://www.dynamiqs.org/
|
|
45
46
|
Project-URL: Homepage, https://github.com/dynamiqs/dynamiqs
|
|
46
47
|
Project-URL: Repository, https://github.com/dynamiqs/dynamiqs
|
|
@@ -50,15 +51,15 @@ Provides-Extra: dev
|
|
|
50
51
|
<img alt="Dynamiqs logo" width="360" src="https://github.com/dynamiqs/dynamiqs/blob/main/docs/media/logo-typeface-darktype.png?raw=true">
|
|
51
52
|
</h1>
|
|
52
53
|
|
|
53
|
-
[P. Guilmin](https://github.com/pierreguilmin), [R. Gautier](https://github.com/gautierronan), [A. Bocquet](https://github.com/abocquet), [E. Genois](https://github.com/eliegenois)
|
|
54
|
+
[P. Guilmin](https://github.com/pierreguilmin), [R. Gautier](https://github.com/gautierronan), [A. Bocquet](https://github.com/abocquet), [E. Genois](https://github.com/eliegenois), [D. Weiss](https://github.com/dkweiss31)
|
|
54
55
|
|
|
55
56
|
[](https://github.com/dynamiqs/dynamiqs/actions/workflows/ci.yml?query=branch%3Amain)  [](https://join.slack.com/t/dynamiqs-org/shared_invite/zt-1z4mw08mo-qDLoNx19JBRtKzXlmlFYLA) [](https://github.com/dynamiqs/dynamiqs/blob/main/LICENSE) [](https://github.com/astral-sh/ruff)
|
|
56
57
|
|
|
57
58
|
High-performance quantum systems simulation with JAX.
|
|
58
59
|
|
|
59
|
-
**Dynamiqs** is a Python library for **GPU-accelerated** and **differentiable** quantum simulations. Solvers are available for the Schrödinger equation, the Lindblad master equation,
|
|
60
|
+
**Dynamiqs** is a Python library for **GPU-accelerated** and **differentiable** quantum simulations. Solvers are available for the Schrödinger equation, the Lindblad master equation, the stochastic master equation, and others. The library is built with [JAX](https://jax.readthedocs.io/en/latest/index.html) and the main solvers are based on [Diffrax](https://github.com/patrick-kidger/diffrax).
|
|
60
61
|
|
|
61
|
-
Documentation is available on our website, <https://www.dynamiqs.org>; see the [Python API](https://www.dynamiqs.org/python_api/index.html) for a list of all implemented functions.
|
|
62
|
+
Documentation is available on our website, <https://www.dynamiqs.org>; see the [Python API](https://www.dynamiqs.org/stable/python_api/index.html) for a list of all implemented functions.
|
|
62
63
|
|
|
63
64
|
The main features of **Dynamiqs** are:
|
|
64
65
|
|
|
@@ -69,7 +70,7 @@ The main features of **Dynamiqs** are:
|
|
|
69
70
|
|
|
70
71
|
We hope that this library will prove useful to the community for e.g. simulation of large quantum systems, gradient-based parameter estimation or quantum optimal control. The library is designed for large-scale problems, but also runs efficiently on CPUs for smaller problems.
|
|
71
72
|
|
|
72
|
-
⚠️ This library is under active development and
|
|
73
|
+
⚠️ This library is under active development and some APIs and solvers are still finding their footing. While most of the library is stable, new releases might introduce breaking changes.
|
|
73
74
|
|
|
74
75
|
## Installation
|
|
75
76
|
|
|
@@ -163,22 +164,22 @@ Gradient w.r.t. kappa : -3.3520
|
|
|
163
164
|
Gradient w.r.t. alpha0: 1.0670
|
|
164
165
|
```
|
|
165
166
|
|
|
166
|
-
ℹ️ On this specific example, we can verify the result analytically. The state remains a coherent state at all time with complex amplitude $\alpha(t) = \alpha_0 e^{-\kappa t/2} e^{i\omega t}$, and the final photon number is thus $\bar{n} = |\alpha(T)|^2 = \alpha_0^2 e^{-\kappa T}$. We can then compute the gradient with respect to the three parameters $\theta = (\omega, \kappa, \alpha_0)$:
|
|
167
|
+
ℹ️ On this specific example, we can verify the result analytically. The state remains a coherent state at all time with complex amplitude $\alpha(t) = \alpha_0 e^{-\kappa t/2} e^{-i\omega t}$, and the final photon number is thus $\bar{n} = |\alpha(T)|^2 = \alpha_0^2 e^{-\kappa T}$. We can then compute the gradient with respect to the three parameters $\theta = (\omega, \kappa, \alpha_0)$:
|
|
167
168
|
|
|
168
169
|
$$
|
|
169
170
|
\nabla_\theta\ \bar{n} = \begin{pmatrix}
|
|
170
|
-
\partial\bar{n} / \partial\omega
|
|
171
|
-
\partial\bar{n} / \partial\kappa
|
|
171
|
+
\partial\bar{n} / \partial\omega \\\\
|
|
172
|
+
\partial\bar{n} / \partial\kappa \\\\
|
|
172
173
|
\partial\bar{n} / \partial\alpha_0
|
|
173
174
|
\end{pmatrix}
|
|
174
175
|
= \begin{pmatrix}
|
|
175
|
-
0
|
|
176
|
-
-\alpha_0^2 T e^{-\kappa T}
|
|
176
|
+
0 \\\\
|
|
177
|
+
-\alpha_0^2 T e^{-\kappa T} \\\\
|
|
177
178
|
2 \alpha_0 e^{-\kappa T}
|
|
178
179
|
\end{pmatrix}
|
|
179
180
|
\approx \begin{pmatrix}
|
|
180
|
-
0.0
|
|
181
|
-
-3.3520
|
|
181
|
+
0.0 \\\\
|
|
182
|
+
-3.3520 \\\\
|
|
182
183
|
1.0670
|
|
183
184
|
\end{pmatrix}
|
|
184
185
|
$$
|
|
@@ -251,11 +252,11 @@ If you have found this library useful in your academic research, you can cite:
|
|
|
251
252
|
```bibtex
|
|
252
253
|
@unpublished{guilmin2024dynamiqs,
|
|
253
254
|
title = {Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems},
|
|
254
|
-
author = {Pierre Guilmin and Ronan Gautier and Adrien Bocquet and {\'{E}}lie Genois},
|
|
255
|
+
author = {Pierre Guilmin and Ronan Gautier and Adrien Bocquet and {\'{E}}lie Genois and Daniel Weiss},
|
|
255
256
|
year = {2024},
|
|
256
257
|
url = {https://github.com/dynamiqs/dynamiqs}
|
|
257
258
|
}
|
|
258
259
|
```
|
|
259
260
|
|
|
260
|
-
> P. Guilmin, R. Gautier, A. Bocquet, E. Genois. Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems (2024), in preparation.
|
|
261
|
+
> P. Guilmin, R. Gautier, A. Bocquet, E. Genois, D. Weiss. Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems (2024), in preparation.
|
|
261
262
|
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
</picture>
|
|
7
7
|
</h1>
|
|
8
8
|
|
|
9
|
-
[P. Guilmin](https://github.com/pierreguilmin), [R. Gautier](https://github.com/gautierronan), [A. Bocquet](https://github.com/abocquet), [E. Genois](https://github.com/eliegenois)
|
|
9
|
+
[P. Guilmin](https://github.com/pierreguilmin), [R. Gautier](https://github.com/gautierronan), [A. Bocquet](https://github.com/abocquet), [E. Genois](https://github.com/eliegenois), [D. Weiss](https://github.com/dkweiss31)
|
|
10
10
|
|
|
11
11
|
[](https://github.com/dynamiqs/dynamiqs/actions/workflows/ci.yml?query=branch%3Amain)  [](https://join.slack.com/t/dynamiqs-org/shared_invite/zt-1z4mw08mo-qDLoNx19JBRtKzXlmlFYLA) [](https://github.com/dynamiqs/dynamiqs/blob/main/LICENSE) [](https://github.com/astral-sh/ruff)
|
|
12
12
|
|
|
13
13
|
High-performance quantum systems simulation with JAX.
|
|
14
14
|
|
|
15
|
-
**Dynamiqs** is a Python library for **GPU-accelerated** and **differentiable** quantum simulations. Solvers are available for the Schrödinger equation, the Lindblad master equation,
|
|
15
|
+
**Dynamiqs** is a Python library for **GPU-accelerated** and **differentiable** quantum simulations. Solvers are available for the Schrödinger equation, the Lindblad master equation, the stochastic master equation, and others. The library is built with [JAX](https://jax.readthedocs.io/en/latest/index.html) and the main solvers are based on [Diffrax](https://github.com/patrick-kidger/diffrax).
|
|
16
16
|
|
|
17
|
-
Documentation is available on our website, <https://www.dynamiqs.org>; see the [Python API](https://www.dynamiqs.org/python_api/index.html) for a list of all implemented functions.
|
|
17
|
+
Documentation is available on our website, <https://www.dynamiqs.org>; see the [Python API](https://www.dynamiqs.org/stable/python_api/index.html) for a list of all implemented functions.
|
|
18
18
|
|
|
19
19
|
The main features of **Dynamiqs** are:
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ The main features of **Dynamiqs** are:
|
|
|
26
26
|
We hope that this library will prove useful to the community for e.g. simulation of large quantum systems, gradient-based parameter estimation or quantum optimal control. The library is designed for large-scale problems, but also runs efficiently on CPUs for smaller problems.
|
|
27
27
|
|
|
28
28
|
> [!WARNING]
|
|
29
|
-
> This library is under active development and
|
|
29
|
+
> This library is under active development and some APIs and solvers are still finding their footing. While most of the library is stable, new releases might introduce breaking changes.
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
@@ -122,7 +122,7 @@ Gradient w.r.t. alpha0: 1.0670
|
|
|
122
122
|
```
|
|
123
123
|
|
|
124
124
|
> [!Note]
|
|
125
|
-
> On this specific example, we can verify the result analytically. The state remains a coherent state at all time with complex amplitude $\alpha(t) = \alpha_0 e^{-\kappa t/2} e^{i\omega t}$, and the final photon number is thus $\bar{n} = |\alpha(T)|^2 = \alpha_0^2 e^{-\kappa T}$. We can then compute the gradient with respect to the three parameters $\theta = (\omega, \kappa, \alpha_0)$:
|
|
125
|
+
> On this specific example, we can verify the result analytically. The state remains a coherent state at all time with complex amplitude $\alpha(t) = \alpha_0 e^{-\kappa t/2} e^{-i\omega t}$, and the final photon number is thus $\bar{n} = |\alpha(T)|^2 = \alpha_0^2 e^{-\kappa T}$. We can then compute the gradient with respect to the three parameters $\theta = (\omega, \kappa, \alpha_0)$:
|
|
126
126
|
>
|
|
127
127
|
> $$
|
|
128
128
|
> \nabla_\theta\ \bar{n} = \begin{pmatrix}
|
|
@@ -210,10 +210,10 @@ If you have found this library useful in your academic research, you can cite:
|
|
|
210
210
|
```bibtex
|
|
211
211
|
@unpublished{guilmin2024dynamiqs,
|
|
212
212
|
title = {Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems},
|
|
213
|
-
author = {Pierre Guilmin and Ronan Gautier and Adrien Bocquet and {\'{E}}lie Genois},
|
|
213
|
+
author = {Pierre Guilmin and Ronan Gautier and Adrien Bocquet and {\'{E}}lie Genois and Daniel Weiss},
|
|
214
214
|
year = {2024},
|
|
215
215
|
url = {https://github.com/dynamiqs/dynamiqs}
|
|
216
216
|
}
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
-
> P. Guilmin, R. Gautier, A. Bocquet, E. Genois. Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems (2024), in preparation.
|
|
219
|
+
> P. Guilmin, R. Gautier, A. Bocquet, E. Genois, D. Weiss. Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems (2024), in preparation.
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
<img alt="Dynamiqs logo" width="360" src="https://github.com/dynamiqs/dynamiqs/blob/main/docs/media/logo-typeface-darktype.png?raw=true">
|
|
3
3
|
</h1>
|
|
4
4
|
|
|
5
|
-
[P. Guilmin](https://github.com/pierreguilmin), [R. Gautier](https://github.com/gautierronan), [A. Bocquet](https://github.com/abocquet), [E. Genois](https://github.com/eliegenois)
|
|
5
|
+
[P. Guilmin](https://github.com/pierreguilmin), [R. Gautier](https://github.com/gautierronan), [A. Bocquet](https://github.com/abocquet), [E. Genois](https://github.com/eliegenois), [D. Weiss](https://github.com/dkweiss31)
|
|
6
6
|
|
|
7
7
|
[](https://github.com/dynamiqs/dynamiqs/actions/workflows/ci.yml?query=branch%3Amain)  [](https://join.slack.com/t/dynamiqs-org/shared_invite/zt-1z4mw08mo-qDLoNx19JBRtKzXlmlFYLA) [](https://github.com/dynamiqs/dynamiqs/blob/main/LICENSE) [](https://github.com/astral-sh/ruff)
|
|
8
8
|
|
|
9
9
|
High-performance quantum systems simulation with JAX.
|
|
10
10
|
|
|
11
|
-
**Dynamiqs** is a Python library for **GPU-accelerated** and **differentiable** quantum simulations. Solvers are available for the Schrödinger equation, the Lindblad master equation,
|
|
11
|
+
**Dynamiqs** is a Python library for **GPU-accelerated** and **differentiable** quantum simulations. Solvers are available for the Schrödinger equation, the Lindblad master equation, the stochastic master equation, and others. The library is built with [JAX](https://jax.readthedocs.io/en/latest/index.html) and the main solvers are based on [Diffrax](https://github.com/patrick-kidger/diffrax).
|
|
12
12
|
|
|
13
|
-
Documentation is available on our website, <https://www.dynamiqs.org>; see the [Python API](https://www.dynamiqs.org/python_api/index.html) for a list of all implemented functions.
|
|
13
|
+
Documentation is available on our website, <https://www.dynamiqs.org>; see the [Python API](https://www.dynamiqs.org/stable/python_api/index.html) for a list of all implemented functions.
|
|
14
14
|
|
|
15
15
|
The main features of **Dynamiqs** are:
|
|
16
16
|
|
|
@@ -21,7 +21,7 @@ The main features of **Dynamiqs** are:
|
|
|
21
21
|
|
|
22
22
|
We hope that this library will prove useful to the community for e.g. simulation of large quantum systems, gradient-based parameter estimation or quantum optimal control. The library is designed for large-scale problems, but also runs efficiently on CPUs for smaller problems.
|
|
23
23
|
|
|
24
|
-
⚠️ This library is under active development and
|
|
24
|
+
⚠️ This library is under active development and some APIs and solvers are still finding their footing. While most of the library is stable, new releases might introduce breaking changes.
|
|
25
25
|
|
|
26
26
|
## Installation
|
|
27
27
|
|
|
@@ -115,22 +115,22 @@ Gradient w.r.t. kappa : -3.3520
|
|
|
115
115
|
Gradient w.r.t. alpha0: 1.0670
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
ℹ️ On this specific example, we can verify the result analytically. The state remains a coherent state at all time with complex amplitude $\alpha(t) = \alpha_0 e^{-\kappa t/2} e^{i\omega t}$, and the final photon number is thus $\bar{n} = |\alpha(T)|^2 = \alpha_0^2 e^{-\kappa T}$. We can then compute the gradient with respect to the three parameters $\theta = (\omega, \kappa, \alpha_0)$:
|
|
118
|
+
ℹ️ On this specific example, we can verify the result analytically. The state remains a coherent state at all time with complex amplitude $\alpha(t) = \alpha_0 e^{-\kappa t/2} e^{-i\omega t}$, and the final photon number is thus $\bar{n} = |\alpha(T)|^2 = \alpha_0^2 e^{-\kappa T}$. We can then compute the gradient with respect to the three parameters $\theta = (\omega, \kappa, \alpha_0)$:
|
|
119
119
|
|
|
120
120
|
$$
|
|
121
121
|
\nabla_\theta\ \bar{n} = \begin{pmatrix}
|
|
122
|
-
\partial\bar{n} / \partial\omega
|
|
123
|
-
\partial\bar{n} / \partial\kappa
|
|
122
|
+
\partial\bar{n} / \partial\omega \\\\
|
|
123
|
+
\partial\bar{n} / \partial\kappa \\\\
|
|
124
124
|
\partial\bar{n} / \partial\alpha_0
|
|
125
125
|
\end{pmatrix}
|
|
126
126
|
= \begin{pmatrix}
|
|
127
|
-
0
|
|
128
|
-
-\alpha_0^2 T e^{-\kappa T}
|
|
127
|
+
0 \\\\
|
|
128
|
+
-\alpha_0^2 T e^{-\kappa T} \\\\
|
|
129
129
|
2 \alpha_0 e^{-\kappa T}
|
|
130
130
|
\end{pmatrix}
|
|
131
131
|
\approx \begin{pmatrix}
|
|
132
|
-
0.0
|
|
133
|
-
-3.3520
|
|
132
|
+
0.0 \\\\
|
|
133
|
+
-3.3520 \\\\
|
|
134
134
|
1.0670
|
|
135
135
|
\end{pmatrix}
|
|
136
136
|
$$
|
|
@@ -203,10 +203,10 @@ If you have found this library useful in your academic research, you can cite:
|
|
|
203
203
|
```bibtex
|
|
204
204
|
@unpublished{guilmin2024dynamiqs,
|
|
205
205
|
title = {Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems},
|
|
206
|
-
author = {Pierre Guilmin and Ronan Gautier and Adrien Bocquet and {\'{E}}lie Genois},
|
|
206
|
+
author = {Pierre Guilmin and Ronan Gautier and Adrien Bocquet and {\'{E}}lie Genois and Daniel Weiss},
|
|
207
207
|
year = {2024},
|
|
208
208
|
url = {https://github.com/dynamiqs/dynamiqs}
|
|
209
209
|
}
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
> P. Guilmin, R. Gautier, A. Bocquet, E. Genois. Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems (2024), in preparation.
|
|
212
|
+
> P. Guilmin, R. Gautier, A. Bocquet, E. Genois, D. Weiss. Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems (2024), in preparation.
|
|
@@ -5,10 +5,10 @@ If you have found this library useful in your academic research, you can cite:
|
|
|
5
5
|
```bibtex
|
|
6
6
|
@unpublished{guilmin2024dynamiqs,
|
|
7
7
|
title = {Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems},
|
|
8
|
-
author = {Pierre Guilmin and Ronan Gautier and Adrien Bocquet and {\'{E}}lie Genois},
|
|
8
|
+
author = {Pierre Guilmin and Ronan Gautier and Adrien Bocquet and {\'{E}}lie Genois and Daniel Weiss},
|
|
9
9
|
year = {2024},
|
|
10
10
|
url = {https://github.com/dynamiqs/dynamiqs}
|
|
11
11
|
}
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
> P. Guilmin, R. Gautier, A. Bocquet, E. Genois. Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems (2024), in preparation.
|
|
14
|
+
> P. Guilmin, R. Gautier, A. Bocquet, E. Genois, D. Weiss. Dynamiqs: an open-source Python library for GPU-accelerated and differentiable simulation of quantum systems (2024), in preparation.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Contributing to Dynamiqs
|
|
2
|
+
|
|
3
|
+
We warmly welcome all contributions. If you're a junior developer or physicist, you can start with a small utility function, and move on to bigger problems as you discover the library's internals. If you're more experienced and want to implement more advanced features, don't hesitate to [get in touch](./lets-talk.md) to discuss what would suit you.
|
|
4
|
+
|
|
5
|
+
To contribute efficiently, a few guidelines are compiled below.
|
|
6
|
+
|
|
7
|
+
## 1. Requirements
|
|
8
|
+
|
|
9
|
+
The project was written using Python 3.9+, you must have a compatible version of Python (i.e. >= 3.9) installed on your computer.
|
|
10
|
+
|
|
11
|
+
## 2. Setup
|
|
12
|
+
|
|
13
|
+
Clone the repository and dive in:
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
git clone git@github.com:dynamiqs/dynamiqs.git
|
|
17
|
+
cd dynamiqs
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
To install the library with all its dependencies, as well as the developer dependencies:
|
|
21
|
+
|
|
22
|
+
- **If you use `uv`**, just run:
|
|
23
|
+
```shell
|
|
24
|
+
uv sync --extra dev
|
|
25
|
+
```
|
|
26
|
+
- **If you use `pip`**, we strongly recommend creating a virtual environment to install the project dependencies. You can then install the library in editable mode:
|
|
27
|
+
```shell
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 3. Workflow
|
|
32
|
+
|
|
33
|
+
### Github flow
|
|
34
|
+
|
|
35
|
+
We use the GitHub flow branch-based workflow to collaborate on the library. If you're unfamiliar with open-source development, you can follow the [GitHub flow tutorial](https://docs.github.com/en/get-started/using-github/github-flow) Briefly, to add a change you should: fork the repository, create a branch, make and commit your changes, create a pull request (PR), address review comments, and merge the PR.
|
|
36
|
+
|
|
37
|
+
### Planning your change
|
|
38
|
+
|
|
39
|
+
If you are planning a large change (more than one hundred lines of code), it is usually more efficient to discuss it with us beforehand. This way, we can agree on the API and the main logic. For structural or significant changes, we typically write and iterate on small RFCs (Requests for Comments). For large change, please separate the logical building blocks of your change into distinct pull requests as much as possible. Long PRs are harder to review, and breaking them down will make everyone's life easier.
|
|
40
|
+
|
|
41
|
+
If the proposed change is necessary for your work and has not been reviewed within three days, don’t hesitate to ping the main developers directly on the PR.
|
|
42
|
+
|
|
43
|
+
### Developer tools
|
|
44
|
+
|
|
45
|
+
We use a variety of modern formatting and linting tools, as well as automated tests, to ensure high code quality and to identify bugs early in the development process. These tests can be run either together or individually using the `task` CLI tool, which is installed as part of the development dependencies.
|
|
46
|
+
|
|
47
|
+
Typically you should ensure all tasks run smoothly before submitting a new PR:
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
task all
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Here is a list of available tasks:
|
|
54
|
+
|
|
55
|
+
```shell
|
|
56
|
+
> task --list
|
|
57
|
+
lint lint the code (ruff)
|
|
58
|
+
format auto-format the code (ruff)
|
|
59
|
+
codespell check for misspellings (codespell)
|
|
60
|
+
clean clean the code (ruff + codespell)
|
|
61
|
+
test run the unit tests suite (pytest)
|
|
62
|
+
doctest-code check code docstrings examples (doctest)
|
|
63
|
+
doctest-docs check documentation examples (doctest)
|
|
64
|
+
doctest check all examples (doctest)
|
|
65
|
+
docbuild build the documentation website
|
|
66
|
+
docserve preview documentation website with hot-reloading
|
|
67
|
+
all run all tasks before a commit (ruff + codespell + pytest + doctest)
|
|
68
|
+
ci run all the CI checks
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Run tasks automatically before each commit
|
|
72
|
+
|
|
73
|
+
Alternatively, you can use `pre-commit` to automatically run the cleaning tasks (ruff + codespell) before each commit:
|
|
74
|
+
|
|
75
|
+
```shell
|
|
76
|
+
pip install pre-commit
|
|
77
|
+
pre-commit install
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Build the documentation
|
|
81
|
+
|
|
82
|
+
The documentation is built using [MkDocs](https://www.mkdocs.org/) and the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme. MkDocs generates a static website based on the markdown files in the `docs/` directory.
|
|
83
|
+
|
|
84
|
+
To preview the changes to the documentation as you edit the docstrings or the markdown files in `docs/`, we recommend starting a live preview server, which will automatically rebuild the website upon modifications:
|
|
85
|
+
|
|
86
|
+
```shell
|
|
87
|
+
task docserve
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Open <http://localhost:8000/> in your web browser to preview the documentation website.
|
|
91
|
+
|
|
92
|
+
You can build the static documentation website locally with:
|
|
93
|
+
|
|
94
|
+
```shell
|
|
95
|
+
task docbuild
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This will create a `site/` directory with the contents of the documentation website. You can then simply open `site/index.html` in your web browser to view the documentation website.
|
|
99
|
+
|
|
100
|
+
## 4. Style guide
|
|
101
|
+
|
|
102
|
+
This project adheres to PEP 8 guidelines. The maximum line length is **88** characters, and we recommend setting this limit in your IDE. Generally, our automatic cleaning task (`task clean`) will address most basic styling issues. If you have any remaining doubts, you can follow the conventions used throughout the library by looking at various files.
|
|
103
|
+
|
|
104
|
+
We strive to keep the codebase as maintainable, readable, and unified as possible. We would appreciate your help by following these guidelines in your next PR.
|
|
105
|
+
|
|
106
|
+
### Writing a PR
|
|
107
|
+
|
|
108
|
+
The main goal to keep in mind is that if someone reads a past PR, they should quickly gain a clear understanding of what the change was.
|
|
109
|
+
|
|
110
|
+
- Use a lower case name for your branch name.
|
|
111
|
+
- Choose a clear and precise title for your PR. We use the squash and merge strategy to incorporate changes, so the title of your PR will become the commit title in the `main` branch history. Refer to the [commit history of the `main` branch](https://github.com/dynamiqs/dynamiqs/commits/main/) for inspiration.
|
|
112
|
+
- If, after multiple reviews and iterations, the content of the PR no longer corresponds to the original description, please update the description.
|
|
113
|
+
|
|
114
|
+
### Adding a new function
|
|
115
|
+
|
|
116
|
+
When writing your function:
|
|
117
|
+
|
|
118
|
+
- Type all arguments of your function, and its return type.
|
|
119
|
+
- When typing a public function, use `ArrayLike` for array inputs (and `jnp.asarray()` to convert to a proper array), and `Array` for array outputs. See [JAX typing best practices](https://jax.readthedocs.io/en/latest/jax.typing.html#jax-typing-best-practices).
|
|
120
|
+
- Ensure you run `task docserve` to verify how the documentation for your function appears, and correct any issues with rendering.
|
|
121
|
+
- To type an array shape, use `...` to denote possible batch dimensions, use `n` for the Hilbert space dimension.
|
|
122
|
+
- To add an axis to an array, favor `[None, ...]` over `unsqueeze`.
|
|
123
|
+
- Favor `(...).sum(0)` over `jnp.sum(..., 0)`.
|
|
124
|
+
|
|
125
|
+
Make sure to add your function:
|
|
126
|
+
|
|
127
|
+
1. to the `__all__` variable at the top of the file (this is how we control namespaces to have everything available under `dq.*`),
|
|
128
|
+
2. to the `dynamiqs/mkdocs.yml` file (so it appears in the documentation and navigation),
|
|
129
|
+
3. to the `dynamiqs/docs/python_api/index.md` file (so it appears on the Python API page, which lists all the functions of the library).
|
|
130
|
+
|
|
131
|
+
### Writing a docstring
|
|
132
|
+
|
|
133
|
+
We use [Google-style docstrings](https://google.github.io/styleguide/pyguide.html#s3.8.1-comments-in-doc-strings) (see examples [here](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)) with a few quirks.
|
|
134
|
+
|
|
135
|
+
- Headers can include (in this order and with these names): `Args`, `Returns`, `Raises`, `Examples`, `See also`.
|
|
136
|
+
- You can use the admonitions (colored blocks in the documentation) `Note` and `Warning` if relevant.
|
|
137
|
+
- Avoid using `The` in arguments description, for example change `x: The quantum state.` to `x: Quantum state.`.
|
|
138
|
+
- Specify arguments type in `_(...)_` after the argument name and _only if it is necessary_. Adding a type can for example be useful to add a shape information for an array, or because the argument typing in the function signature is opaque.
|
|
139
|
+
|
|
140
|
+
### Documentation
|
|
141
|
+
|
|
142
|
+
- For internal links, use `[dq.Options][dynamiqs.Options]` for a class, `[dq.sesolve()][dynamiqs.sesolve]` for a function (explicitely include `()` in the function name), and `(doc page)(relative/path/to/file.md)` for another documentation page (note the parentheses instead of brackets).
|
|
143
|
+
- If you want to add an icon somewhere, use one of the `:material-*` (search the list [here](https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/)).
|
|
144
|
+
|
|
145
|
+
### Exceptions message
|
|
146
|
+
|
|
147
|
+
- Use one or multiple sentences starting with a capital letter and ending with a period.
|
|
148
|
+
- Use backticks ``` ` ``` to refer to a variable name or a function. Use `'` to refer to a string.
|
|
149
|
+
- Many exceptions arise from incorrect argument input; they should typically follow the format: `"Argument ... must ..., but ..."`.
|
|
150
|
+
|
|
151
|
+
Examples:
|
|
152
|
+
|
|
153
|
+
<!-- skip: next -->
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
raise ValueError(f'Argument `H` must have shape (n, n), but has shape H.shape={H.shape}.')
|
|
157
|
+
raise ValueError(
|
|
158
|
+
"Argument `matmul_precision` should be a string 'low', 'high', or"
|
|
159
|
+
f" 'highest', but is '{matmul_precision}'."
|
|
160
|
+
)
|
|
161
|
+
```
|