dq.mepropagator
mepropagator(
H: QArrayLike | TimeQArray,
jump_ops: list[QArrayLike | TimeQArray],
tsave: ArrayLike,
*,
method: Method | None = None,
gradient: Gradient | None = None,
options: Options = Options()
) -> MEPropagatorResult
Compute the propagator of the Lindblad master equation.
This function computes the propagator \(\mathcal{U}(t)\) at time \(t\) of the Lindblad master equation (with \(\hbar=1\)) $$ \mathcal{U}(t) = \mathscr{T}\exp\left(\int_0^t\mathcal{L}(t')\dt'\right), $$ where \(\mathscr{T}\) is the time-ordering symbol and \(\mathcal{L}\) is the system's Liouvillian. The formula simplifies to \(\mathcal{U}(t)=e^{t\mathcal{L}}\) if the Liouvillian does not depend on time.
If the Liouvillian is constant or piecewise constant, the propagator is computed by directly exponentiating the Liouvillian. Otherwise, the propagator is computed by solving the Lindblad master equation with an ODE method.
Parameters
-
H
(qarray-like or time-qarray of shape (...H, n, n))
–
Hamiltonian.
-
jump_ops
(list of qarray-like or time-qarray, each of shape (...Lk, n, n))
–
List of jump operators.
-
tsave
(array-like of shape (ntsave,))
–
Times at which the propagators are saved. The equation is solved from
tsave[0]
totsave[-1]
, or fromt0
totsave[-1]
ift0
is specified inoptions
. -
method
–
Method for the integration. Defaults to
None
which redirects todq.method.Expm
(explicit matrix exponentiation) ordq.method.Tsit5
depending on the Liouvillian type (supported:Expm
,Tsit5
,Dopri5
,Dopri8
,Kvaerno3
,Kvaerno5
,Euler
). -
gradient
–
Algorithm used to compute the gradient. The default is method-dependent, refer to the documentation of the chosen method for more details.
-
options
–
Generic options (supported:
save_propagators
,cartesian_batching
,progress_meter
,t0
,save_extra
).Detailed options API
dq.Options( save_propagators: bool = True, cartesian_batching: bool = True, progress_meter: AbstractProgressMeter | bool | None = None, t0: ScalarLike | None = None, save_extra: callable[[Array], PyTree] | None = None, )
Parameters
- save_propagators - If
True
, the propagator is saved at every time intsave
, otherwise only the final propagator is returned. - cartesian_batching - If
True
, batched arguments are treated as separated batch dimensions, otherwise the batching is performed over a single shared batched dimension. - progress_meter - Progress meter indicating how far the solve has
progressed. Defaults to
None
which uses the global default progress meter (seedq.set_progress_meter()
). Set toTrue
for a tqdm progress meter, andFalse
for no output. See other options in dynamiqs/progress_meter.py. If gradients are computed, the progress meter only displays during the forward pass. - t0 - Initial time. If
None
, defaults to the first time intsave
. - save_extra (function, optional) - A function with signature
f(QArray) -> PyTree
that takes a propagator as input and returns a PyTree. This can be used to save additional arbitrary data during the integration, accessible inresult.extra
.
- save_propagators - If
Returns
dq.MEPropagatorResult
object holding the result of the propagator computation.
Use result.propagators
to access the saved propagators.
Detailed result API
dq.MEPropagatorResult
Attributes
- propagators (qarray of shape (..., nsave, n^2, n^2)) - Saved
propagators with
nsave = ntsave
, ornsave = 1
ifoptions.save_propagators=False
. - final_propagator (qarray of shape (..., n^2, n^2)) - Saved final propagator.
- extra (PyTree or None) - Extra data saved with
save_extra()
if specified inoptions
. - infos (PyTree or None) - Method-dependent information on the resolution.
- tsave (array of shape (ntsave,)) - Times for which results were saved.
- method (Method) - Method used.
- gradient (Gradient) - Gradient used.
- options (Options) - Options used.
Advanced use-cases
Defining a time-dependent Hamiltonian or jump operator
If the Hamiltonian or the jump operators depend on time, they can be converted
to time-qarrays using dq.pwc()
,
dq.modulated()
, or
dq.timecallable()
. See the
Time-dependent operators
tutorial for more details.
Running multiple simulations concurrently
The Hamiltonian H
and the jump operators jump_ops
can be batched to compute
multiple propagators concurrently. All other arguments are common to every
batch. The resulting propagators are batched according to the leading dimensions of
H
and jump_ops
. The behaviour depends on the value of the cartesian_batching
option.
The results leading dimensions are
... = ...H, ...L0, ...L1, (...)
H
has shape (2, 3, n, n),jump_ops = [L0, L1]
has shape [(4, 5, n, n), (6, n, n)],
then result.propagators
has shape (2, 3, 4, 5, 6, ntsave, n^2, n^2).
The results leading dimensions are
... = ...H = ...L0 = ...L1 = (...) # (once broadcasted)
H
has shape (2, 3, n, n),jump_ops = [L0, L1]
has shape [(3, n, n), (2, 1, n, n)],
then result.propagators
has shape (2, 3, ntsave, n^2, n^2).
See the Batching simulations tutorial for more details.