Skip to main content

Module execution

Module execution 

Source
Expand description

Execution backend abstractions for the Libket quantum computing library.

This module defines the traits and data types that decouple the compiler front-end from the concrete quantum hardware or simulator backend:

  • LiveExecution: a backend that receives gates one at a time and returns measurement results immediately (mid-circuit feedback). Use this mode when the circuit outcome influences subsequent gate choices (e.g., adaptive circuits, mid-circuit resets).
  • BatchExecution: a backend that receives a fully-compiled native gate sequence and returns aggregate results (histograms, expectation values). Use this mode for variational algorithms, sampling, and expectation-value estimation where the full circuit is known upfront.
  • NativeGateSet: an optional translation layer that maps the Libket gate IR to a hardware-specific gate vocabulary. If omitted, the built-in RzRyCX translation is used, which emits rz, ry, and cnot native gates.
  • QuantumExecution: the union of both execution modes, stored inside a crate::process::Process.

§Error handling

All trait methods return Result<_, KetError>. Backends should return KetError::ExecutionFailed for unrecoverable hardware faults and KetError::ShotCountInvalid when a requested shot count is out of range.

Structs§

DumpData
The quantum-state snapshot returned by a dump operation.

Enums§

ExpValueStrategy
Strategy for computing expectation values in batch mode.
GradientStrategy
Strategy for computing parameter-shift gradients.
QuantumExecution
The execution target attached to a crate::process::Process.

Traits§

BatchExecution
A backend that receives a fully-compiled gate sequence and returns aggregate results without mid-circuit feedback.
LiveExecution
A backend that executes gates as they arrive and can return mid-circuit measurement results immediately.
NativeGateSet
Translates Libket IR gates into hardware-specific native gate sequences.

Type Aliases§

BitString
A bit-string measurement outcome encoded as a vector of 64-bit words.
NativeGate
A hardware-native gate: (name, angles, qubit_indices).
RzRyCX
The {RZ, RY, CNOT} native gateset.
SampleData
The result of a sample operation: (bit_strings, counts).