iqm.error_reduction_tools.twirling.twirling_modifiers.take_care_of_pending_operations

iqm.error_reduction_tools.twirling.twirling_modifiers.take_care_of_pending_operations#

iqm.error_reduction_tools.twirling.twirling_modifiers.take_care_of_pending_operations(registers, qubit, theta, phi)#

Process pending Z and π-rotation operations before the current R gate.

Before a new R(θ, φ) gate is applied, any accumulated Z rotation and pending π rotation on that qubit must be commuted through. This function:

  1. Z rotation: absorbs the pending RZ(α) by shifting φ → φ - α, using:

    --[RZ(α)]--[R(θ, φ)]-- = --[R(θ, φ - α)]--[RZ(α)]--
    
  2. Pending π rotation (if odd count): delegates to absorb_pending_pi_rotation, which combines the pending R(π, ξ) with the current gate.

Parameters:
  • registers (TrackingRegisters) – Tracking registers with virtual_z, extra_pi, extra_phi.

  • qubit (str) – Qubit identifier.

  • theta (float) – Polar rotation angle of the current gate.

  • phi (float) – Phase angle of the current gate.

Returns:

Tuple (theta, phi) with updated rotation parameters.

Return type:

tuple[float, float]