I would like to use qiskit to verify for generalized CNOT gates that, e.g. for 4 qubits \begin{equation} \text{cu(0,3)} = |0\rangle\langle 0|\otimes1\!\!1\otimes1\!\!1\otimes1\!\!1 + |1\rangle\langle 1|\otimes1\!\!1\otimes1\!\!1\otimes\sigma_x \end{equation} with control on qubit 0 and target on qubit 3, and in particular showing that the matrix representation is the same. While I know that a way to do that in a qiskit circuit is
test_cu = QuantumCircuit(n*2, n)
test_cu.cx(0,3)
backend_un = Aer.get_backend('unitary_simulator')
unitary = execute(test_cu, backend_un).result().get_unitary()
array_to_latex(unitary, pretext="\\text{Circuit = } ")
test_cu.draw()
I don't have any idea on how to make the same from basic operators and using tensor product. I've read that Aqua
provides methods for this purpose, but I have nit found anything satisfying on the topic, neither in the official documentation (section tutorial). Thanks in advance.