Open ziechys opened 2 months ago
FYI: Here is the context why the change is introduced. https://github.com/Qiskit/RFCs/blob/master/0016-sampler-interface.md#motivation-
FWIW you can always use qiskit.quantum_info.Statevector
to get the exact probabilities, like
from qiskit.quantum_info import Statevector
probs = Statevector(your_circuit).probabilities_dict() # {"0..": prob, ... }
which you could even wrap into the PrimitivesV2
interface to use a plugin replacement.
What should we add?
In the old primitives, it was possible to obtain ideal results, i.e. exact probabilities with the Sampler by setting shots to zero or None. This option is gone with the new SamplerV2 and a default shot number is always chosen. This is quite disruptive to common quantum workflows of, e.g., pre-optimizing a parametrized quantum circuit classically or testing algorithms efficiently.