3

In section 3.3.2 of this PDF, The general SWAP gate is defined as

$ S (\alpha, \hat{y}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos(\alpha/2) & -\sin(\alpha/2) & 0 \\ 0 & \sin(\alpha/2) & \cos(\alpha/2) & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} $

The same lecture notes claim that for $\alpha = \pi$, you get the SWAP gate. This is not correct if we perform the computation.

$ S (\pi, \hat{y}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} $

Those lecture notes also say the square root of SWAP can be created by setting $\alpha=\frac{\pi}{2}$. When we do that we get

$ S (\frac{\pi}{2}, \hat{y}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} & 0 \\ 0 & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} $

The matrix for the square root of Swap is $ \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \frac{1}{{2}} (1+i) & \frac{1}{{2}} (1-i) & 0 \\ 0 & \frac{1}{{2}} (1-i) & \frac{1}{{2}} (1+i) & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} $

This is not the same matrix as the one we get when we use the general SWAP matrix. Is the matrix for the general SWAP from those lecture notes correct? I haven't been able to find another source to cross-reference.

Martin Vesely
  • 15,244
  • 4
  • 32
  • 75
Victory Omole
  • 2,332
  • 1
  • 10
  • 24

1 Answers1

1

A gate $S (\alpha, \hat{y})$ implements this circuit:

enter image description here

Here is an example of code for $\alpha = \pi/4$ (other parameters of $U3$ have to be set as stated):

cx q[1], q[0];
cu3(pi/4,-pi,pi) q[0],q[1];
cx q[1], q[0];

Setting $\alpha = \pi$ leads to something similar to swap gate up to a phase for input $|10\rangle$ in which case $-|01\rangle$ is returned.

Martin Vesely
  • 15,244
  • 4
  • 32
  • 75