4
$\begingroup$

The following are the matrices for SWAP and iSWAP gates.

SWAP = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} iSWAP = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & i & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} Both are similar except iSWAP adds a phase to $|01\rangle$ and $|10\rangle$ amplitudes.

How can the SWAP operation be realized using the iSWAP gate?

$\endgroup$
1
  • $\begingroup$ Sorry, I misread your question earlier. $\endgroup$ – KAJ226 Nov 10 '20 at 0:01
5
$\begingroup$

It can't be done in one or two uses of the iSwap because an iSwap is equivalent (up to single qubit rotations) to a SWAP+CZ. A single SWAP+CZ is not a swap. The two swaps in a pair of SWAP+CZs cancel out, leaving you with two CZs (and arbitry single qubit operations around them), which is also not enough to do a swap.

But you can do it with three:

iswap circuit

$\endgroup$
4
  • $\begingroup$ Can you also post the iSWAP decomposition using SWAP+CZ+single-qubit-rotation? $\endgroup$ – Abdullah Ash- Saki Nov 10 '20 at 0:03
  • $\begingroup$ I tried applying the above circuit on $|01\rangle$ and got the following state-vector: [0+0j, 0+0j, 0.707-0.707j, 0+0j ]. If I just apply a SWAP, I get [ 0+0j, 0+0j, 1+0j, 0+0j ]. Can both be treated as equivalent? $\endgroup$ – Abdullah Ash- Saki Nov 10 '20 at 3:04
  • 1
    $\begingroup$ @AbdullahAsh-Saki The circuit should be equal up to an unobservable global phase. The two vectors you gave are equivalent up to global phase and so are equivalent. $\endgroup$ – Craig Gidney Nov 10 '20 at 5:42
  • $\begingroup$ Are [ 0+0j, 0+0j, 1+0j, 0+0j ] (using SWAP) and [ 0+0j, 0+0j, 0+1j, 0+0j ] (using iSWAP) are equivalent up to a global phase? $\endgroup$ – Abdullah Ash- Saki Nov 10 '20 at 19:42
2
$\begingroup$

Using matrix multiplication, $$\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & i & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & -i & 0 & 0 \\ 0 & 0 & -i & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} $$ So the question is which gates does the second matrix in the matrix multiplication on the right represent?

A starting point is that the phase gate is $\begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}$ and that the Z-gate is $\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$, and $\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}$. This gets us the upper left portion of the second matrix.

Once we have $\begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}$, we can use the X-gate $\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$ and pre-and post-multiply it:$\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} = \begin{pmatrix} -i & 0 \\ 0 & 1 \end{pmatrix}$. This gets the lower right portion of the second matrix.

$\endgroup$
4
  • $\begingroup$ Does this (imgur.com/a/Ym94h0h) circuit match your description? $\endgroup$ – Abdullah Ash- Saki Nov 10 '20 at 2:12
  • $\begingroup$ In the linked circuit, it looks like the operations on the two qubits are being done in parallel. In my description, they are done separately (tensored with I, which corresponds to just the "wire", on the other qubit) . $\endgroup$ – nosuchthingasmagic Nov 10 '20 at 4:46
  • $\begingroup$ Looks like two dis-joint single-qubit operations cannot achieve this. One needs 2 different 2-qubit gates two achieve the matrix in right. $\endgroup$ – Abdullah Ash- Saki Nov 11 '20 at 4:28
  • $\begingroup$ I'm not sure I follow. To leave the other qubit unchanged, you can use the identity for it (which would be combined with the operation on the other qubit using the tensor product in matrix notation), right? $\endgroup$ – nosuchthingasmagic Nov 11 '20 at 5:12

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.