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.
Files changed (160) hide show
  1. dynamiqs-0.2.3/CONTRIBUTING.md +159 -0
  2. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/LICENSE +3 -0
  3. dynamiqs-0.2.3/NOTICE +33 -0
  4. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/PKG-INFO +19 -18
  5. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/README.md +7 -7
  6. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/README_PYPI.md +13 -13
  7. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/community/citing.md +2 -2
  8. dynamiqs-0.2.3/docs/community/contributing.md +161 -0
  9. dynamiqs-0.2.3/docs/documentation/advanced_examples/kerr-oscillator.md +381 -0
  10. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/getting_started/examples.md +1 -1
  11. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/getting_started/whatis.md +2 -2
  12. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/index.md +4 -2
  13. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/python_api/index.md +2 -0
  14. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/stylesheets/extra.css +16 -0
  15. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/stylesheets/theme.css +8 -0
  16. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/__init__.py +1 -1
  17. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/__init__.py +2 -1
  18. dynamiqs-0.2.3/dynamiqs/integrators/_utils.py +192 -0
  19. dynamiqs-0.2.3/dynamiqs/integrators/apis/floquet.py +181 -0
  20. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/mepropagator.py +28 -51
  21. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/mesolve.py +32 -52
  22. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/sepropagator.py +9 -11
  23. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/sesolve.py +17 -29
  24. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/diffrax_integrator.py +11 -9
  25. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/expm_integrator.py +1 -1
  26. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/interfaces.py +5 -0
  27. dynamiqs-0.2.3/dynamiqs/integrators/floquet/floquet_integrator.py +51 -0
  28. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/mesolve/rouchon_integrator.py +4 -4
  29. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/wigner.py +1 -1
  30. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/random.py +1 -1
  31. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/result.py +52 -1
  32. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/solver.py +7 -7
  33. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/time_array.py +22 -13
  34. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/jax_utils.py +1 -1
  35. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/operators.py +47 -41
  36. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/optimal_control.py +1 -1
  37. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/quantum_utils/general.py +29 -21
  38. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/states.py +24 -22
  39. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/vectorization.py +12 -4
  40. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/mkdocs.yml +5 -0
  41. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/pyproject.toml +6 -4
  42. dynamiqs-0.2.3/tests/floquet/floquet_qubit.py +99 -0
  43. dynamiqs-0.2.3/tests/floquet/test_adaptive.py +34 -0
  44. dynamiqs-0.2.3/tests/floquet/test_batching.py +32 -0
  45. dynamiqs-0.2.3/tests/sesolve/__init__.py +0 -0
  46. dynamiqs-0.2.3/tests/utils/__init__.py +0 -0
  47. dynamiqs-0.2.2/CONTRIBUTING.md +0 -91
  48. dynamiqs-0.2.2/docs/community/contributing.md +0 -95
  49. dynamiqs-0.2.2/dynamiqs/integrators/_utils.py +0 -209
  50. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/.github/workflows/ci.yml +0 -0
  51. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/.github/workflows/publish-doc.yml +0 -0
  52. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/.gitignore +0 -0
  53. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/.pre-commit-config.yaml +0 -0
  54. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/CNAME +0 -0
  55. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/community/index.md +0 -0
  56. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/community/lets-talk.md +0 -0
  57. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/conftest.py +0 -0
  58. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/batching-simulations.md +0 -0
  59. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/closed-systems.md +0 -0
  60. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/computing-gradients.md +0 -0
  61. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/open-systems.md +0 -0
  62. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/time-dependent-operators.md +0 -0
  63. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/basics/workflow.md +0 -0
  64. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/getting_started/installation.md +0 -0
  65. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/documentation/getting_started/sharp-bits.md +0 -0
  66. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/figs_code/.gitkeep +0 -0
  67. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/figs_docs/.gitkeep +0 -0
  68. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/generate_python_api.py +0 -0
  69. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/glossary.md +0 -0
  70. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/hooks.py +0 -0
  71. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/index.md +0 -0
  72. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/javascripts/katex.js +0 -0
  73. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/favicon.png +0 -0
  74. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/favicon.svg +0 -0
  75. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-large.png +0 -0
  76. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-typeface-darktype.png +0 -0
  77. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-typeface-lighttype.png +0 -0
  78. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-white-large.png +0 -0
  79. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo-white.png +0 -0
  80. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/media/logo.png +0 -0
  81. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/overrides/home.html +0 -0
  82. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/overrides/main.html +0 -0
  83. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/overrides/partials/content.html +0 -0
  84. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/overrides/partials/header.html +0 -0
  85. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/remove_figs.py +0 -0
  86. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/stylesheets/home.css +0 -0
  87. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/class.html.jinja +0 -0
  88. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/admonition.html.jinja +0 -0
  89. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/attributes.html.jinja +0 -0
  90. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/examples.html.jinja +0 -0
  91. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/functions.html.jinja +0 -0
  92. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/parameters.html.jinja +0 -0
  93. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/raises.html.jinja +0 -0
  94. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/docstring/returns.html.jinja +0 -0
  95. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/function.html.jinja +0 -0
  96. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/module.html.jinja +0 -0
  97. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/docs/templates/python/material/table.html.jinja +0 -0
  98. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/_checks.py +0 -0
  99. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/_utils.py +0 -0
  100. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/conftest.py +0 -0
  101. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/dark/__init__.py +0 -0
  102. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/dark/dark.py +0 -0
  103. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/gradient.py +0 -0
  104. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/__init__.py +0 -0
  105. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/apis/smesolve.py +0 -0
  106. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/__init__.py +0 -0
  107. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/abstract_integrator.py +0 -0
  108. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/core/save_mixin.py +0 -0
  109. {dynamiqs-0.2.2/dynamiqs/integrators/mepropagator → dynamiqs-0.2.3/dynamiqs/integrators/floquet}/__init__.py +0 -0
  110. {dynamiqs-0.2.2/dynamiqs/integrators/mesolve → dynamiqs-0.2.3/dynamiqs/integrators/mepropagator}/__init__.py +0 -0
  111. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/mepropagator/expm_integrator.py +0 -0
  112. {dynamiqs-0.2.2/dynamiqs/integrators/sepropagator → dynamiqs-0.2.3/dynamiqs/integrators/mesolve}/__init__.py +0 -0
  113. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/mesolve/diffrax_integrator.py +0 -0
  114. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/mesolve/expm_integrator.py +0 -0
  115. {dynamiqs-0.2.2/dynamiqs/integrators/sesolve → dynamiqs-0.2.3/dynamiqs/integrators/sepropagator}/__init__.py +0 -0
  116. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/sepropagator/diffrax_integrator.py +0 -0
  117. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/sepropagator/expm_integrator.py +0 -0
  118. {dynamiqs-0.2.2/dynamiqs/integrators/smesolve → dynamiqs-0.2.3/dynamiqs/integrators/sesolve}/__init__.py +0 -0
  119. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/sesolve/diffrax_integrator.py +0 -0
  120. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/integrators/sesolve/expm_integrator.py +0 -0
  121. {dynamiqs-0.2.2/tests → dynamiqs-0.2.3/dynamiqs/integrators/smesolve}/__init__.py +0 -0
  122. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/options.py +0 -0
  123. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/__init__.py +5 -5
  124. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/colormaps.py +0 -0
  125. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/fock.py +0 -0
  126. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/hinton.py +0 -0
  127. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/misc.py +0 -0
  128. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/plot/utils.py +0 -0
  129. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/progress_meter.py +0 -0
  130. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/__init__.py +0 -0
  131. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/quantum_utils/__init__.py +21 -21
  132. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/dynamiqs/utils/quantum_utils/wigner.py +0 -0
  133. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/pytest.ini +0 -0
  134. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/README.md +0 -0
  135. {dynamiqs-0.2.2/tests/mepropagator → dynamiqs-0.2.3/tests}/__init__.py +0 -0
  136. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/conftest.py +0 -0
  137. {dynamiqs-0.2.2/tests/mesolve → dynamiqs-0.2.3/tests/floquet}/__init__.py +0 -0
  138. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/integrator_tester.py +0 -0
  139. {dynamiqs-0.2.2/tests/sepropagator → dynamiqs-0.2.3/tests/mepropagator}/__init__.py +0 -0
  140. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mepropagator/mepropagator_utils.py +0 -0
  141. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mepropagator/test_batching.py +0 -0
  142. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mepropagator/test_expm.py +0 -0
  143. {dynamiqs-0.2.2/tests/sesolve → dynamiqs-0.2.3/tests/mesolve}/__init__.py +0 -0
  144. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/open_system.py +0 -0
  145. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_adaptive.py +0 -0
  146. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_batching.py +0 -0
  147. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_euler.py +0 -0
  148. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_expm.py +0 -0
  149. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/mesolve/test_rouchon.py +0 -0
  150. {dynamiqs-0.2.2/tests/utils → dynamiqs-0.2.3/tests/sepropagator}/__init__.py +0 -0
  151. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sepropagator/test_sepropagator.py +0 -0
  152. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/closed_system.py +0 -0
  153. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/test_adaptive.py +0 -0
  154. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/test_batching.py +0 -0
  155. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/test_euler.py +0 -0
  156. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/sesolve/test_expm.py +0 -0
  157. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/system.py +0 -0
  158. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/test_plot.py +0 -0
  159. {dynamiqs-0.2.2 → dynamiqs-0.2.3}/tests/test_time_array.py +0 -0
  160. {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
1
+ Metadata-Version: 2.3
2
2
  Name: dynamiqs
3
- Version: 0.2.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
  [![ci](https://github.com/dynamiqs/dynamiqs/actions/workflows/ci.yml/badge.svg)](https://github.com/dynamiqs/dynamiqs/actions/workflows/ci.yml?query=branch%3Amain) ![python version](https://img.shields.io/badge/python-3.9%2B-blue) [![chat](https://badgen.net/badge/icon/on%20slack?icon=slack&label=chat&color=orange)](https://join.slack.com/t/dynamiqs-org/shared_invite/zt-1z4mw08mo-qDLoNx19JBRtKzXlmlFYLA) [![license: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-yellow)](https://github.com/dynamiqs/dynamiqs/blob/main/LICENSE) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](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, and the stochastic master equation. 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
+ **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 while the APIs and solvers are still finding their footing, we're working hard to make it worth the wait. Check back soon for the grand opening!
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
  [![ci](https://github.com/dynamiqs/dynamiqs/actions/workflows/ci.yml/badge.svg)](https://github.com/dynamiqs/dynamiqs/actions/workflows/ci.yml?query=branch%3Amain) ![python version](https://img.shields.io/badge/python-3.9%2B-blue) [![chat](https://badgen.net/badge/icon/on%20slack?icon=slack&label=chat&color=orange)](https://join.slack.com/t/dynamiqs-org/shared_invite/zt-1z4mw08mo-qDLoNx19JBRtKzXlmlFYLA) [![license: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-yellow)](https://github.com/dynamiqs/dynamiqs/blob/main/LICENSE) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](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, and the stochastic master equation. 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).
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 while the APIs and solvers are still finding their footing, we're working hard to make it worth the wait. Check back soon for the grand opening!
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
  [![ci](https://github.com/dynamiqs/dynamiqs/actions/workflows/ci.yml/badge.svg)](https://github.com/dynamiqs/dynamiqs/actions/workflows/ci.yml?query=branch%3Amain) ![python version](https://img.shields.io/badge/python-3.9%2B-blue) [![chat](https://badgen.net/badge/icon/on%20slack?icon=slack&label=chat&color=orange)](https://join.slack.com/t/dynamiqs-org/shared_invite/zt-1z4mw08mo-qDLoNx19JBRtKzXlmlFYLA) [![license: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-yellow)](https://github.com/dynamiqs/dynamiqs/blob/main/LICENSE) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](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, and the stochastic master equation. 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).
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 while the APIs and solvers are still finding their footing, we're working hard to make it worth the wait. Check back soon for the grand opening!
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
+ ```