3

Is there any tool to define a circuit and verify if it works as desired? It would be interesting to find ways of performing interacting gates - e.g. CNOT gate - between non adjacent qubits.

Hence I'd like an efficient way to define a circuit with any number of qubits, and verify whether it performs the CNOT between two of them (no matter what happens the other qubits).

Daniele Cuomo
  • 1,742
  • 8
  • 21
  • 1
    If you need to verify the cNOT, presumably you don't trust it to be accurate. Do you trust anything to be accurate? – DaftWullie May 26 '21 at 11:18
  • What do you mean with accurate? I mean, it must be completely equivalent to a CNOT gate, between two desired qubits. But it could affect other qubits, differently from identity. – Daniele Cuomo May 26 '21 at 11:19
  • 1
    What I mean is that presumably as part of what you're doing you're saying "implement this sequence of gates which I think performs a cNot between qubits x and y", but you don't know and that's what you want to verify. But if you don't know that, what do you know about this and other gates you have to work with? – DaftWullie May 26 '21 at 11:22
  • I use known gates, say, from the Clifford+T set. I can also fix the input of auxiliary qubits. Did I answer? – Daniele Cuomo May 26 '21 at 11:26
  • 2
    So would you not just perform quantum process tomography on the two qubits that you think are having the gate applied to? (OK, there's maybe a question of what state the rest of the system starts in) – DaftWullie May 26 '21 at 12:11
  • what do you mean exactly with "verify it works as desired"? You mean that you have some unitary $U$ corresponding to the circuit and you want to verify that it acts on all inputs as you expect it to? Or something else? And you you mean that you want to verify a circuit implemented physically (so treated as a black box to which you can feed inputs and see the outputs), or do you have the classical description of the circuit? – glS May 26 '21 at 12:58

1 Answers1

1

Assume that you have a control qubit with index 0, then $l$ qubits does not interact with a gate and $l+1$th qubit is a target qubit (e.g. having three qubits, 0 is the control, 1 is idle and 2 is the target). Let's denote $U$ a single qubit gate acting on the target qubit if the control is $|1\rangle$ and $N=2^{l+2}$. Then a matrix description of such gate is $$ \begin{pmatrix} I_{N/2} & O_{N/2} \\ O_{N/2} & I_{N/4} \otimes U \end{pmatrix}, $$ where $I_{N/2}$ and $I_{N/4}$ are identity matrices of order $N/2$ and $N/4$ respectively and $O_{N/2}$ is zero matrix of order $N/2$.

Based on the matrix above, you can infer, how your controlled gate with non-adjacent qubits works.

For example, lets take CNOT gate with control qubit 0, idle (or non-used) qubit 1 and target qubit 2. In this case $l=1$, $N=8$ and $U=X=\begin{pmatrix}0 & 1 \\ 1 & 0\end{pmatrix}$, hence the matrix describing such gate is $$ \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ \end{pmatrix}. $$

Based on the matrix, you can see that states $|0xy\rangle$ are left unchanged as the control qubit is in state $|0\rangle$. If the control qubit is $|1\rangle$ then the gate works followingly:

  • $|100\rangle \rightarrow |101\rangle$
  • $|101\rangle \rightarrow |100\rangle$
  • $|110\rangle \rightarrow |111\rangle$
  • $|111\rangle \rightarrow |110\rangle$

As you can see the middle qubit remains unchanged. This means that the gate works only with qubits 0 and 2.

Martin Vesely
  • 13,891
  • 4
  • 28
  • 65