Dynamiqs

Latest version: v0.3.1

Safety actively analyzes 706259 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.3.0

The introduction of a custom array type gives us a lot more control over the data format, and we have a few tricks up our sleeve to take advantage of it this year, so stay tuned for even faster simulations! 🏎️

🍾 Migration from the previous version (`v0.2.*`)
There is not much to know, the solver and utility APIs are largely unchanged. We'd love to have your feedback on any bugs you might find when running your existing simulations with the new version. Here are some cool new features:
- You can now use the much awaited `x.dag()` (see the list of other `QArray` methods in the [API documentation](https://www.dynamiqs.org/0.3/python_api/qarrays/qarray/QArray.html)).
- When you create operators with Dynamiqs, they now have their own custom type, data format and representation:
python
>>> a = dq.destroy(5)
>>> a
QArray: shape=(5, 5), dims=(5,), dtype=complex64, layout=dia, ndiags=1
[[ ⋅ 1. +0.j ⋅ ⋅ ⋅ ]
[ ⋅ ⋅ 1.414+0.j ⋅ ⋅ ]
[ ⋅ ⋅ ⋅ 1.732+0.j ⋅ ]
[ ⋅ ⋅ ⋅ ⋅ 2. +0.j]
[ ⋅ ⋅ ⋅ ⋅ ⋅ ]]
>>> a.dag() a + 2 * (a + a.dag())
QArray: shape=(5, 5), dims=(5,), dtype=complex64, layout=dia, ndiags=3
[[ ⋅ 2. +0.j ⋅ ⋅ ⋅ ]
[2. +0.j 1. +0.j 2.828+0.j ⋅ ⋅ ]
[ ⋅ 2.828+0.j 2. +0.j 3.464+0.j ⋅ ]
[ ⋅ ⋅ 3.464+0.j 3. +0.j 4. +0.j]
[ ⋅ ⋅ ⋅ 4. +0.j 4. +0.j]]

Here, Dynamiqs stores only the nonzero diagonal of the operator.
- There are two different layouts for qarrays: dense or sparse DIA. You can choose a global default layout for new operators with [`dq.set_layout()`](https://www.dynamiqs.org/0.3/python_api/utils/global_settings/set_layout.html), or individually by setting the `layout` keyword argument:
python
>>> dq.destroy(5, layout=dq.dense)
QArray: shape=(5, 5), dims=(5,), dtype=complex64, layout=dense
[[0. +0.j 1. +0.j 0. +0.j 0. +0.j 0. +0.j]
[0. +0.j 0. +0.j 1.414+0.j 0. +0.j 0. +0.j]
[0. +0.j 0. +0.j 0. +0.j 1.732+0.j 0. +0.j]
[0. +0.j 0. +0.j 0. +0.j 0. +0.j 2. +0.j]
[0. +0.j 0. +0.j 0. +0.j 0. +0.j 0. +0.j]]

- All library functions remain compatible with QuTiP Qobjs, NumPy arrays, JAX arrays and Python lists. They now also support the Dynamiqs `QArray` type.
- We added some [qarray utilities](https://www.dynamiqs.org/0.3/python_api/index.html#qarray-utilities) to convert to and from other types, check them out! For example you can use [`dq.asqarray()`](https://www.dynamiqs.org/0.3/python_api/qarrays/utils/asqarray.html) to convert any object to a qarray:
python
>>> dq.asqarray([qt.sigmax(), qt.sigmay(), qt.sigmaz()], layout=dq.dia)
QArray: shape=(3, 2, 2), dims=(2,), dtype=complex64, layout=dia, ndiags=3
[[[ ⋅ 1.+0.j]
[ 1.+0.j ⋅ ]]

[[ ⋅ 0.-1.j]
[ 0.+1.j ⋅ ]]

[[ 1.+0.j ⋅ ]
[ ⋅ -1.+0.j]]]

- `TimeArray` has been renamed to [`TimeQArray`](https://www.dynamiqs.org/0.3/python_api/time_qarray/TimeQArray.html), and has first-class support for qarrays:
python
>>> f = lambda t: jnp.cos(2.0 * jnp.pi * t)
>>> H = dq.modulated(f, dq.sigmax())
>>> H
ModulatedTimeQArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dia, ndiags=2
>>> H(0.5)
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dia, ndiags=2
[[ ⋅ -1.+0.j]
[-1.+0.j ⋅ ]]


🚀 Features
- New operators [`dq.eye_like()`](https://www.dynamiqs.org/0.3/python_api/utils/operators/eye_like.html) and [`dq.zeros_like()`](https://www.dynamiqs.org/0.3/python_api/utils/operators/zeros_like.html).
- Added GPU support for eig in [`dq.floquet()`](https://www.dynamiqs.org/0.3/python_api/integrators/floquet.html) and [`dq.fidelity()`](https://www.dynamiqs.org/0.3/python_api/utils/general/fidelity.html), following the JAX 0.4.36 release (see [jax.lax.linalg.eig() documentation](https://jax.readthedocs.io/en/latest/_autosummary/jax.lax.linalg.eig.html#jax.lax.linalg.eig)).
- New [`dq.hc`](https://www.dynamiqs.org/0.3/python_api/hermitian_conjugate/hc.html) helper, syntactic sugar for writing hermitian conjugates:
python
two linear drives on two different modes
H = (omega_a * a + dq.hc) + (omega_b * b + dq.hc)

time-dependent linear drive
omega = lambda t: jnp.cos(2.0 * jnp.pi * t)
H = dq.modulated(omega, a) + dq.hc

- [`dq.coherent()`](https://www.dynamiqs.org/0.3/python_api/utils/states/coherent.html) now also accepts a batched displacement (`alpha`) argument for multi-modes.
- New `out_axes` property for result objects for custom vmapping (see 866).

🐛 Bugs
- Fixed [`dq.wigner()`](https://www.dynamiqs.org/0.3/python_api/utils/general/wigner.html) which used to return the wigner transpose, and fixed the missing `.T` in the wigner plotting functions `imshow` which made this bug go unnoticed (thanks to RemiRousseau for finding it, see #849).
- Fixed the definition of [`dq.cd_gate()`](https://www.dynamiqs.org/0.3/python_api/utils/optimal_control/cd_gate.html) to match [`dq.ground()`](https://www.dynamiqs.org/0.3/python_api/utils/states/ground.html) and [`dq.excited()`](https://www.dynamiqs.org/0.3/python_api/utils/states/excited.html).

📖 Documentation
- Added an entry to [The sharp bits 🔪](https://www.dynamiqs.org/0.3/documentation/getting_started/sharp-bits.html) tutorial on [Computing the gradient with respect to complex parameters](https://www.dynamiqs.org/0.3/documentation/getting_started/sharp-bits.html#computing-the-gradient-with-respect-to-complex-parameters) (take the conjugate!).
- Separated the solver [options documentation](https://www.dynamiqs.org/0.3/python_api/options/Options.html) between quantum solvers, to add support for solver-specific options.
- New [Global settings](https://www.dynamiqs.org/0.3/python_api/index.html#global-settings) section in the API to group default global configurations (such as precision, dtype, device and layout).

📦 Other changes
- Renamed `dq.zero()` to [`dq.zeros()`](https://www.dynamiqs.org/0.3/python_api/utils/operators/zeros.html) (to align with NumPy, PyTorch, JAX, etc.).
- Changed minimum supported Python version from 3.9 to 3.10.

**Full Changelog**: https://github.com/dynamiqs/dynamiqs/compare/v0.2.3...v0.3.0

0.2.3

This new release introduces a [brand new solver](https://www.dynamiqs.org/0.2/python_api/integrators/floquet.html) for your Floquet problems and provides an in-depth tutorial on the [driven-dissipative Kerr oscillator](https://www.dynamiqs.org/0.2/documentation/advanced_examples/kerr-oscillator.html). We are excited to announce that dkweiss31 (Daniel Weiss, postdoc at Yale) has officially joined the Dynamiqs core team! Thank you for your invaluable contributions to the Floquet solver and many other parts of the library. 🙏

This month we were featured on social media by our sponsoring startup company, Alice & Bob. Check out the [LinkedIn post](https://www.linkedin.com/posts/alice-bob_python-opensource-quantumcomputing-activity-7264624666885951490-OCqN?utm_source=share&utm_medium=member_desktop) and the [blog post](https://alice-bob.com/blog/dynamiqs-gpu-opensource-quantum-simulation-library/) on Alice & Bob's website.

🚀 Features
- Discover the new Floquet solver [`dq.floquet()`](https://www.dynamiqs.org/0.2/python_api/integrators/floquet.html) to compute Floquet modes and quasienergies of a periodic closed system (see #681).
- The single-qubit rotation gates [`dq.rx()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/rx.html), [`dq.ry()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/ry.html), [`dq.rz()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/rz.html) now support vectorised angle inputs.

🐛 Bugs
- Fixed support for unitary evolution in [`dq.mesolve()`](https://www.dynamiqs.org/0.2/python_api/integrators/mesolve.html), you can now pass an empty list of jump operators (see #772).
- Fixed problems with [functions to create states](https://www.dynamiqs.org/0.2/python_api/index.html#states) breaking the JIT (see 808).

📖 Documentation
- We have a new advanced tutorial crafted by gautierronan! An extensive study on the [driven-dissipative Kerr oscillator](https://www.dynamiqs.org/0.2/documentation/advanced_examples/kerr-oscillator.html) with Dynamiqs, including simulations of basic and advanced time evolution, vectorising simulations to explore various parameter regimes, and quantum optimal control to shape a pulse with [Optax](https://github.com/google-deepmind/optax), the Google DeepMind optimisation library.
- We have improved the [contribution guide](https://www.dynamiqs.org/0.2/community/contributing.html) for developers joining the project or contributors fixing bugs.

**Full Changelog**: https://github.com/dynamiqs/dynamiqs/compare/v0.2.2...v0.2.3

0.2.2

This release fixes some bugs and introduces several improvements. A special thank you to our new contributor vaicecaze, welcome aboard! ⛵

🚀 Features
- GIFs are now 3x faster to create, and the colormap is nicer (see https://github.com/dynamiqs/dynamiqs/pull/723).
<p align="center">
<img width="250" src="https://github.com/user-attachments/assets/f71cdcd3-9dc2-45dc-ba0b-c6fed41eae47">
</p>

- New qubit gates: [`dq.rx()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/rx.html), [`dq.ry()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/ry.html), [`dq.rz()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/rz.html), [`dq.sgate()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/sgate.html), [`dq.tgate()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/tgate.html), [`dq.cnot()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/cnot.html) and [`dq.toffoli()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/toffoli.html).
- New function [`dq.bloch_coordinates()`](https://www.dynamiqs.org/0.2/python_api/utils/quantum_utils/bloch_coordinates.html) which returns the spherical coordinates $(r,\theta,\phi)$ of a state on the Bloch sphere.
- The number operator function [`dq.number()`](https://www.dynamiqs.org/0.2/python_api/utils/operators/number.html) now supports multiple dimensions. For example, for two modes $a$ (dimension 4) and $b$ (dimension 5), the operators $a^\dagger a \otimes I_5$ and $I_4\otimes b^\dagger b$ can be simply obtained with:
python
na, nb = dq.number(4, 5)

- Added an optional `index` argument to [`dq.set_device()`](https://www.dynamiqs.org/0.2/python_api/utils/jax_utils/set_device.html).
- Support for an empty list of jump operators in [`dq.lindbladian()`](https://www.dynamiqs.org/0.2/python_api/utils/quantum_utils/lindbladian.html) and its vectorized version [`dq.slindbladian()`](https://www.dynamiqs.org/0.2/python_api/utils/vectorization/slindbladian.html), allowing the construction of a Lindbladian from a Hamiltonian only.

🐛 Bugs
- Fixed a bug that occurred when mixing subplots with colorbars. Everything should look good now (see https://github.com/dynamiqs/dynamiqs/pull/761).

📖 Documentation
- The documentation now includes a version selector next to the search bar, to switch between multiple versions of the library (`dev` = latest commit on the `main` branch of the repository, `dev-qarray` = what we're cooking for the next big release):
<p align="center">
<img width="250" src="https://github.com/user-attachments/assets/7deab806-66f8-4315-8425-cd99a1ed1e33">
</p>

📦 Other changes
- We have a new smoother logo from our logo-master gautierronan. Can you spot the seven differences from the previous one (on the left)?
<p align="center">
<img width="250" src="https://github.com/user-attachments/assets/2cd7f583-7c8b-433c-a0c4-c38659e9e770">
</p>

**Full Changelog**: https://github.com/dynamiqs/dynamiqs/compare/v0.2.1...v0.2.2

0.2.1

This release primarily addresses installation issues with the `uv` package manager. The library's official name is now `Dynamiqs` instead of `dynamiqs`, although the repository and Python package will still be named `dynamiqs`.

🚀 Features
- Add the `save_extra` option for the `dq.sepropagator()` and `dq.mepropagator()` solvers.
- Support double precision on GPU for `dq.wigner()`.

📖 Documentation
- Add analytical gradient calculations results to the README and documentation basic example.

📦 Other changes
- Change the default plot font of `dq.plot.mplstyle()` from `serif` to `sans-serif`.

**Full Changelog**: https://github.com/dynamiqs/dynamiqs/compare/v0.2.0...v0.2.1

0.2.0

First release based on JAX. 🪄 Congratulations and special thanks to our new contributors: lucasoeth, RemiRousseau, bsaoptima, gaspardbb, etienney and dkweiss31!

0.1.0

Latest version of the library based on PyTorch. From the next release, the library will be powered by JAX. 🚀

Links

Releases

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.