iqm.cirq_iqm.optimizers.MergeOneParameterGroupGates

iqm.cirq_iqm.optimizers.MergeOneParameterGroupGates#

class iqm.cirq_iqm.optimizers.MergeOneParameterGroupGates(post_clean_up=<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.

Inits PointOptimizer.

Parameters:

post_clean_up (Callable[[Sequence[cirq.Operation]], cirq.OP_TREE]) – This function is called on each set of optimized operations before they are put into the circuit to replace the old operations.

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, index, op)#

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