1
$\begingroup$

Here, a cheap verion of a Toffoli, up to a phase flip for $|101\rangle$, is given by

enter image description here

with $A=R_y(\pi/4)$. Are there similar versions of cheap implementation of general $C^nNOT$ gates?

I tried to just extend it the esay way, but found several unwanted off diagonal entries. My goal is a explicite $C^5NOT$.

So I came across this one for 4 qubits:

enter image description here

which I found here. Can anyone help me to build the circuit for 6 qubits out of the description?

And finally I found this approach: enter image description here but the number of $CNOT$s feels like $2^5$ in my case, which is too high for my purpose.

$\endgroup$
  • 1
    $\begingroup$ Maybe this helps: quantumcomputing.stackexchange.com/questions/9842/… $\endgroup$ – Martin Vesely Apr 17 at 21:10
  • $\begingroup$ @MartinVesely looks like the last approach I mentioned. So for a $C^5NOT$ with phase errors, I would expect 32 $CNOT$s and the angle of $R_y$ to be $\pi/32$ right? $\endgroup$ – draks ... Apr 17 at 21:22
  • $\begingroup$ Exactly, I will soon post QASM code I am just constructing on IBM Q. $\endgroup$ – Martin Vesely Apr 17 at 21:30
1
$\begingroup$

Based on this thread, below is a code implementing $C^5NOT$ up to a phase for output states $|q_0 q_1 q_2 q_3 q_4 1\rangle$, $q_i \in \{|0\rangle, |1\rangle\}$ (with expection of state $|111111\rangle$). For these states the phase is $\pi$, so returned computational basis state is multiplied by -1.

Concerning number of CNOTs and $R_y$ gates, I think it is not possible to decrease its number and it rises exponentially with increasing number of qubits.

OPENQASM 2.0;
include "qelib1.inc";

qreg q[6];
creg c[6];

ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[3],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[2],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[3],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[1],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[3],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[2],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[3],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[0],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[3],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[2],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[3],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[1],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[3],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[2],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[3],q[5];
ry(pi/32) q[5];
cx q[4],q[5];
ry(-pi/32) q[5];
cx q[0],q[5];
| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ +1 thanks, but I'm still hoping for an improvement. At least for a while... $\endgroup$ – draks ... Apr 18 at 14:38
  • 1
    $\begingroup$ ok, I checked the decomposition of the Hamilton operator of the corresponding unitary $U=\exp(-i\pi H)$ and found only product operator of the form $\sigma_y$ on the target- and $1$ or $\sigma_z$ on the control qubits, which is what I expect for an optimal decomposition. Interesting... $\endgroup$ – draks ... Apr 20 at 17:16

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.