Skip to content

dq.Options

Generic options for quantum solvers.

The Options class provides a unified interface for specifying options specific to quantum solvers. Each quantum solver may only use a subset of these options, and an error will be raised if you modify an option that the solver does not support.

Options(
    save_states: bool = True,
    cartesian_batching: bool = True,
    progress_meter: AbstractProgressMeter | None = TqdmProgressMeter(),
    t0: ScalarLike | None = None,
    save_extra: callable[[Array], PyTree] | None = None,
)

Parameters

  • save_states – If True, the state is saved at every time in tsave, otherwise only the final state 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 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 state or propagator as input and returns a PyTree. This can be used to save additional arbitrary data during the integration. The additional data is accessible in the extra attribute of the result object returned by the solvers.
Options(
    save_states: bool = True,
    cartesian_batching: bool = True,
    progress_meter: AbstractProgressMeter | None = TqdmProgressMeter(),
    t0: ScalarLike | None = None,
    save_extra: callable[[Array], PyTree] | None = None,
)

Parameters

  • save_states – If True, the state is saved at every time in tsave, otherwise only the final state 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 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 state or propagator as input and returns a PyTree. This can be used to save additional arbitrary data during the integration. The additional data is accessible in the extra attribute of the result object returned by the solvers.
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 state or propagator as input and returns a PyTree. This can be used to save additional arbitrary data during the integration. The additional data is accessible in the extra attribute of the result object returned by the solvers.
Options(
    save_propagators: bool = True,
    cartesian_batching: bool = True,
    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.
  • cartesian_batching – If True, batched arguments are treated as separated batch dimensions, otherwise the batching is performed over a single shared batched dimension.
  • 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 state or propagator as input and returns a PyTree. This can be used to save additional arbitrary data during the integration. The additional data is accessible in the extra attribute of the result object returned by the solvers.
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 in tsave.