Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.28k stars 2.37k forks source link

storing itermediate distribution in a grovers search #13172

Closed Pavanmk1310 closed 2 months ago

Pavanmk1310 commented 2 months ago

storing the distribution values of each iteration of a Grover circuit. if a Grovers circuit has three iterations is there a way to store the distributions of each of the three iterations separately.

the following block of code gives you the final distribution only:

To run on local simulator:

  1. Use the SatetvectorSampler from qiskit.primitives instead sampler = Sampler(backend=backend) sampler.options.default_shots = 10_000 result = sampler.run([circuit_isa]).result() dist = result[0].data.meas.get_counts()