1
$\begingroup$

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.

$\endgroup$
  • 3
    $\begingroup$ Swap should have a +1 not a -1. Those lecture notes are defining something else, but it doesn't deserve to be called swap. $\endgroup$ – AHusain Feb 19 at 23:05
  • $\begingroup$ Yup. Just edited my question based on your comment. Thanks. $\endgroup$ – Victory Omole Feb 20 at 0:09
0
$\begingroup$

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.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Sure. I said something similar in my question: "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} $". Now that we've established that those notes are not completely accurate. What is the matrix that is similar to the one the lecture notes claim but would give us the right SWAP matrix and the right square root of SWAP based on the inputs given? $\endgroup$ – Victory Omole Feb 20 at 16:00
  • $\begingroup$ @VictoryOmole: It is possible only in case you can set inputs of $C-U3$ to get $CNOT$. But if you change other parameter than $\theta$, you will not be implement matrix $S(\alpha, \hat{y})$. So, it seems to me impossible to do so. $\endgroup$ – Martin Vesely Feb 20 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.