iqm.cirq_iqm.optimizers.DropRZBeforeMeasurement

iqm.cirq_iqm.optimizers.DropRZBeforeMeasurement#

class iqm.cirq_iqm.optimizers.DropRZBeforeMeasurement(drop_final=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)

Inits PointOptimizer.

Parameters:
  • post_clean_up – This function is called on each set of optimized operations before they are put into the circuit to replace the old operations.

  • drop_final (bool) –

Methods

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