Skip to content

Commit

Permalink
Fix example (Qiskit#2162)
Browse files Browse the repository at this point in the history
* Fix example

* unused import

* use SamplerV2 for sim

---------

Co-authored-by: Jun Doi <[email protected]>
  • Loading branch information
nihaocami and doichanj authored Jun 12, 2024
1 parent 6f20107 commit 5e40517
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Here is a basic example:
.. code:: python
import qiskit
from qiskit_aer import AerSimulator
from qiskit_aer.primitives import SamplerV2
# Generate 3-qubit GHZ state
circ = qiskit.QuantumCircuit(3)
Expand All @@ -172,14 +172,14 @@ Here is a basic example:
circ.cx(1, 2)
circ.measure_all()
# Construct an ideal simulator
aersim = AerSimulator()
# Construct an ideal simulator with SamplerV2
sampler = SamplerV2()
job = sampler.run([circ], shots=128)
# Perform an ideal simulation
result_ideal = qiskit.execute(circ, aersim).result()
counts_ideal = result_ideal.get_counts(0)
result_ideal = job.result()
counts_ideal = result_ideal[0].data.meas.get_counts()
print('Counts(ideal):', counts_ideal)
# Counts(ideal): {'000': 493, '111': 531}
Ready to get going?...
======================
Expand All @@ -204,4 +204,4 @@ Ready to get going?...
.. Hiding - Indices and tables
:ref:`genindex`
:ref:`modindex`
:ref:`search`
:ref:`search`

0 comments on commit 5e40517

Please sign in to comment.