Skip to content

loqs.backends

Quantum simulation backends for LoQS

There are three kinds of backends in LoQS: circuit, model, and state.

Warning

For backends that depend on optional third-party packages, it is recommended to not import from the module/class file directly. Instead, try to import from loqs.backends, which dynamically checks if that backend is available using the below methods.

Examples:

>>> from loqs.backends import get_available_backends
>>> list_of_backends = get_available_backends()

Classes

Functions

get_available_backends

get_available_backends() -> list[str]

Get list of available backend names


get_backend_error

get_backend_error(backend_name: str) -> str | None

Get the error message for an unavailable backend


is_backend_available

is_backend_available(backend_name: str) -> bool

Check if a specific backend is available


propagate_state

propagate_state(circuit: BasePhysicalCircuit, model: BaseNoiseModel, state: BaseQuantumState, inplace: bool = True) -> tuple[BaseQuantumState, OutcomeDict]

Given a circuit and model, propagate a state forward in time.

This is a wrapper for get_reps() and apply_reps_inplace() (or the non-inplace version if inplace=False). It does also try to find compatible reptypes by searching for a match in output reps from model and input reps from state. A model's output reps include the types it can convert its own reps to.

Parameters:

Name Type Description Default
circuit BasePhysicalCircuit

The circuit to run

required
model BaseNoiseModel

The noise model to use to convert circuit operations into representations the state can apply

required
state BaseQuantumState

The state to move forward in time

required
inplace bool

Whether to modify the state in-place (True, default) or propagate a copy forward (False). This should probably remain True for memory reasons.

True

Returns:

Type Description
(BaseQuantumState, OutcomeDict)

The output of apply_reps(). If inplace=True, then the state is also returned to provide a consistent API.