iqm.cirq_iqm.optimizers.MergeOneParameterGroupGates#
- class iqm.cirq_iqm.optimizers.MergeOneParameterGroupGates(post_clean_up: ~typing.Callable[[~typing.Sequence[cirq.Operation]], cirq.OP_TREE] = <function PointOptimizer.<lambda>>)#
Bases:
PointOptimizer
Merges adjacent gates belonging to the same parametrized gate family.
The merged gates have to act on the same sequence of qubits. This optimizer only works with gate families that are known to be one-parameter groups.
For now, all the families are assumed to be periodic with a period of 4.
Attributes
GATE_MERGING_TOLERANCE
ONE_PARAMETER_FAMILIES
PERIOD
Methods
_normalize_par
(par)Normalizes the given parameter value to (-period/2, period/2].
optimization_at
(circuit, index, op)Describes how to change operations near the given location.
- optimization_at(circuit: Circuit, index: int, op: Operation) PointOptimizationSummary | None #
Describes how to change operations near the given location.
- Parameters:
circuit (Circuit) – The circuit to improve.
index (int) – The index of the moment with the operation to focus on.
op (Operation) – The operation to focus improvements upon.
- Returns:
A description of the optimization to perform, or else None if no change should be made.
- Return type:
PointOptimizationSummary | None