Skip to content

dq.solver.Kvaerno5

Kvaerno5(
    rtol: float = 1e-06,
    atol: float = 1e-06,
    safety_factor: float = 0.9,
    min_factor: float = 0.2,
    max_factor: float = 5.0,
    max_steps: int = 100000,
)

Kvaerno's method of order 5 (adaptive step size and implicit ODE solver).

This method is suitable for stiff problems, typically those with Hamiltonians or Liouvillians that have eigenvalues spanning different orders of magnitudes. This is for instance the case with problems involving high-order polynomials of the bosonic annihilation and creation operators, in large dimensions.

This solver is implemented by the Diffrax library, see diffrax.Kvaerno5.

Warning

If you find that your simulation is slow or that the progress bar gets stuck, consider switching to double-precision with dq.set_precision('double'). See more details in The sharp bits 🔪 tutorial.

Parameters

  • rtol –

    Relative tolerance.

  • atol –

    Absolute tolerance.

  • safety_factor –

    Safety factor for adaptive step sizing.

  • min_factor –

    Minimum factor for adaptive step sizing.

  • max_factor –

    Maximum factor for adaptive step sizing.

  • max_steps –

    Maximum number of steps.

Supported gradients

This solver supports differentiation with dq.gradient.Autograd and dq.gradient.CheckpointAutograd.