iqm.error_reduction_tools.twirling.twirling_modifiers.absorb_pending_pi_rotation

iqm.error_reduction_tools.twirling.twirling_modifiers.absorb_pending_pi_rotation#

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

Absorb a pending π rotation (from the left) into the current R gate.

Implements the identity:

--[R(π, ξ)]--[R(θ, φ)]-- = --[R(θ+π, 2ξ - φ)]--[RZ(2(φ - ξ))]--

The pending π rotation (with phase extra_phi) is combined with the current gate R(θ, φ). The resulting RZ remainder is folded into virtual_z, the π-rotation counter is incremented (making it even again), and extra_phi is reset.

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

  • 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]