Circuit#
-
class cuquantum.
stabilizer. Circuit( - circuit: str | stim.Circuit,
- stream: int | cp.cuda.Stream | None = None,
- options: Options | None = None,
Represents a quantum circuit for the frame simulator.
This class wraps a circuit defined in Stim-compatible string format. The circuit owns the device buffer where the circuit data is stored.
- Parameters:
circuit_string – Stim-compatible circuit string representation.
stream – Optional CUDA stream.
options – Optional Options object for configuration.
Example
>>> circuit = Circuit( ... "H 0\n" ... "CNOT 0 1\n" ... "M 0 1\n" ... ) >>> # Or with options >>> options = Options(device_id=0) >>> circuit = Circuit( ... "H 0\n" ... "CNOT 0 1\n", ... options=options, ... )
Methods
- __init__(
- circuit: str | stim.Circuit,
- stream: int | cp.cuda.Stream | None = None,
- options: Options | None = None,
Initialize a Circuit object.
- Parameters:
circuit_string – Stim-compatible circuit string.
stream – Optional CUDA stream identifier.
options – Optional Options configuration.
- classmethod from_deltakit_stim(
- circuit: str,
- *,
- parser_options: DeltakitParserOptions | dict | None = None,
- stream: int | cp.cuda.Stream | None = None,
- options: Options | None = None,
Create a circuit from deltakit-stim text.
- Parameters:
circuit – Deltakit-stim circuit text.
parser_options – A
DeltakitParserOptionsinstance, compatible dictionary, orNone.stream – Optional CUDA stream identifier.
options – Optional cuStabilizer configuration.
- classmethod from_deltakit_stim_file(
- path: Path | str,
- *,
- parser_options: DeltakitParserOptions | dict | None = None,
- stream: int | cp.cuda.Stream | None = None,
- options: Options | None = None,
Create a circuit from a deltakit-stim file.
- Parameters:
path – Path to a deltakit-stim circuit file.
parser_options – A
DeltakitParserOptionsinstance, compatible dictionary, orNone.stream – Optional CUDA stream identifier.
options – Optional cuStabilizer configuration.
Attributes
- circuit#
Return the underlying C circuit object.
- handle#
Return the underlying C handle object.
- has_leakage#
Whether the circuit contains any leakage instruction.
- has_noise#
Whether the circuit contains any noise/error instruction.
- num_1q_gates#
Number of single-qubit Clifford gates (one per target).
- num_2q_gates#
Number of two-qubit Clifford gates (one per control-target pair).
- num_detectors#
Number of
DETECTORinstructions in the circuit.
- num_leakage_instructions#
Total number of leakage instructions in the circuit.
- num_leakage_readouts#
Number of herald leakage readout rows (
HERALD_LEAKAGE_EVENTtargets).
- num_measurement_gates#
Ordinary measurement readout rows (M, MX, MY, MR*); excludes herald leakage readouts.
- num_measurements#
measurement gates plus herald leakage readouts.
- Type:
Total measurement table rows
- num_qubits#
Number of qubits = max qubit index + 1 (0 for an empty circuit).
- num_repeat_blocks#
Number of
REPEATblocks across all nesting levels.
- num_resets#
Total reset operations, per target.