1
$\begingroup$

In the following piece of code:

cnx(qwc, q[0], q[1],q[2],q[3])

in what order control qubits and target qubit are? Which qubit is inverted for which values of which ones?

$\endgroup$
1
$\begingroup$

As explained here, if all of q[0], q[1] and q[2] (the n-1 qubits) are 1, then q[3] (the n-th qubit) is inverted. That is, q[3] is the target qubit and the rest (q[0], q[1] and q[2]) are controls.

$\endgroup$

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.