dq.floquet
floquet(
H: QArrayLike | TimeQArray,
T: float,
tsave: ArrayLike,
*,
solver: Solver = Tsit5(),
gradient: Gradient | None = None,
options: Options = Options()
) -> FloquetResult
Compute Floquet modes and quasienergies of a periodic closed system.
The Floquet modes \(\Phi_{m}(t_0)\) and corresponding quasienergies \(\epsilon_m\) are defined by the eigenvalue equation $$ U(t_0, t_0+T)\Phi_{m}(t_0) = \exp(-i \epsilon_{m} T)\Phi_{m}(t_0), $$ where \(U(t_0, t_0+T)\) is the propagator over a single period \(T\), with \(t_0\) some arbitrary initial time (typically \(t_0 = 0\)). According to the Floquet theorem, these Floquet modes are periodic with period \(T\) and form a complete basis for the time evolution of the system. The \(t=t_0\) Floquet modes are obtained from diagonalization of the above propagator, while the \(t \geq t_0\) Floquet modes are obtained by propagating the \(t=t_0\) Floquet modes forward in time, via $$ \Phi_{m}(t) = \exp(i\epsilon_{m}t)U(t_0, t_0+t)\Phi_{m}(t_0). $$
Parameters
-
H
(qarray-like or time-qarray of shape (...H, n, n))
–
Hamiltonian.
-
T
–
Period of the Hamiltonian. If the Hamiltonian is batched, the period should be common over all elements in the batch. To batch over different periods, wrap the call to
floquet
in ajax.vmap
, see above. -
tsave
(array-like of shape (ntsave,))
–
Times at which to compute floquet modes. The specified times should be ordered, strictly ascending, and such that
tsave[-1] - tsave[0] <= T
. -
solver
–
Solver for the integration. Defaults to
dq.solver.Tsit5
(supported:Tsit5
,Dopri5
,Dopri8
,Kvaerno3
,Kvaerno5
,Euler
). -
gradient
–
Algorithm used to compute the gradient.
-
options
–
Generic options (supported:
progress_meter
,t0
).Detailed options API
dq.Options( progress_meter: AbstractProgressMeter | None = TqdmProgressMeter(), t0: ScalarLike | None = None, )
Parameters
- 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 intsave
.
- progress_meter - Progress meter indicating how far the solve has
progressed. Defaults to a tqdm
progress meter. Pass
Returns
dq.FloquetResult
object holding the result of the Floquet computation. Use
result.modes
to access the saved Floquet modes and result.quasienergies
for the associated quasienergies.
Detailed result API
dq.FloquetResult
Attributes
- modes (qarray of shape (..., ntsave, n, n, 1)) - Saved Floquet modes.
- quasienergies (array of shape (..., n)) - Saved quasienergies
- T (float) - Drive period
- 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
Running multiple simulations concurrently
The Hamiltonian H
can be batched to compute multiple Floquet modes and
quasienergies concurrently. All other arguments are common to every batch. The
Floquet modes and quasienergies are batched according to the leading dimensions of
H
. For example if H
has shape (2, 3, n, n), then result.modes
has shape
(2, 3, ntsave, n, n, 1).
See the Batching simulations tutorial for more details.
Batching over drive periods
The current API does not yet natively support batching over multiple drive
periods, for instance if you wanted to batch over Hamiltonians with different
drive frequencies. This however can be achieved straightforwardly with an
external call to jax.vmap
, as follows:
import jax
import jax.numpy as jnp
import dynamiqs as dq
def single_floquet(omega):
H = dq.modulated(lambda t: jnp.cos(omega * t), dq.sigmax())
T = 2.0 * jnp.pi / omega
tsave = jnp.linspace(0.0, T, 11)
return dq.floquet(H, T, tsave)
omegas = jnp.array([0.9, 1.0, 1.1])
batched_floquet = jax.vmap(single_floquet)
result = batched_floquet(omegas)