3

In qiskit, you can get the unitary transformation matrix from a quantum circuit by running the following: from qiskit import * #circuit already defined backend = Aer.get_backend('unitary_simulator') job = execute(circuit, backend) result = job.result() print(result.get_unitary(circ, decimals=3)) and the matrix will output. As you increase the number of ...


2

The other answer is great. But here is a link that walk you through the process step-by-step: https://medium.com/mdr-inc/checking-the-unitary-matrix-of-the-quantum-circuit-on-qiskit-5968c6019a45


1

While you can get the unitary matrix representation of a circuit using the unitary simulator as shown in the other answers, there is a much easier way using the Operator class in the qiskit.quantum_info library. import qiskit.quantum_info as qi op = qi.Operator(circ) If you want the numpy array of the operator, this can be obtained via the data attribute (...


1

It is an issue. Adding control() to the gate introduces a phase difference. You can verify that: from qiskit.quantum_info import Operator, Pauli gate = QuantumCircuit(1) gate.append(Operator(Pauli(label='X')), [0]) gate = gate.control() print(Operator(gate).data) ---- Output: [[ 1 0 0 0] [ 0 0 0 1j] [ 0 0 1 0] [ 0 1j 0 0]] So ...


1

Be cautious using logic like "it must be A or B, both of which imply C, therefore C" when dealing with quantum circuits. It can fail if A, B, or C don't commute (e.g. Hardy's paradox). Personally, I would say the reason the circuit works is because of the no communication theorem and the deferred measurement principle. By the no communication ...


Only top voted, non community-wiki answers of a minimum length are eligible