class cirq.ISwapPowGate(*, exponent: Union[float, sympy.core.basic.Basic] = 1.0, global_shift: float = 0.0)[source]

Rotates the |01⟩ vs |10⟩ subspace of two qubits around its Bloch X-axis.

When exponent=1, swaps the two qubits and phases |01⟩ and |10⟩ by i. More
generally, this gate’s matrix is defined as follows:
ISWAP**t ≡ exp(+i π t (X⊗X + Y⊗Y) / 4)

which is given by the matrix:

[[1, 0, 0, 0],
 [0, c, i·s, 0],
 [0, i·s, c, 0],
 [0, 0, 0, 1]]


c = cos(π·t/2)
s = sin(π·t/2)
cirq.ISWAP, the swap gate that applies i to the |01⟩ and |10⟩ states,
is an instance of this gate at exponent=1.


“What is the matrix of the iSwap gate?”
__init__(*, exponent: Union[float, sympy.core.basic.Basic] = 1.0, global_shift: float = 0.0) → None

Initializes the parameters used to compute the gate’s matrix.

The eigenvalue of each eigenspace of a gate is computed by

  1. Starting with an angle in half turns as returned by the gate’s
    _eigen_components method:
  2. Shifting the angle by global_shift:

    θ + s
  3. Scaling the angle by exponent:

    (θ + s) * e
  4. Converting from half turns to a complex number on the unit circle:

    exp(i * pi * (θ + s) * e)
  • exponent – The t in gate**t. Determines how much the eigenvalues of the gate are scaled by. For example, eigenvectors phased by -1 when gate**1 is applied will gain a relative phase of e^{i pi exponent} when gate**exponent is applied (relative to eigenvectors unaffected by gate**1).

  • global_shift

    Offsets the eigenvalues of the gate at exponent=1. In effect, this controls a global phase factor on the gate’s unitary matrix. The factor is:

    exp(i * pi * global_shift * exponent)

    For example, cirq.X**t uses a global_shift of 0 but cirq.rx(t) uses a global_shift of -0.5, which is why cirq.unitary(cirq.rx(pi)) equals -iX instead of X.


controlled([num_controls, control_values, …])

Returns a controlled version of this gate. If no arguments are


The number of qubits this gate acts on.


Returns an application of this gate to the given qubits.


Returns a key that differs between non-interchangeable qubits.


Checks if this gate can be applied to the given qubits.