qrunch.quantum.circuits.transpiler
Module with transpiler that can transpile a Kvantify Qrunch Circuit to universal third party circuits.
Classes
Class for transpile circuits, i.e., compile the circuit to universal gates and translate to circuit type. |
|
Dataclass for handling transpiler results. |
- class Transpiler
Bases:
Generic[ThirdPartyCircuit]Class for transpile circuits, i.e., compile the circuit to universal gates and translate to circuit type.
- __init__(compiler: Compiler, translator: Translator[ThirdPartyCircuit], synthesizer: LayoutSynthesizer | None = None) None
Initialize a transpiler.
- Parameters:
compiler (Compiler) – Compiler to use.
translator (Translator[ThirdPartyCircuit]) – Translator to use.
synthesizer (LayoutSynthesizer | None) – Layout synthesizer to use. Defaults to None.
- Return type:
None
- transpile(circuits: Circuit | Sequence[Circuit], device_data: DeviceData | None = None) list[TranspilerResult[ThirdPartyCircuit]]
Transpile the given circuits to third party circuits format.
This is done first by compiling the circuit to a universal gate set, and then translating the gates to third party circuit using the given translator.
- Parameters:
circuits (Circuit | Sequence[Circuit]) – circuits to transpile.
device_data (DeviceData | None) – Device data for the circuit to be mapped to. If None, all-to-all connection is assumed.
- Return type:
list[TranspilerResult[ThirdPartyCircuit]]
- class TranspilerResult
Bases:
Generic[ThirdPartyCircuit]Dataclass for handling transpiler results.
All fields are immutable (
frozen=True) so an instance can be safely reused.- Parameters:
circuit – Transpiled circuit.
mapping – Qubit mapping if any. Defaults to None. (default=None)
- __init__(third_party_circuit: ThirdPartyCircuit, first_party_circuit: UniversalGateCircuit, mapping: QubitMap | None = None) None
- Parameters:
third_party_circuit (ThirdPartyCircuit)
first_party_circuit (UniversalGateCircuit)
mapping (QubitMap | None)
- Return type:
None
- first_party_circuit: UniversalGateCircuit
- third_party_circuit: ThirdPartyCircuit