9

How could a $\sqrt{SWAP}$ circuit be expressed in terms of CNOT gates & single qubit rotations?

CNOT & SQRT of SWAP

  • CNOT & $\sqrt{SWAP}$ Gates

Any quantum circuit can be simulated to an arbitrary degree of accuracy using a combination of CNOT gates and single qubit rotations.

Both CNOT and $\sqrt{SWAP}$ are universal two-qubit gates and can be transformed into each other.

Edit

The questions are not identical, and are likely to attract different audiences. -DaftWullie

Can the difference be regarded as applied vs theoretic?

Sanchayan Dutta
  • 17,497
  • 7
  • 48
  • 110
user820789
  • 3,302
  • 12
  • 42

2 Answers2

7

As pointed out by @Nelimee, this question is essentially answered in this question, even if that question seems more specific. However, for the sake of completeness... (Note that I make no claims about minimality of construction with respect to, for example, number of controlled-not gates.)

Let's start with a unitary matrix for the square root of SWAP: $$ \left( \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & \frac{1}{2}+\frac{i}{2} & \frac{1}{2}-\frac{i}{2} & 0 \\ 0 & \frac{1}{2}-\frac{i}{2} & \frac{1}{2}+\frac{i}{2} & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) $$ Note that if we pre- and post-multiply by a controlled NOT, controlled off qubit 2, this transforms into the form of a controlled-$U$ gate: $$ \left( \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \frac{1}{2}+\frac{i}{2} & \frac{1}{2}-\frac{i}{2} \\ 0 & 0 & \frac{1}{2}-\frac{i}{2} & \frac{1}{2}+\frac{i}{2} \\ \end{array} \right) $$ There are standard constructions for this controlled-$U$ gate. So, overall, we have a circuit that looks like enter image description here where $ABC=\mathbb{I}$ and $AXBXC=e^{i\pi/4}\sqrt{X}$. Again, there are standard routes towards finding $A$, $B$ and $C$. For instance, we can define $R_Y(\theta)$ to be a rotation about the $Y$ axis by an angle $\theta$, i.e. $R_Y(\theta)=e^{i\theta Y}$ (there may be a factor of $\frac12$ here compared to some definitions). Then, if $$ A=R_Y(\theta)R_Z(\phi)\qquad B=R_Z(-2\phi)\qquad C=R_Z(\phi)R_Y(-\theta), $$ then it's easy to verify that $ABC=\mathbb{I}$. Furthermore, $AXBXC=R_Y(\theta)R_Z(4\phi)R_Y(-\theta)$ since $XR_Z(\phi)X=R_Z(-\phi)$. You can think of this as $R_Z(4\phi)$ specifying the eigenvalues that we want, and the $R_Y(\theta)$ is changing the basis from the computational basis into something else. In the present case, we have $\theta=\pi/2$ and $4\phi=\pi/4$.

The one little thing that we haven't got right yet is a phase factor. Our $AXBXC$ is creating the correct rotation up to an overall phase of $e^{i\pi/4}$: $$ \left( \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \frac{1}{\sqrt{2}} & -\frac{i}{\sqrt{2}} \\ 0 & 0 & -\frac{i}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \end{array} \right) $$ The trick to get this right is to apply an $R_Z(\pi/8)$ on the first qubit and remove a global phase of $e^{i\pi/8}$. Thus, we have enter image description here

DaftWullie
  • 57,689
  • 3
  • 46
  • 124
6

I think that you want answers to explicitly use full cnots, rather than partial versions. But since you already have an answer for that, I'll contribute a different perspective.

A $\mathrm{SWAP}$ can be thought of as a cnot that has been conjugated by oppositely oriented cnots.

$$\mathrm{SWAP} = {\rm cx}(k,j) \,\, {\rm cx}(j,k) \,\, {\rm cx}(k,j) $$

To make a $\sqrt{\mathrm{SWAP}}$, we can instead use a square root of cnot conjugated by oppositely oriented cnots.

$$ \sqrt{\mathrm{SWAP}} = {\rm cx}(k,j) \,\, \sqrt{{\rm cx}(j,k)} \,\, {\rm cx}(k,j) $$

To verify that this is indeed a $\sqrt{\mathrm{SWAP}}$, you can simply square it and verify that it ends up in the way we expect (using the fact that cnots square to identity).

Sanchayan Dutta
  • 17,497
  • 7
  • 48
  • 110
James Wootton
  • 11,272
  • 1
  • 31
  • 72