qilisdk.backends.backend_config

Attributes

ConfigValue

SolverConfigDict

Classes

BaseSimulatorConfig

Abstract base class for all QiliSim configuration sections.

MonteCarloConfig

Configuration for Monte Carlo trajectory sampling in open-system simulations.

AnalogMethod

Configuration for analog time-evolution method selection and its hyperparameters.

ExecutionConfig

Configuration for execution-level controls (threading and randomness).

DigitalMethod

Configuration for digital-circuit simulation options.

Module Contents

ConfigValue[fuente]
SolverConfigDict[fuente]
class BaseSimulatorConfig(*args: Any, **kwargs: Any)[fuente]

Bases: pydantic.BaseModel, abc.ABC

Abstract base class for all QiliSim configuration sections.

Disallow positional arguments to keep configuration explicit.

Muestra:

TypeError – If positional arguments are provided.

abstractmethod get_config() SolverConfigDict[fuente]

Serialize the configuration to the flat dictionary consumed by the C++ backend.

class MonteCarloConfig(*args: Any, **kwargs: Any)[fuente]

Bases: BaseSimulatorConfig

Configuration for Monte Carlo trajectory sampling in open-system simulations.

Parámetros:

trajectories (int) – Number of Monte Carlo trajectories to simulate when Monte Carlo mode is enabled. Defaults to 100.

Disallow positional arguments to keep configuration explicit.

Muestra:

TypeError – If positional arguments are provided.

trajectories: int = None[fuente]
get_config() SolverConfigDict[fuente]

Return Monte Carlo settings in backend-compatible key names.

class AnalogMethod(*args: Any, **kwargs: Any)[fuente]

Bases: BaseSimulatorConfig

Configuration for analog time-evolution method selection and its hyperparameters.

Preferred constructors:
Parámetros:
  • evolution_method (str) – Analog time-evolution method to use: "direct", "arnoldi", "integrate_rk4", "integrate_rk45_matrix_free", "integrate_rk4_matrix_free", or "variational_exponential". Defaults to "integrate_rk4_matrix_free".

  • arnoldi_dim (int) – Dimension of the Arnoldi Krylov subspace used when evolution_method="arnoldi". Defaults to 10.

  • num_arnoldi_substeps (int) – Number of integration substeps per schedule step for the Arnoldi method. Defaults to 1.

Disallow positional arguments to keep configuration explicit.

Muestra:

TypeError – If positional arguments are provided.

evolution_method: Literal['direct', 'arnoldi', 'integrate_rk4', 'integrate_rk45_matrix_free', 'integrate_rk4_matrix_free', 'variational_exponential'] = None[fuente]
arnoldi_dim: int = None[fuente]
num_arnoldi_substeps: int = None[fuente]
adaptive_tol: float = None[fuente]
variational_shots: int = None[fuente]
variational_warmups: int = None[fuente]
variational_order: int = None[fuente]
get_config() SolverConfigDict[fuente]

Return a complete analog solver configuration for the C++ backend.

classmethod integrator(*, matrix_free: bool = True) AnalogMethod[fuente]

Build an integrate analog method configuration.

Parámetros:

matrix_free (bool) – Whether to use the matrix-free implementation for the Integrate method. Defaults to False.

Devuelve:

Configured integrate-method analog configuration.

Tipo del valor devuelto:

AnalogMethod

classmethod variational_annealing(*, order: int = 2, shots: int = 100, warmups: int = 10) AnalogMethod[fuente]

Anneal a variational ansatz rather than the full state.

Based on this paper: https://arxiv.org/pdf/2403.05147

Parámetros:
  • order (int) – Order of the polynomial expansion used in the variational ansatz.

  • shots (int) – Number of samples to use when estimating expectation values for the variational optimization.

  • warmups (int) – Number of warmup iterations to perform before collecting samples for the variational optimization.

Devuelve:

Configured variational-method analog configuration.

Tipo del valor devuelto:

AnalogMethod

classmethod adaptive_integrator(*, tol: float = 0.01) AnalogMethod[fuente]

Build an adaptive_integrate analog method configuration.

This uses a Dormand-Prince Runge-Kutta 4/5 method with adaptive step size control. It automatically adjusts the integration timestep to maintain a local error estimate below the specified tolerance, which can improve efficiency for problems with varying timescales.

Parámetros:

tol (float) – Tolerance for the adaptive algorithm. Defaults to 1e-2. This relates to the allowed fidelity error between the RK4 and RK5 estimates.

Devuelve:

Configured integrate-method analog configuration.

Tipo del valor devuelto:

AnalogMethod

classmethod arnoldi(*, num_substeps: int = 1, dim: int = 10) AnalogMethod[fuente]

Build an arnoldi analog method configuration.

Parámetros:
  • num_substeps (int) – Number of integration substeps per schedule step when using the Arnoldi method. Defaults to 1.

  • dim (int) – Dimension of the Arnoldi Krylov subspace. Defaults to 10.

Devuelve:

Configured arnoldi-method analog configuration.

Tipo del valor devuelto:

AnalogMethod

classmethod direct() AnalogMethod[fuente]

Build a direct analog method configuration.

Devuelve:

Configured direct-method analog configuration.

Tipo del valor devuelto:

AnalogMethod

class ExecutionConfig(*args: Any, **kwargs: Any)[fuente]

Bases: BaseSimulatorConfig

Configuration for execution-level controls (threading and randomness).

Parámetros:
  • num_threads (int) – Number of CPU threads used for simulation. If set to 0, all available cores are selected. Defaults to 0.

  • seed (int | None) – Random seed used by the simulator. If None, a random seed is generated. Defaults to None.

  • monte_carlo (MonteCarloConfig | None) – Monte Carlo configuration. If None, Monte Carlo is disabled and deterministic evolution is used. Defaults to None.

Disallow positional arguments to keep configuration explicit.

Muestra:

TypeError – If positional arguments are provided.

model_config[fuente]

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

num_threads: int = None[fuente]
seed: int | None = None[fuente]
monte_carlo: MonteCarloConfig | None = None[fuente]
measurement_collapse: bool = None[fuente]
get_config() SolverConfigDict[fuente]

Return execution settings with resolved defaults.

class DigitalMethod(*args: Any, **kwargs: Any)[fuente]

Bases: BaseSimulatorConfig

Configuration for digital-circuit simulation options.

Preferred constructors:
Parámetros:
  • max_cache_size (int) – Maximum number of cached gate representations used by the digital simulator. Defaults to 1000.

  • normalize_after_each_gate (bool) – Whether to normalize the statevector after each gate application to mitigate numerical errors at the cost of increased runtime. Defaults to True.

  • combine_single_qubit_gates (bool) – Whether to combine consecutive single-qubit gates into a single operation to reduce overhead at the cost of increased memory usage. Defaults to True.

  • matrix_free (bool) – Whether to use the matrix-free implementation for statevector simulation. Defaults to True.

Disallow positional arguments to keep configuration explicit.

Muestra:

TypeError – If positional arguments are provided.

max_cache_size: int = None[fuente]
normalize_after_each_gate: bool = None[fuente]
combine_single_qubit_gates: bool = None[fuente]
matrix_free: bool = None[fuente]
get_config() SolverConfigDict[fuente]

Return digital simulation settings in backend-compatible key names.

classmethod statevector(*, max_cache_size: int = 1000, normalize_after_each_gate: bool = False, matrix_free: bool = True, combine_single_qubit_gates: bool = True) DigitalMethod[fuente]

Build the standard statevector simulation configuration.

Parámetros:
  • max_cache_size (int) – Maximum number of cached gate representations used by the digital simulator. Defaults to 1000.

  • normalize_after_each_gate (bool) – Whether to normalize the statevector after each gate application to mitigate numerical errors at the cost of increased runtime. Defaults to False.

  • matrix_free (bool) – Whether to use the matrix-free implementation for statevector simulation. Defaults to True.

  • combine_single_qubit_gates (bool) – Whether to combine consecutive single-qubit gates into a single operation. Defaults to True.

Devuelve:

Configured statevector digital configuration.

Tipo del valor devuelto:

DigitalMethod