qibolab.compilers package#
Submodules#
qibolab.compilers.compiler module#
- class qibolab.compilers.compiler.Compiler(rules: dict = <factory>)[source]#
Bases:
object
Compiler that transforms a
qibo.models.Circuit
to aqibolab.pulses.PulseSequence
.The transformation is done using a dictionary of rules which map each Qibo gate to a pulse sequence and some virtual Z-phases.
- A rule is a function that takes two argumens:
gate (
qibo.gates.abstract.Gate
): Gate object to be compiled.- platform (
qibolab.platforms.abstract.AbstractPlatform
): Platform object to read native gate pulses from.
- platform (
- and returns:
- sequence (
qibolab.pulses.PulseSequence
): Sequence of pulses that implement the given gate.
- sequence (
virtual_z_phases (dict): Dictionary mapping qubits to virtual Z-phases induced by the gate.
See
qibolab.compilers.default
for an example of a compiler implementation.- register(gate_cls)[source]#
Decorator for registering a function as a rule in the compiler.
Using this decorator is optional. Alternatively the user can set the rules directly via
__setitem__
.- Parameters:
gate_cls – Qibo gate object that the rule will be assigned to.
- compile(circuit, platform)[source]#
Transforms a circuit to pulse sequence.
- Parameters:
circuit (qibo.models.Circuit) – Qibo circuit that respects the platform’s connectivity and native gates.
platform (qibolab.platforms.abstract.AbstractPlatform) – Platform used to load the native pulse representations.
- Returns:
Pulse sequence that implements the circuit. measurement_map (dict): Map from each measurement gate to the sequence of readout pulse implementing it.
- Return type:
sequence (qibolab.pulses.PulseSequence)
qibolab.compilers.default module#
Implementation of the default compiler.
Uses I, Z, RZ, U3, CZ and M as the set of native gates.