qiskit-community / qiskit-braket-provider

Qiskit-Braket provider to execute Qiskit programs on quantum computing hardware devices through Amazon Braket.
https://qiskit-community.github.io/qiskit-braket-provider/
Apache License 2.0
57 stars 45 forks source link

Different default shot numbers for qiskit Sampler and BraketLocalBackend. #183

Open maolinml opened 1 week ago

maolinml commented 1 week ago

What is the expected enhancement?

The default shot number for qiskit’s Sampler is 0, whereas that for BraketLocalBackend is 1000, see the code example below. This could cause some confusion. Ideally, the default shot values should be the same.

from qiskit import QuantumCircuit
from qiskit_braket_provider import BraketLocalBackend
from qiskit.primitives import Sampler

circuit = QuantumCircuit(1)
circuit.h(0)
circuit.measure_all()

# Run with qiskit backend
Sampler().run(circuit).result().quasi_dists[0]

# Qiskit local backend return probability calculated 
# from state vector, which has no shot noise and the
# result is fixed for different runs
# {0: 0.5, 1: 0.5}

# Run with braket backend
BraketLocalBackend().run(circuit).result().results[0].data.counts

# Braket local backend return sampled probability with shot noise
# and the result vary from run to run
# {'1': 537, '0': 487}