qrunch.quantum.circuits.synthesis.layout.sabre_layout_synthesizer
Module containing the class for performing layout synthesis using Qiskit’s Sabre synthesizer.
Classes
Class for synthesizing circuits to only contain gates which obey a given qubit connection graph. |
|
Creator class for creating a sabre layout synthesizer. |
|
Options for the Sabre layout synthesizer. |
- class SabreLayoutSynthesizer
Bases:
LayoutSynthesizerClass for synthesizing circuits to only contain gates which obey a given qubit connection graph.
This synthesizer uses Qiskit’s Sabre layout synthesizer to perform the layout synthesis.
- __init__(options: SabreLayoutSynthesizerOptions | None = None) None
Initialize the layout synthesizer.
- Parameters:
options (SabreLayoutSynthesizerOptions | None) – Options for the Sabre layout synthesizer. If not provided, default options are used.
- Return type:
None
- synthesize(circuit: UniversalGateCircuit, device_data: DeviceData) SynthesizedCircuit
Synthesize the circuit to conform to the physical qubit coupling graph of the layout synthesizer.
- Parameters:
circuit (UniversalGateCircuit) – Circuit to be synthesized.
device_data (DeviceData) – Device data containing qubit connectivity information.
- Raises:
LayoutSynthesizerError – If no solution is found using the maximum allowed number of swap gates.
- Return type:
- class SabreLayoutSynthesizerCreator
Bases:
objectCreator class for creating a sabre layout synthesizer.
- __init__() None
Initialize the creator with default parameters.
- Return type:
None
- create() SabreLayoutSynthesizer
Create an instance of
SabreLayoutSynthesizer.- Return type:
- with_exclude_worst_qubits(exclude: bool) Self
Set whether to exclude the worst qubits from the hardware before layout synthesis.
- Parameters:
exclude (bool) – Whether to exclude the worst qubits from the hardware before layout synthesis.
- Return type:
Self
- with_hardware_optimizations(include: bool) Self
Set whether to include hardware optimizations during synthesis.
Hardware aware optimizations are performed after layout synthesis to reduce gate count and overall error.
- Parameters:
include (bool) – Whether to include hardware optimizations during synthesis.
- Return type:
Self
- with_number_of_tries(number_of_tries: int) Self
Set the number of tries for the Sabre layout synthesizer.
- Parameters:
number_of_tries (int) – Number of times to try the Sabre algorithm of which the best is picked. Defaults to 10.
- Return type:
Self
- class SabreLayoutSynthesizerOptions
Bases:
objectOptions for the Sabre layout synthesizer.
- Parameters:
number_of_tries – Number of times to try the Sabre algorithm of which the best is picked.
include_hardware_optimizations – Whether to include hardware optimizations during synthesis. If enabled, the circuits will be post-processed to reduce the number of gates and error using Qiskit’s optimization routines. If disabled, the synthesizer will only use the Sabre layout and swap algorithms.
exclude_worst_qubits – Whether to exclude the worst qubits from the device data before synthesis.
- __init__(*, number_of_tries: int = 10, include_hardware_optimizations: bool = True, exclude_worst_qubits: bool = True) None
- Parameters:
number_of_tries (int)
include_hardware_optimizations (bool)
exclude_worst_qubits (bool)
- Return type:
None
- exclude_worst_qubits: bool = True
- include_hardware_optimizations: bool = True
- number_of_tries: int = 10