# How can I obtain transformation matrix of a quantum circuit in the Qiskit?

I need to draw a quantum circuit in Clifford+T library and obtain automatically its transformation matrix. Is there any feature on Qiskit in this case?

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

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 (array = op.data)

See the API Documentation and Operator tutorial for additional info on this class.

In qiskit, you can get the unitary transformation matrix from a quantum circuit by running the following:

from qiskit import *