qldpc.circuits.memory.syndrome_measurement
Classes to define syndrome measurement strategies.
Classes
Edge coloration strategy for constructing a syndrome measurement circuit. |
|
Edge coloration syndrome measurement strategy in Algorithm 1 of arXiv:2109.14609. |
|
Base class for a syndrome measurement strategy. |
Functions
Validate the qubit layout for a syndrome-measurement strategy. |
Module Contents
- class qldpc.circuits.memory.syndrome_measurement.EdgeColoring(strategy: str = 'smallest_last', **subgraph_kwargs: object)[source]
Bases:
SyndromeMeasurementStrategyEdge coloration strategy for constructing a syndrome measurement circuit.
Every edge of a code’s Tanner graph is associated with a two-qubit gate that needs to be applied to “write” parity checks onto ancilla qubits (i.e., for syndrome extraction). This syndrome measurement strategy iterates over the subgraphs of a code’s Tanner graph in the order specified by code.get_syndrome_subgraphs(). For each subgraph, this strategy colors the edges of that subgraph such that no pair of vertex-adjacent edges share the same color, and then applies the corresponding gates one color at a time.
WARNING: This strategy is not guaranteed to be distance-preserving or fault-tolerant.
- get_circuit(code: qldpc.codes.QuditCode, qubit_ids: qldpc.circuits.bookkeeping.QubitIDs | None = None) tuple[stim.Circuit, qldpc.circuits.bookkeeping.MeasurementRecord][source]
Construct a circuit to measure the syndromes of a quantum error-correcting code.
- Parameters:
code – The code whose syndromes we want to measure.
qubit_ids – Integer indices for the data and check (syndrome readout) qubits. Defaults to QubitIDs.from_code(code).
- Returns:
A syndrome measurement circuit. circuits.MeasurementRecord: The record of measurements in the circuit.
- Return type:
stim.Circuit
- static graph_to_circuit(graph: qldpc._util.networkx.DiGraph, qubit_ids: qldpc.circuits.bookkeeping.QubitIDs, strategy: str) stim.Circuit[source]
Convert a Tanner (sub)graph into a syndrome extraction circuit.
Edges of the graph correspond to two-qubit controlled-pauli (i.e., CX, CY, or CZ) gates. This method colors all edges to identify subsets of qubit-disjoint gates, and then applies the corresponding gates one color at a time.
Assumptions:
All two-qubit gates associated with edges in the graph commute.
Check qubits are initialized
|+>.
The caller supplies the initial framing
TICK; each colored layer contributes one trailingTICK. This keepsnum_ticksequal to the scheduled gate depth while making standalone rounds composable.
- strategy = 'smallest_last'
- subgraph_kwargs
- class qldpc.circuits.memory.syndrome_measurement.EdgeColoringXZ(strategy: str = 'smallest_last')[source]
Bases:
EdgeColoringEdge coloration syndrome measurement strategy in Algorithm 1 of arXiv:2109.14609.
For a CSS code with Tanner graph T, this strategy is as follows:
Construct the subgraphs T_X and T_Z of T restricted, respectively, to X and Z stabilizers.
- For each T_P in (T_X, T_Z), color the edges of T_P, and then apply all corresponding gates
one color at a time.
WARNING: This strategy is not guaranteed to be distance-preserving or fault-tolerant.
- get_circuit(code: qldpc.codes.QuditCode, qubit_ids: qldpc.circuits.bookkeeping.QubitIDs | None = None) tuple[stim.Circuit, qldpc.circuits.bookkeeping.MeasurementRecord][source]
Construct a circuit to measure the syndromes of a quantum error-correcting code.
- Parameters:
code – The code whose syndromes we want to measure.
qubit_ids – Integer indices for the data and check (syndrome readout) qubits. Defaults to QubitIDs.from_code(code).
- Returns:
A syndrome measurement circuit. circuits.MeasurementRecord: The record of measurements in the circuit.
- Return type:
stim.Circuit
- strategy = 'smallest_last'
- subgraph_kwargs: dict[str, object]
- class qldpc.circuits.memory.syndrome_measurement.SyndromeMeasurementStrategy[source]
Bases:
abc.ABCBase class for a syndrome measurement strategy.
- abstractmethod get_circuit(code: qldpc.codes.QuditCode, qubit_ids: qldpc.circuits.bookkeeping.QubitIDs | None = None) tuple[stim.Circuit, qldpc.circuits.bookkeeping.MeasurementRecord][source]
Construct a circuit to measure the syndromes of a quantum error-correcting code.
- Parameters:
code – The code whose syndromes we want to measure.
qubit_ids – Integer indices for the data and check (syndrome readout) qubits. Defaults to QubitIDs.from_code(code).
- Returns:
A syndrome measurement circuit. circuits.MeasurementRecord: The record of measurements in the circuit.
- Return type:
stim.Circuit
- qldpc.circuits.memory.syndrome_measurement.validate_syndrome_qubit_ids(code: qldpc.codes.QuditCode, qubit_ids: qldpc.circuits.bookkeeping.QubitIDs | None = None) qldpc.circuits.bookkeeping.QubitIDs[source]
Validate the qubit layout for a syndrome-measurement strategy.
- Parameters:
code – The code whose syndromes will be measured.
qubit_ids – Integer indices for the data and check qubits. Defaults to
QubitIDs.from_code(code).
- Returns:
A validated qubit layout.
- Raises:
ValueError – If the code is a subsystem code or the qubit layout is invalid.