TransWikia.com

Decomposition of $|110rangle leftrightarrow |000rangle$ Exchange Gate

Quantum Computing Asked on February 5, 2021

How to implement a 3 qubit gate, that exchanges the level $|110rangle$ and $|000rangle$, with elementary gates (CNOT, SWAP, Toffoli, local gates, etc.(everything Qiskit allows)):
$$
U=pmatrix{
0 & 0 & 0 & 0 & 0 & 0 & 1 & 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 & 1 & 0 & 0 & 0
0 & 0 & 0 & 0 & 0 & 1 & 0 & 0
1 & 0 & 0 & 0 & 0 & 0 & 0 & 0
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1
}=?
$$

I tried to decompose the unitaries hamiltonian $U=exp(-ipi $$H$$)$ in the Zeeman basis, but it doesn’t looks not very promising.

2 Answers

One simple idea would be to introduce an ancilla (I'm sure there will be protocols without an ancilla as well) that starts in $|0rangle$. You can use a Toffoli (and some X gates) to flip the ancilla if the system is in the state $|000rangle$. You can also do the same if it's in state $|110rangle$. So, the ancilla is in state $|1rangle$ if you need to flip the first two bits. In other words, two controlled-not gates will do the job. Then you just have to undo the computation of the ancilla.

enter image description here

I believe the following does the same without an ancilla (although you'll want to check it carefully: enter image description here

The theory was basically that controlled off the third qubit being 0, you essentially wanted to do a swap of the first two qubits (and swap can be composed of 3 controlled-nots). Except that swap usually preserves 00 and 11, switching 01 and 10, so if we perform an $X$ on one of the qubits, that means 01 and 10 are preserved, swapping 00 and 11. An initial construction would make many gates controlled off the third qubit, but it turns out these are unnecessary -- if the central toffoli does nothing, everything else cancels.

Answered by DaftWullie on February 5, 2021

Adding to @DaftWullie's answer,

If you're only looking to implement a gate in Qiskit that swaps $lvert000rangle$ and $lvert110rangle$ without worrying about the underlying gates, the easiest way to do that would be to create a NumPy array containing the matrix and attach that to the circuit using QuantumCircuit.iso.

The code would look roughly like this:

from qiskit import QuantumCircuit, execute, Aer
import numpy as np

unitary = np.zeros((8,8))
unitary[0][6] = unitary[6][0] = 1
unitary[1][1] = unitary[2][2] = unitary[3][3] = unitary[4][4] = unitary[5][5] = unitary[7][7] = 1

ckt = QuantumCircuit(3)
ckt.iso(unitary, [0,1,2,3], [])
ckt.measure_all()

execute(ckt, backend=Aer.get_backend('qasm_simulator'), shots=1024).result()

# do what you want with the result 

Do keep in mind qiskit's "reverse-ordering" of qubits when you're playing around with this! Hope this helps...

Answered by giri on February 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP