qilisdk.backends.backend_config
Attributes
Classes
Abstract base class for all QiliSim configuration sections. |
|
Configuration for Monte Carlo trajectory sampling in open-system simulations. |
|
Configuration for analog time-evolution method selection and its hyperparameters. |
|
Configuration for execution-level controls (threading and randomness). |
|
Configuration for digital-circuit simulation options. |
Module Contents
- ConfigValue[fuente]
- SolverConfigDict[fuente]
- class BaseSimulatorConfig(*args: Any, **kwargs: Any)[fuente]
Bases:
pydantic.BaseModel,abc.ABCAbstract 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:
BaseSimulatorConfigConfiguration 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 to100.
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:
BaseSimulatorConfigConfiguration for analog time-evolution method selection and its hyperparameters.
- Preferred constructors:
integrator()for integrate-based evolution.arnoldi()for Krylov/Arnoldi-based evolution.direct()for direct evolution.
- 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 whenevolution_method="arnoldi". Defaults to10.num_arnoldi_substeps (
int) – Number of integration substeps per schedule step for the Arnoldi method. Defaults to1.
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
integrateanalog method configuration.- Parámetros:
matrix_free (
bool) – Whether to use the matrix-free implementation for the Integrate method. Defaults toFalse.- Devuelve:
Configured integrate-method analog configuration.
- Tipo del valor devuelto:
- 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:
- classmethod adaptive_integrator(*, tol: float = 0.01) AnalogMethod[fuente]
Build an
adaptive_integrateanalog 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 to1e-2. This relates to the allowed fidelity error between the RK4 and RK5 estimates.- Devuelve:
Configured integrate-method analog configuration.
- Tipo del valor devuelto:
- classmethod arnoldi(*, num_substeps: int = 1, dim: int = 10) AnalogMethod[fuente]
Build an
arnoldianalog method configuration.- Parámetros:
- Devuelve:
Configured arnoldi-method analog configuration.
- Tipo del valor devuelto:
- classmethod direct() AnalogMethod[fuente]
Build a
directanalog method configuration.- Devuelve:
Configured direct-method analog configuration.
- Tipo del valor devuelto:
- class ExecutionConfig(*args: Any, **kwargs: Any)[fuente]
Bases:
BaseSimulatorConfigConfiguration for execution-level controls (threading and randomness).
- Parámetros:
num_threads (
int) – Number of CPU threads used for simulation. If set to0, all available cores are selected. Defaults to0.seed (
int | None) – Random seed used by the simulator. IfNone, a random seed is generated. Defaults toNone.monte_carlo (
MonteCarloConfig | None) – Monte Carlo configuration. IfNone, Monte Carlo is disabled and deterministic evolution is used. Defaults toNone.
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:
BaseSimulatorConfigConfiguration for digital-circuit simulation options.
- Preferred constructors:
statevector()for standard state-vector simulation settings.
- Parámetros:
max_cache_size (
int) – Maximum number of cached gate representations used by the digital simulator. Defaults to1000.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 toTrue.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 toTrue.matrix_free (
bool) – Whether to use the matrix-free implementation for statevector simulation. Defaults toTrue.
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 to1000.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 toFalse.matrix_free (
bool) – Whether to use the matrix-free implementation for statevector simulation. Defaults toTrue.combine_single_qubit_gates (
bool) – Whether to combine consecutive single-qubit gates into a single operation. Defaults toTrue.
- Devuelve:
Configured statevector digital configuration.
- Tipo del valor devuelto: