qrunch.quantum.circuits.synthesis.synthesized_circuit

Module containing the SynthesizedCircuit dataclass.

Classes

SynthesizedCircuit

A circuit that has been mapped to a device topology by a layout synthesizer.

SynthesizedUniversalGateCircuit

A universal gate circuit that has been mapped to a device topology by a layout synthesizer.

class SynthesizedCircuit

Bases: object

A circuit that has been mapped to a device topology by a layout synthesizer.

All fields are immutable (frozen=True) so an instance can be safely reused.

Parameters:
  • original_circuit – The circuit before layout synthesis.

  • mapped_circuit – The circuit after layout synthesis, with SWAP gates inserted for the target topology.

  • device – The device data for the target topology, if available.

  • initial_mapping – The initial logical-to-physical qubit mapping before synthesis.

  • final_mapping – The final logical-to-physical qubit mapping produced by synthesis.

__init__(original_circuit: UniversalGateCircuit, mapped_circuit: Circuit, device: DeviceData | None, initial_mapping: QubitMap, final_mapping: QubitMap) None
Parameters:
Return type:

None

device: DeviceData | None
final_mapping: QubitMap
classmethod from_unswapped_circuit(circuit: UniversalGateCircuit, device: DeviceData | None = None) SynthesizedCircuit

Create a SynthesizedCircuit from an unswapped circuit.

This is useful for cases where no SWAP gates are needed, and the original circuit can be used as the mapped circuit.

Parameters:
  • circuit (UniversalGateCircuit) – The original circuit that does not require any SWAP gates.

  • device (DeviceData | None) – The device data for the target topology, if available.

Return type:

SynthesizedCircuit

initial_mapping: QubitMap
mapped_circuit: Circuit
original_circuit: UniversalGateCircuit
class SynthesizedUniversalGateCircuit

Bases: object

A universal gate circuit that has been mapped to a device topology by a layout synthesizer.

All fields are immutable (frozen=True) so an instance can be safely reused.

Parameters:
  • original_circuit – The circuit before layout synthesis.

  • mapped_circuit – The circuit after layout synthesis, with SWAP gates inserted for the target topology.

  • device – The device data for the target topology, if available.

  • initial_mapping – The initial logical-to-physical qubit mapping before synthesis.

  • final_mapping – The final logical-to-physical qubit mapping produced by synthesis.

__init__(original_circuit: UniversalGateCircuit, mapped_circuit: UniversalGateCircuit, device: DeviceData | None, initial_mapping: QubitMap, final_mapping: QubitMap) None
Parameters:
Return type:

None

device: DeviceData | None
final_mapping: QubitMap
classmethod from_unswapped_circuit(circuit: UniversalGateCircuit) SynthesizedUniversalGateCircuit

Create a SynthesizedUniversalGateCircuit from an unswapped circuit.

This is useful for cases where no SWAP gates are needed, and the original circuit can be used as the mapped circuit.

Parameters:

circuit (UniversalGateCircuit) – The original circuit that does not require any SWAP gates.

Return type:

SynthesizedUniversalGateCircuit

get_measured_qubits() list[PhysicalQubit]

Return the list of physical qubits that are measured in the circuit.

Return type:

list[PhysicalQubit]

initial_mapping: QubitMap
mapped_circuit: UniversalGateCircuit
original_circuit: UniversalGateCircuit