4
$\begingroup$

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?

$\endgroup$
2
$\begingroup$

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()
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.