AddSpectatorPostCircuitBitFlipChecks¶
- class AddSpectatorPostCircuitBitFlipChecks(*args, **kwargs)[source]¶
Bases:
TransformationPassAdd bit-flip checks at the end of the circuit on qubits adjacent to active qubits.
Each spectator qubit receives a post-circuit bit-flip check: a measurement, then a narrowband X-pulse that flips the qubit’s state (\(|x\rangle\mapsto|x\oplus1\rangle\)), then a second measurement. If the QPU fails to flip the qubit between the two measurements on a given shot, that sample may be considered unreliable and discarded. Postselecting only samples that pass all checks can improve the fidelity of distributions sampled from the QPU. Optionally via
include_unmeasured, active qubits that are not terminated by a measurement are also treated as spectators.Two classical registers are added, each with one bit per spectator qubit:
spectator_creg_name(default"spec") holds the first measurement andspectator_creg_name + post_check_suffix(default"spec_ps") holds the second, and a shot is kept when the two disagree.Note
These passes are only supported on Heron QPUs where fractional gates are supported.
Initialize the pass.
- Parameters:
coupling_map – A coupling map or a list of tuples indicating pairs of neighboring qubits.
x_pulse_type – The type of X-pulse to apply between the two spectator measurements. Either
"xslow"or"rx".include_unmeasured – Whether qubits that are active but not terminated should also be treated as spectators. If
True, the parity check is added to each of them as well.spectator_creg_name – The name of the classical register holding the first spectator measurement. The post-check register is named
spectator_creg_name + post_check_suffix.ignore_creg_suffixes – A list of suffixes for classical registers that should be ignored when determining active/terminated qubits. By default, registers ending with
"_pre"are ignored so that pre-check measurements aren’t treated as regular terminations.post_check_suffix – The suffix appended to
spectator_creg_nameto form the post-check register name, and used to identify the data-qubit post-check barriers that the spectator parity check is integrated into. Defaults to"_ps".
Attributes
- is_analysis_pass¶
Check if the pass is an analysis pass.
If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.
- is_transformation_pass¶
Check if the pass is a transformation pass.
If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).
Methods
- execute(passmanager_ir, state, callback=None)¶
Execute optimization task for input Qiskit IR.
- Parameters:
passmanager_ir (DAGCircuit) – Qiskit IR to optimize.
state (DAGCircuit) – State associated with workflow execution by the pass manager itself.
callback (Callable[[Task, DAGCircuit, PropertySet, float, int], None] | None) – A callback function which is called per execution of optimization task.
- Returns:
Optimized Qiskit IR and state of the workflow.
- Return type:
- run(dag)[source]¶
Run a pass on the DAGCircuit. This is implemented by the pass developer.
- Parameters:
dag (DAGCircuit) – the dag on which the pass is run.
- Raises:
NotImplementedError – when this is left unimplemented for a pass.
- update_status(state, run_state)¶
Update workflow status.
- Parameters:
state (PassManagerState) – Pass manager state to update.
run_state (RunState) – Completion status of current task.
- Returns:
Updated pass manager state.
- Return type: