Search code examples
qiskit

How to print out whole matrix from unitary simulator


On Jupyter Notebook, I had simulated eight qubits quantum's circuit with Unitary_simulator. And then, I would like to print out the whole matrix, but what I get is matrix from unitary simulator. The code that I used is:

unitary = job.result().get_unitary(cir)
print("Circuit unitary:\n", unitary)

Solution

  • The output is a 2D array, so you could print it as

    for row in unitary:
        print(row)