iqm.cirq_iqm.optimizers.DropRZBeforeMeasurement

iqm.cirq_iqm.optimizers.DropRZBeforeMeasurement#

class iqm.cirq_iqm.optimizers.DropRZBeforeMeasurement(drop_final: bool = False)#

Bases: PointOptimizer

Drops z rotations that happen right before a z-basis measurement.

These z rotations do not affect the result of the measurement, so we may ignore them.

Parameters:

drop_final (bool) – iff True, drop also any z rotation at the end of the circuit (since it’s not followed by a measurement, it cannot affect them)

Methods

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