Skip to content

dq.sepropagator

sepropagator(
    H: QArrayLike | TimeQArray,
    tsave: ArrayLike,
    *,
    solver: Solver | None = None,
    gradient: Gradient | None = None,
    options: Options = Options()
) -> SEPropagatorResult

Compute the propagator of the Schrödinger equation.

This function computes the propagator \(U(t)\) at time \(t\) of the Schrödinger equation (with \(\hbar=1\)) $$ U(t) = \mathscr{T}\exp\left(-i\int_0^tH(t')\dt'\right), $$ where \(\mathscr{T}\) is the time-ordering symbol and \(H\) is the system's Hamiltonian. The formula simplifies to \(U(t)=e^{-iHt}\) if the Hamiltonian does not depend on time.

If the Hamiltonian is constant or piecewise constant, the propagator is computed by directly exponentiating the Hamiltonian. Otherwise, the propagator is computed by solving the Schrödinger equation with an ODE solver.

Parameters

  • H (qarray-like or time-qarray of shape (...H, n, n)) –

    Hamiltonian.

  • tsave (array-like of shape (ntsave,)) –

    Times at which the propagators are saved. The equation is solved from tsave[0] to tsave[-1], or from t0 to tsave[-1] if t0 is specified in options.

  • solver –

    Solver for the integration. Defaults to None which redirects to dq.solver.Expm (explicit matrix exponentiation) or dq.solver.Tsit5 depending on the Hamiltonian type (supported: Expm, Tsit5, Dopri5, Dopri8, Kvaerno3, Kvaerno5, Euler).

  • gradient –

    Algorithm used to compute the gradient. The default is solver-dependent, refer to the documentation of the chosen solver for more details.

  • options –

    Generic options (supported: save_propagators, progress_meter, t0, save_extra).

    Detailed options API
    dq.Options(
        save_propagators: bool = True,
        progress_meter: AbstractProgressMeter | None = TqdmProgressMeter(),
        t0: ScalarLike | None = None,
        save_extra: callable[[Array], PyTree] | None = None,
    )
    

    Parameters

    • save_propagators - If True, the propagator is saved at every time in tsave, otherwise only the final propagator is returned.
    • progress_meter - Progress meter indicating how far the solve has progressed. Defaults to a tqdm progress meter. Pass None 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 in tsave.
    • 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 in result.extra.

Returns

dq.SEPropagatorResult object holding the result of the propagator computation. Use result.propagators to access the saved propagators.

Detailed result API
dq.SEPropagatorResult

Attributes

  • propagators (qarray of shape (..., nsave, n, n)) - Saved propagators with nsave = ntsave, or nsave = 1 if options.save_propagators=False.
  • final_propagator (qarray of shape (..., n, n)) - Saved final propagator.
  • extra (PyTree or None) - Extra data saved with save_extra() if specified in options.
  • infos (PyTree or None) - Solver-dependent information on the resolution.
  • tsave (array of shape (ntsave,)) - Times for which results were saved.
  • solver (Solver) - Solver used.
  • gradient (Gradient) - Gradient used.
  • options (Options) - Options used.

Advanced use-cases

Defining a time-dependent Hamiltonian

If the Hamiltonian depends on time, it can be converted to a time-qarray using dq.pwc(), dq.modulated(), or dq.timecallable(). See the Time-dependent operators tutorial for more details.

Running multiple simulations concurrently

The Hamiltonian H 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. For example if H has shape (2, 3, n, n), then result.propagators has shape (2, 3, ntsave, n, n).

See the Batching simulations tutorial for more details.