In the following piece of code:
cnx(qwc, q, q,q,q)
in what order control qubits and target qubit are? Which qubit is inverted for which values of which ones?
As explained here, if all of
q (the n-1 qubits) are 1, then
q (the n-th qubit) is inverted. That is,
q is the target qubit and the rest (
q) are controls.