6

I'm aware that to randomly initialize a quantum circuit with Qiskit, we can simply write qc.initialize(rand_state, q[0]...). However, when drawing the circuit, I see that the "initialize" function is treated as one big gate that takes in an input and outputs the initialized state.

enter image description here

Is there a way to decompose this "initialization gate" through python/Qiskit and run a circuit that is composed of the individual smaller gates that actually make up this large gate?

Rehaan Ahmad
  • 519
  • 2
  • 12

1 Answers1

5

In your example you can do

qc.decompose().draw()

The method decompose decomposes every gate in the circuit. This will do a single level. If you want to do another level of decomposition, call the method again.

qc.decompose().decompose().draw()
luciano
  • 5,763
  • 1
  • 12
  • 34