<p>It's complicated, and depends on whether you approach quantum computing as a technology or a model of computation; and whether you are interested in universal quantum computation, or a special subclass of quantum operations.</p>

<h3>As a technology</h3>

<p>We're still working on how to implement a large-scale quantum computer. Part of the reason for this is that it is a non-trivial engineering problem to devise quantum memories on which we can reliably act.</p>

<p>Many of the proposed architectures involve physical qubits which are in a fixed(-ish) position, relative to the others. Whether these are quantum dots (attached to a substrate), ions in a linear trap (mobile but often penned in between two other ions), or even nuclear spins in liquid NMR (locations fixed mostly by the chemical bonds within each molecule), those qubits don't have much freedom to move relative to the ones you want it to interact with.
You can't necessarily shuffle them around like cups and balls.</p>

<p>The fixed wires in a classical circuit get around this physical location problem by being physically extended. The wire acts as if tracing out the trajectory of "moving" logical bits, and may weave around each other somewhat between two logic gates. When we draw quantum circuit diagrams, we're dreaming of this &mdash; but at least one of the dimensions in the diagram represents not space, but time between the physical operations which we perform. Not many physical architectures for quantum information admit that sort of physical extension, while keeping the quantum bit coherent and available to be acted upon. If locations are more or less fixed, this prevents us from literally swapping around the qubits.</p>

<p>In summary, in quantum implementation, we can't be confident that SWAP operations will be easily achievable "in hardware", i.e. by swapping around the physical qubits. We thus have to resort to be achieving SWAP operations "in software" &mdash; by performing suitable operations to 'transport' the information from one physical qubit to another. Thus our interest in decomposing SWAP in terms of elementary gates.</p>

<h3>As a model of computation</h3>

<p>As a part of theory of computation, you are exactly right: decompositions of SWAP are only a curiousity, much like the logical universality of the NAND gate. It is worth taking note of, in elementary courses; but much beyond that we treat decompositions of SWAP almost exactly as seriously as we do the decomposition of classical algorithms into NAND gates &mdash; not very seriously, most of the time. So long as we consider a model of computation in which elementary gates have a constant cost and which generate SWAP, then SWAP can be performed with at most a constant cost &mdash; and if the cost due to SWAP gates does not dominate the run-time of the algorithm, then talking about them doesn't really shed any insight onto the complexity of a problem.</p>

<p>Of course, because of the technological promise of quantum computation, the technical <em>difficulty</em> in implementing quantum computers, not to mention the promise of <em>any</em> technique (including classical ones) to simulate bits of quantum mechanics, specialized and related models of computation have attracted some theoretical interest. One of these are "matchgate" circuits, which may be described as unitary circuits in which</p>

<ul>
<li>Qubits are arranged in a linear array;</li>
<li>Only two-qubit nearest-neighbor unitary transformations are allowed (and possibly Hadamard operations, on the first qubit only);</li>
<li>All two-qubit operations are of the form $$\begin{bmatrix} a_{00} &amp; 0 &amp; 0 &amp; a_{01} \\ 0 &amp; b_{00} &amp; b_{01} &amp; 0 \\ 0 &amp; b_{10} &amp; b_{11} &amp; 0 \\ a_{10} &amp; 0 &amp; 0 &amp; a_{11} \end{bmatrix} \quad\text{where $\begin{bmatrix} a_{00} &amp; a_{01} \\ a_{10} &amp; a_{11} \end{bmatrix}, \begin{bmatrix} b_{00} &amp; b_{01} \\ b_{10} &amp; b_{11} \end{bmatrix} \in \mathrm{SU}(2)$}$$
  i.e., acting unitarily (with determinant 1) on the odd- and even-parity subspaces of the pair of qubits.</li>
</ul>

<p>These computations can be efficiently simulated by classical computers (provided that the coefficients are efficiently computable, etc.) However, if you consider circuits which have these gates, <em>and also</em> SWAP gates, they become universal for quantum computation. The same holds if you allow the gates to act even on next-nearest neighbour qubits, or allow Hadamard operations on other lines than just the first. What appear to be trivial modifications of the model, which one could imagine performing by just moving qubits around, transform a model which is tractible to simulate to one which (we think) is intractible to simulate. Nor, obviously, can we decompose SWAP into gates which are allowed.</p>

<h3>In summary</h3>

<p>From a theoretical perspective, SWAP operations are exactly as boring as you think they should be, for much of the research in quantum computation. But a model of computation is a mathematical model of something <em>we hope to achieve</em> in hardware: the model is not necessarily representative of reality. And even if SWAP is boring in one model of computation, that doesn't mean it is boring in another model!</p>

<p>We are complacent about SWAP in classical computation because electronic computers are a mature technology in which these details are mostly safe to ignore. As soon as you switch models of computation, you must check your computational assumptions.</p>

CC BY-SA 3.0
2014-10-25T02:19:27.810Z
There is a dark area between theory and implementation.
ZhangJun
CC BY-SA 3.0
2014-10-24T18:35:16.560Z
2014-10-24T20:12:42.203Z
2014-10-24T20:12:42.203Z
Niel de Beaudrap
<p>In classical circuit complexity, shifting bits is considered gratis; all you have to do is reorganizing wires between corresponding gates. By contrast, shifting qubits is typically done by using a series of quantum SWAP gates, which are composed of three CNOT gates respectively; the shifting contributes to the total circuit complexity. </p>

<p>So where does the difference come from? Is it due to the physical implementation of qubits?</p>

CC BY-SA 3.0
2014-10-25T02:48:43.483Z
I was interested in quantum computing and found a course by Vazriani on edx.org (https://www.edx.org/course/uc-berkeleyx/uc-berkeleyx-cs-191x-quantum-mechanics-1033#.VEsOzyldW0c) a very good introduction. He explains CNOT gates and SWAP gates pretty quickly.
Jake
<quantum-computing><circuit-complexity>
Why is shifting bits different from shifting qubits?
ZhangJun
# Why is shifting bits different from shifting qubits?

(Asked by: username_0 on 2014-10-24)

In classical circuit complexity, shifting bits is considered gratis; all you have to do is reorganizing wires between corresponding gates. By contrast, shifting qubits is typically done by using a series of quantum SWAP gates, which are composed of three CNOT gates respectively; the shifting contributes to the total circuit complexity.

So where does the difference come from? Is it due to the physical implementation of qubits?

**Tags:** quantum-computing, circuit-complexity
> **Comments:**
> **username_1**: I was interested in quantum computing and found a course by Vazriani on edx.org (https://www.edx.org/course/uc-berkeleyx/uc-berkeleyx-cs-191x-quantum-mechanics-1033#.VEsOzyldW0c) a very good introduction. He explains CNOT gates and SWAP gates pretty quickly.  

---

## 1 answers

### Answer by username_2 on 2014-10-24. Score: 11 | Accepted answer

It's complicated, and depends on whether you approach quantum computing as a technology or a model of computation; and whether you are interested in universal quantum computation, or a special subclass of quantum operations.

### As a technology

We're still working on how to implement a large-scale quantum computer. Part of the reason for this is that it is a non-trivial engineering problem to devise quantum memories on which we can reliably act.

Many of the proposed architectures involve physical qubits which are in a fixed(-ish) position, relative to the others. Whether these are quantum dots (attached to a substrate), ions in a linear trap (mobile but often penned in between two other ions), or even nuclear spins in liquid NMR (locations fixed mostly by the chemical bonds within each molecule), those qubits don't have much freedom to move relative to the ones you want it to interact with.
You can't necessarily shuffle them around like cups and balls.

The fixed wires in a classical circuit get around this physical location problem by being physically extended. The wire acts as if tracing out the trajectory of "moving" logical bits, and may weave around each other somewhat between two logic gates. When we draw quantum circuit diagrams, we're dreaming of this — but at least one of the dimensions in the diagram represents not space, but time between the physical operations which we perform. Not many physical architectures for quantum information admit that sort of physical extension, while keeping the quantum bit coherent and available to be acted upon. If locations are more or less fixed, this prevents us from literally swapping around the qubits.

In summary, in quantum implementation, we can't be confident that SWAP operations will be easily achievable "in hardware", i.e. by swapping around the physical qubits. We thus have to resort to be achieving SWAP operations "in software" — by performing suitable operations to 'transport' the information from one physical qubit to another. Thus our interest in decomposing SWAP in terms of elementary gates.

### As a model of computation

As a part of theory of computation, you are exactly right: decompositions of SWAP are only a curiousity, much like the logical universality of the NAND gate. It is worth taking note of, in elementary courses; but much beyond that we treat decompositions of SWAP almost exactly as seriously as we do the decomposition of classical algorithms into NAND gates — not very seriously, most of the time. So long as we consider a model of computation in which elementary gates have a constant cost and which generate SWAP, then SWAP can be performed with at most a constant cost — and if the cost due to SWAP gates does not dominate the run-time of the algorithm, then talking about them doesn't really shed any insight onto the complexity of a problem.

Of course, because of the technological promise of quantum computation, the technical *difficulty* in implementing quantum computers, not to mention the promise of *any* technique (including classical ones) to simulate bits of quantum mechanics, specialized and related models of computation have attracted some theoretical interest. One of these are "matchgate" circuits, which may be described as unitary circuits in which

* Qubits are arranged in a linear array;
* Only two-qubit nearest-neighbor unitary transformations are allowed (and possibly Hadamard operations, on the first qubit only);
* All two-qubit operations are of the form $$\begin{bmatrix} a\_{00} & 0 & 0 & a\_{01} \\ 0 & b\_{00} & b\_{01} & 0 \\ 0 & b\_{10} & b\_{11} & 0 \\ a\_{10} & 0 & 0 & a\_{11} \end{bmatrix} \quad\text{where $\begin{bmatrix} a\_{00} & a\_{01} \\ a\_{10} & a\_{11} \end{bmatrix}, \begin{bmatrix} b\_{00} & b\_{01} \\ b\_{10} & b\_{11} \end{bmatrix} \in \mathrm{SU}(2)$}$$
  i.e., acting unitarily (with determinant 1) on the odd- and even-parity subspaces of the pair of qubits.

These computations can be efficiently simulated by classical computers (provided that the coefficients are efficiently computable, etc.) However, if you consider circuits which have these gates, *and also* SWAP gates, they become universal for quantum computation. The same holds if you allow the gates to act even on next-nearest neighbour qubits, or allow Hadamard operations on other lines than just the first. What appear to be trivial modifications of the model, which one could imagine performing by just moving qubits around, transform a model which is tractible to simulate to one which (we think) is intractible to simulate. Nor, obviously, can we decompose SWAP into gates which are allowed.

### In summary

From a theoretical perspective, SWAP operations are exactly as boring as you think they should be, for much of the research in quantum computation. But a model of computation is a mathematical model of something *we hope to achieve* in hardware: the model is not necessarily representative of reality. And even if SWAP is boring in one model of computation, that doesn't mean it is boring in another model!

We are complacent about SWAP in classical computation because electronic computers are a mature technology in which these details are mostly safe to ignore. As soon as you switch models of computation, you must check your computational assumptions.

> **Comments:**
> **username_0**: There is a dark area between theory and implementation.  

---

