CompositeGate#
- class iqm.pulse.gate_implementation.CompositeGate(parent, name, locus, calibration_data, builder)#
Bases:
GateImplementation
Utility base class for creating gate implementations that are defined in terms of other gate implementations.
Gates can be implemented using other pre-existing gate implementations by just utilizing the ScheduleBuilder in
builder
in the__call__()
method (e.g. by callingself.builder.get_implementation(<some gate>, <some locus>)
. In this way, any such “member gates” will use the common calibration that exists inbuilder
. In order for a composite gate implementation to be able to calibrate its member gates with different calibration values from the common calibration, it needs to know what gates it considers as its “members”. This is what the CompositeGate ABC is for.Inheriting from this class and defining e.g.
registered_gates = ["prx", "cz"]
allows one to calibrate the member operations (i.e."prx"
and"cz"
in this example) inside this composite gate differently from the common calibration. However, if no specific calibration data is provided, the gate implementation will be calibrated with the common calibration.Module:
iqm.pulse.gate_implementation
Attributes
Mapping from operation names to the designated default implementation of that operation.
Gates that can be calibrated separately from their common calibration existing in
self.builder
.Methods
Construct a member gate implementation.
- Parameters:
parent (QuantumOp) –
name (str) –
locus (Locus) –
calibration_data (OILCalibrationData) –
builder (ScheduleBuilder) –
- registered_gates: list[str] = []#
Gates that can be calibrated separately from their common calibration existing in
self.builder
. The gate names should correspond to the keys inself.builder.op_table
. Other gates besides the ones given here can also be constructed viaself.builder
, but these will always use the common calibration.
- default_implementations: dict[str, str] = {}#
Mapping from operation names to the designated default implementation of that operation. Filling this attribute allows one to define a different default implementation from the common default in
self.builder.op_table
to be used in he context of this composite gate. If an operation is not found in this dict as a key, this CompositeGate will use the common default as the default implementation for it.
- build(op_name, locus, impl_name=None, strict_locus=False)#
Construct a member gate implementation.
If the gate
op_name
is registered, a specific calibration for it in the context of this CompositeGate will be sought for fromself.builder.calibration
. If any (non-empty) calibration values are found inself.builder.calibration[self.name][op_name][<impl_name>]
they will be merged to the common calibration (only non-empty values will be merged). If there are no values found, the common calibration will be used.- Parameters:
op_name (str) – operation name
impl_name (str | None) – Implementation name. If not given, uses the default implementation defined in the class instance if any, and otherwise the common default in
self.builder.op_table
strict_locus (bool) – iff False, for non-symmetric implementations of symmetric ops the locus order may be changed if no calibration data is available for the requested locus order
- Returns:
Calibrated gate implementation.
- Return type: