I was expecting Qiskit to do a upside down version of my unitary as it does for other unitary matrices of CNOT and Toffoli gates given in textbooks : if you convert a toffoli matrix from quantum computing textbooks(target 3rd and ctrl 1st,2nd) you will get an inverted version of it (target as q0 and ctrl as q1,q2).
So I hardcoded a unitary matrix and converted to gate then appended to qc. But the operator returns exactly the same matrix, so I wonder if my unitary is actually upside down but operator just shows flipped output ?
u = QuantumCircuit(qr) u.unitary(UA, range(qr), label='U') unitary = u.to_gate() unitary.name = 'U'
mpl display :
qc = QuantumCircuit(qr) qc.append(unitary, range(0, qr)) qc.draw("mpl", style='bw')