Skip to content

dq.method.Event

Event(
    noclick_method: Method = Tsit5(),
    dtmax: float | None = None,
    root_finder: AbstractRootFinder | None = None,
    smart_sampling: bool = False,
)

Event method for the jump SSE.

This method uses the Diffrax library event handling to interrupt the no-click integration at the next sampled click time, apply the corresponding measurement backaction to the state, and continue the no-click integration until the subsequent sampled click time.

Click times precision

When using adaptive step size solvers for the no-click integration, you must specify either dtmax or root_finder to control the precision of the click times. Otherwise, the adaptive solver may choose to take very large step sizes, which results in imprecise click times. You can either:

  • specify dtmax to limit the maximum step size of the no-click evolution,
  • or use the root_finder argument to refine the exact click times to a chosen precision, see for example the optimistix library Newton root finder.
Click statistics with smart sampling

With smart_sampling=True, every saved trajectory has at least one click, so the statistics of result.states, result.expects, result.clicktimes and result.nclicks are conditional on a click having occurred. For example, the mean of result.nclicks is larger than the mean number of clicks. result.mean_states() and result.mean_expects() already account for this. For any other per-trajectory quantity \(f\), recover its unconditional mean with $$ \mathbb{E}[f] = p_0 f_0 + (1 - p_0)\,\bar f, $$ where \(p_0\) is result.infos.noclick_prob, \(f_0\) is the value of \(f\) on the no-click trajectory (for instance \(f_0 = 0\) for the number of clicks) and \(\bar f\) is the average of \(f\) over the saved trajectories.

Parameters:

  • noclick_method –

    Method for the no-click evolution. Defaults to dq.method.Tsit5 (supported: Tsit5, Dopri5, Dopri8, Kvaerno3, Kvaerno5, Euler).

  • dtmax –

    Maximum step size for the no-click evolution, defaults to None.

  • root_finder –

    Root finder to refine the click times, defaults to None (precision determined by the integration step size).

  • smart_sampling –

    If True, the no-click trajectory is sampled only once, and result.states contains only trajectories with one or more clicks. Information about the no-click trajectory are stored in result.infos:

    • result.infos.noclick_states (qarray of shape (..., nsave, n, 1)) - No-click trajectory.
    • result.infos.noclick_prob (array of shape (...)) - Probability of the no-click trajectory.
    • result.infos.noclick_expects (array of shape (..., len(exp_ops), ntsave) or None) - No-click trajectory expectation values.
Supported gradients

This method supports differentiation with dq.gradient.BackwardCheckpointed (default).