qiskit 1.3.0rc2__cp39-abi3-win32.whl → 1.3.2__cp39-abi3-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. qiskit/VERSION.txt +1 -1
  2. qiskit/_accelerate.pyd +0 -0
  3. qiskit/circuit/__init__.py +2 -0
  4. qiskit/circuit/add_control.py +110 -92
  5. qiskit/circuit/controlledgate.py +2 -0
  6. qiskit/circuit/library/__init__.py +1 -0
  7. qiskit/circuit/library/arithmetic/adders/adder.py +25 -0
  8. qiskit/circuit/library/arithmetic/adders/cdkm_ripple_carry_adder.py +1 -1
  9. qiskit/circuit/library/arithmetic/adders/draper_qft_adder.py +1 -1
  10. qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py +1 -1
  11. qiskit/circuit/library/arithmetic/multipliers/multiplier.py +9 -0
  12. qiskit/circuit/library/arithmetic/piecewise_chebyshev.py +1 -0
  13. qiskit/circuit/library/basis_change/qft.py +3 -0
  14. qiskit/circuit/library/boolean_logic/inner_product.py +2 -0
  15. qiskit/circuit/library/boolean_logic/quantum_and.py +4 -0
  16. qiskit/circuit/library/boolean_logic/quantum_or.py +4 -0
  17. qiskit/circuit/library/boolean_logic/quantum_xor.py +2 -0
  18. qiskit/circuit/library/fourier_checking.py +2 -0
  19. qiskit/circuit/library/generalized_gates/gms.py +1 -0
  20. qiskit/circuit/library/generalized_gates/gr.py +4 -0
  21. qiskit/circuit/library/generalized_gates/mcmt.py +1 -0
  22. qiskit/circuit/library/generalized_gates/permutation.py +5 -1
  23. qiskit/circuit/library/generalized_gates/unitary.py +1 -1
  24. qiskit/circuit/library/graph_state.py +2 -0
  25. qiskit/circuit/library/grover_operator.py +7 -3
  26. qiskit/circuit/library/hidden_linear_function.py +2 -0
  27. qiskit/circuit/library/iqp.py +5 -0
  28. qiskit/circuit/library/n_local/efficient_su2.py +7 -2
  29. qiskit/circuit/library/n_local/evolved_operator_ansatz.py +3 -0
  30. qiskit/circuit/library/n_local/excitation_preserving.py +14 -8
  31. qiskit/circuit/library/n_local/n_local.py +10 -5
  32. qiskit/circuit/library/n_local/pauli_two_design.py +5 -2
  33. qiskit/circuit/library/n_local/qaoa_ansatz.py +1 -0
  34. qiskit/circuit/library/n_local/real_amplitudes.py +10 -4
  35. qiskit/circuit/library/overlap.py +1 -0
  36. qiskit/circuit/library/phase_estimation.py +2 -0
  37. qiskit/circuit/library/quantum_volume.py +3 -0
  38. qiskit/circuit/operation.py +1 -0
  39. qiskit/circuit/parameter.py +1 -0
  40. qiskit/circuit/parameterexpression.py +1 -1
  41. qiskit/circuit/quantumcircuit.py +13 -19
  42. qiskit/circuit/random/utils.py +2 -0
  43. qiskit/converters/dag_to_circuit.py +1 -0
  44. qiskit/primitives/statevector_estimator.py +1 -0
  45. qiskit/providers/fake_provider/__init__.py +1 -0
  46. qiskit/pulse/builder.py +8 -0
  47. qiskit/pulse/library/symbolic_pulses.py +1 -0
  48. qiskit/qasm2/export.py +2 -2
  49. qiskit/qasm3/__init__.py +1 -0
  50. qiskit/qasm3/exporter.py +6 -3
  51. qiskit/qpy/__init__.py +5 -5
  52. qiskit/quantum_info/operators/channel/chi.py +9 -9
  53. qiskit/quantum_info/operators/channel/choi.py +9 -9
  54. qiskit/quantum_info/operators/channel/ptm.py +9 -9
  55. qiskit/quantum_info/operators/channel/quantum_channel.py +3 -3
  56. qiskit/quantum_info/operators/channel/stinespring.py +9 -9
  57. qiskit/quantum_info/operators/channel/superop.py +5 -9
  58. qiskit/quantum_info/operators/symplectic/pauli_list.py +8 -8
  59. qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +10 -1
  60. qiskit/quantum_info/states/densitymatrix.py +17 -15
  61. qiskit/quantum_info/states/stabilizerstate.py +7 -6
  62. qiskit/quantum_info/states/statevector.py +15 -6
  63. qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py +1 -0
  64. qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py +1 -0
  65. qiskit/synthesis/evolution/product_formula.py +0 -6
  66. qiskit/synthesis/evolution/suzuki_trotter.py +22 -5
  67. qiskit/transpiler/__init__.py +22 -1
  68. qiskit/transpiler/layout.py +3 -0
  69. qiskit/transpiler/passes/basis/decompose.py +24 -4
  70. qiskit/transpiler/passes/optimization/inverse_cancellation.py +2 -0
  71. qiskit/transpiler/passes/routing/star_prerouting.py +1 -0
  72. qiskit/transpiler/passes/scheduling/dynamical_decoupling.py +1 -0
  73. qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +1 -0
  74. qiskit/transpiler/passes/synthesis/hls_plugins.py +137 -30
  75. qiskit/transpiler/passes/utils/filter_op_nodes.py +2 -1
  76. qiskit/transpiler/passes/utils/remove_barriers.py +1 -0
  77. qiskit/transpiler/preset_passmanagers/__init__.py +5 -5
  78. qiskit/transpiler/preset_passmanagers/builtin_plugins.py +19 -22
  79. qiskit/transpiler/target.py +1 -1
  80. qiskit/visualization/__init__.py +6 -0
  81. qiskit/visualization/circuit/circuit_visualization.py +1 -0
  82. qiskit/visualization/counts_visualization.py +2 -0
  83. qiskit/visualization/dag_visualization.py +1 -0
  84. qiskit/visualization/gate_map.py +7 -3
  85. qiskit/visualization/pulse_v2/interface.py +4 -1
  86. qiskit/visualization/state_visualization.py +13 -2
  87. qiskit/visualization/timeline/interface.py +6 -3
  88. {qiskit-1.3.0rc2.dist-info → qiskit-1.3.2.dist-info}/METADATA +26 -26
  89. {qiskit-1.3.0rc2.dist-info → qiskit-1.3.2.dist-info}/RECORD +93 -93
  90. {qiskit-1.3.0rc2.dist-info → qiskit-1.3.2.dist-info}/WHEEL +1 -1
  91. {qiskit-1.3.0rc2.dist-info → qiskit-1.3.2.dist-info}/entry_points.txt +1 -1
  92. {qiskit-1.3.0rc2.dist-info → qiskit-1.3.2.dist-info}/LICENSE.txt +0 -0
  93. {qiskit-1.3.0rc2.dist-info → qiskit-1.3.2.dist-info}/top_level.txt +0 -0
@@ -47,6 +47,7 @@ individual documentation for exact details.
47
47
  The following example demonstrates the common usage of these arguments:
48
48
 
49
49
  .. plot::
50
+ :alt: Output from the previous code.
50
51
  :include-source:
51
52
 
52
53
  from qiskit.visualization import plot_histogram
@@ -60,6 +61,7 @@ The following example demonstrates the common usage of these arguments:
60
61
  You can specify ``legend``, ``title``, ``figsize`` and ``color`` by passing to the kwargs.
61
62
 
62
63
  .. plot::
64
+ :alt: Output from the previous code.
63
65
  :include-source:
64
66
 
65
67
  from qiskit.visualization import plot_histogram
@@ -101,6 +103,7 @@ Example Usage
101
103
  Here is an example of using :func:`plot_histogram` to visualize measurement outcome counts:
102
104
 
103
105
  .. plot::
106
+ :alt: Output from the previous code.
104
107
  :include-source:
105
108
 
106
109
  from qiskit.visualization import plot_histogram
@@ -142,6 +145,7 @@ Example Usage
142
145
  Here is an example of using :func:`plot_state_city` to visualize a quantum state:
143
146
 
144
147
  .. plot::
148
+ :alt: Output from the previous code.
145
149
  :include-source:
146
150
 
147
151
  from qiskit.visualization import plot_state_city
@@ -155,6 +159,7 @@ The state can be array-like list of lists, ``numpy.array``, or more commonly
155
159
  obtained from a :class:`~qiskit.circuit.QuantumCircuit`:
156
160
 
157
161
  .. plot::
162
+ :alt: Output from the previous code.
158
163
  :include-source:
159
164
 
160
165
  from qiskit import QuantumCircuit
@@ -170,6 +175,7 @@ obtained from a :class:`~qiskit.circuit.QuantumCircuit`:
170
175
  plot_state_city(state)
171
176
 
172
177
  .. plot::
178
+ :alt: Output from the previous code.
173
179
  :include-source:
174
180
 
175
181
  from qiskit import QuantumCircuit
@@ -189,6 +189,7 @@ def circuit_drawer(
189
189
 
190
190
  Example:
191
191
  .. plot::
192
+ :alt: Circuit diagram output by the previous code.
192
193
  :include-source:
193
194
 
194
195
  from qiskit import QuantumCircuit
@@ -111,6 +111,7 @@ def plot_histogram(
111
111
 
112
112
  Examples:
113
113
  .. plot::
114
+ :alt: Output from the previous code.
114
115
  :include-source:
115
116
 
116
117
  # Plot two counts in the same figure with legends and colors specified.
@@ -215,6 +216,7 @@ def plot_distribution(
215
216
 
216
217
  Examples:
217
218
  .. plot::
219
+ :alt: Output from the previous code.
218
220
  :include-source:
219
221
 
220
222
  # Plot two counts in the same figure with legends and colors specified.
@@ -100,6 +100,7 @@ def dag_drawer(dag, scale=0.7, filename=None, style="color"):
100
100
  Example:
101
101
  .. plot::
102
102
  :include-source:
103
+ :nofigs:
103
104
 
104
105
  from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
105
106
  from qiskit.dagcircuit import DAGCircuit
@@ -75,13 +75,14 @@ def plot_gate_map(
75
75
  Figure: A Matplotlib figure instance.
76
76
 
77
77
  Raises:
78
- QiskitError: if tried to pass a simulator, or if the backend is None,
78
+ QiskitError: If you tried to pass a simulator or the backend is None,
79
79
  but one of num_qubits, mpl_data, or cmap is None.
80
- MissingOptionalLibraryError: if matplotlib not installed.
80
+ MissingOptionalLibraryError: If matplotlib not installed.
81
81
 
82
82
  Example:
83
83
 
84
84
  .. plot::
85
+ :alt: Output from the previous code.
85
86
  :include-source:
86
87
 
87
88
  from qiskit.providers.fake_provider import GenericBackendV2
@@ -997,11 +998,12 @@ def plot_coupling_map(
997
998
 
998
999
  Raises:
999
1000
  MissingOptionalLibraryError: If matplotlib or graphviz is not installed.
1000
- QiskitError: If length of qubit labels does not match number of qubits.
1001
+ QiskitError: If the length of qubit labels does not match the number of qubits.
1001
1002
 
1002
1003
  Example:
1003
1004
 
1004
1005
  .. plot::
1006
+ :alt: Output from the previous code.
1005
1007
  :include-source:
1006
1008
 
1007
1009
  from qiskit.visualization import plot_coupling_map
@@ -1168,6 +1170,7 @@ def plot_circuit_layout(circuit, backend, view="virtual", qubit_coordinates=None
1168
1170
 
1169
1171
  Example:
1170
1172
  .. plot::
1173
+ :alt: Output from the previous code.
1171
1174
  :include-source:
1172
1175
 
1173
1176
  from qiskit import QuantumCircuit, transpile
@@ -1270,6 +1273,7 @@ def plot_error_map(backend, figsize=(15, 12), show_title=True, qubit_coordinates
1270
1273
 
1271
1274
  Example:
1272
1275
  .. plot::
1276
+ :alt: Output from the previous code.
1273
1277
  :include-source:
1274
1278
 
1275
1279
  from qiskit.visualization import plot_error_map
@@ -306,12 +306,13 @@ def draw(
306
306
 
307
307
  Examples:
308
308
  To visualize a pulse program, you can call this function with set of
309
- control arguments. Most of appearance of the output image can be controlled by the
309
+ control arguments. Most of the appearance of the output image can be controlled by the
310
310
  stylesheet.
311
311
 
312
312
  Drawing with the default stylesheet.
313
313
 
314
314
  .. plot::
315
+ :alt: Output from the previous code.
315
316
  :include-source:
316
317
 
317
318
  from qiskit import QuantumCircuit, transpile, schedule
@@ -330,6 +331,7 @@ def draw(
330
331
  Drawing with the stylesheet suited for publication.
331
332
 
332
333
  .. plot::
334
+ :alt: Output from the previous code.
333
335
  :include-source:
334
336
 
335
337
  from qiskit import QuantumCircuit, transpile, schedule
@@ -348,6 +350,7 @@ def draw(
348
350
  Drawing with the stylesheet suited for program debugging.
349
351
 
350
352
  .. plot::
353
+ :alt: Output from the previous code.
351
354
  :include-source:
352
355
 
353
356
  from qiskit import QuantumCircuit, transpile, schedule
@@ -70,10 +70,11 @@ def plot_state_hinton(state, title="", figsize=None, ax_real=None, ax_imag=None,
70
70
 
71
71
  Raises:
72
72
  MissingOptionalLibraryError: Requires matplotlib.
73
- VisualizationError: if input is not a valid N-qubit state.
73
+ VisualizationError: Input is not a valid N-qubit state.
74
74
 
75
75
  Examples:
76
76
  .. plot::
77
+ :alt: Output from the previous code.
77
78
  :include-source:
78
79
 
79
80
  import numpy as np
@@ -214,6 +215,7 @@ def plot_bloch_vector(
214
215
 
215
216
  Examples:
216
217
  .. plot::
218
+ :alt: Output from the previous code.
217
219
  :include-source:
218
220
 
219
221
  from qiskit.visualization import plot_bloch_vector
@@ -221,6 +223,7 @@ def plot_bloch_vector(
221
223
  plot_bloch_vector([0,1,0], title="New Bloch Sphere")
222
224
 
223
225
  .. plot::
226
+ :alt: Output from the previous code.
224
227
  :include-source:
225
228
 
226
229
  import numpy as np
@@ -290,6 +293,7 @@ def plot_bloch_multivector(
290
293
 
291
294
  Examples:
292
295
  .. plot::
296
+ :alt: Output from the previous code.
293
297
  :include-source:
294
298
 
295
299
  from qiskit import QuantumCircuit
@@ -304,6 +308,7 @@ def plot_bloch_multivector(
304
308
  plot_bloch_multivector(state)
305
309
 
306
310
  .. plot::
311
+ :alt: Output from the previous code.
307
312
  :include-source:
308
313
 
309
314
  from qiskit import QuantumCircuit
@@ -406,6 +411,7 @@ def plot_state_city(
406
411
 
407
412
  Examples:
408
413
  .. plot::
414
+ :alt: Output from the previous code.
409
415
  :include-source:
410
416
 
411
417
  # You can choose different colors for the real and imaginary parts of the density matrix.
@@ -422,6 +428,7 @@ def plot_state_city(
422
428
  plot_state_city(state, color=['midnightblue', 'crimson'], title="New State City")
423
429
 
424
430
  .. plot::
431
+ :alt: Output from the previous code.
425
432
  :include-source:
426
433
 
427
434
  # You can make the bars more transparent to better see the ones that are behind
@@ -643,6 +650,7 @@ def plot_state_paulivec(state, title="", figsize=None, color=None, ax=None, *, f
643
650
 
644
651
  Examples:
645
652
  .. plot::
653
+ :alt: Output from the previous code.
646
654
  :include-source:
647
655
 
648
656
  # You can set a color for all the bars.
@@ -659,6 +667,7 @@ def plot_state_paulivec(state, title="", figsize=None, color=None, ax=None, *, f
659
667
  plot_state_paulivec(state, color='midnightblue', title="New PauliVec plot")
660
668
 
661
669
  .. plot::
670
+ :alt: Output from the previous code.
662
671
  :include-source:
663
672
 
664
673
  # If you introduce a list with less colors than bars, the color of the bars will
@@ -816,12 +825,13 @@ def plot_state_qsphere(
816
825
 
817
826
  Raises:
818
827
  MissingOptionalLibraryError: Requires matplotlib.
819
- VisualizationError: if input is not a valid N-qubit state.
828
+ VisualizationError: Input is not a valid N-qubit state.
820
829
 
821
830
  QiskitError: Input statevector does not have valid dimensions.
822
831
 
823
832
  Examples:
824
833
  .. plot::
834
+ :alt: Output from the previous code.
825
835
  :include-source:
826
836
 
827
837
  from qiskit import QuantumCircuit
@@ -836,6 +846,7 @@ def plot_state_qsphere(
836
846
  plot_state_qsphere(state)
837
847
 
838
848
  .. plot::
849
+ :alt: Output from the previous code.
839
850
  :include-source:
840
851
 
841
852
  # You can show the phase of each state and use
@@ -291,13 +291,14 @@ def draw(
291
291
  for more details. No default layout is set. (default `None`).
292
292
 
293
293
  Examples:
294
- To visualize a scheduled circuit program, you can call this function with set of
295
- control arguments. Most of appearance of the output image can be controlled by the
294
+ To visualize a scheduled circuit program, you can call this function with a set of
295
+ control arguments. Most of the appearance of the output image can be controlled by the
296
296
  stylesheet.
297
297
 
298
298
  Drawing with the default stylesheet.
299
299
 
300
300
  .. plot::
301
+ :alt: Output from the previous code.
301
302
  :include-source:
302
303
 
303
304
  from qiskit import QuantumCircuit, transpile, schedule
@@ -314,6 +315,7 @@ def draw(
314
315
  Drawing with the simple stylesheet.
315
316
 
316
317
  .. plot::
318
+ :alt: Output from the previous code.
317
319
  :include-source:
318
320
 
319
321
  from qiskit import QuantumCircuit, transpile, schedule
@@ -330,6 +332,7 @@ def draw(
330
332
  Drawing with the stylesheet suited for program debugging.
331
333
 
332
334
  .. plot::
335
+ :alt: Output from the previous code.
333
336
  :include-source:
334
337
 
335
338
  from qiskit import QuantumCircuit, transpile, schedule
@@ -356,7 +359,7 @@ def draw(
356
359
 
357
360
  In the same way as above, you can create custom generator or layout functions
358
361
  and update existing stylesheet with custom functions.
359
- This feature enables you to control the most of appearance of the output image
362
+ This feature enables you to control the most of the appearance of the output image
360
363
  without modifying the codebase of the scheduled circuit drawer.
361
364
  """
362
365
  del show_idle
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: qiskit
3
- Version: 1.3.0rc2
3
+ Version: 1.3.2
4
4
  Summary: An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
5
5
  Author-email: Qiskit Development Team <qiskit@us.ibm.com>
6
6
  License: Apache 2.0
@@ -94,7 +94,7 @@ To install from source, follow the instructions in the [documentation](https://d
94
94
  Now that Qiskit is installed, it's time to begin working with Qiskit. The essential parts of a quantum program are:
95
95
  1. Define and build a quantum circuit that represents the quantum state
96
96
  2. Define the classical output by measurements or a set of observable operators
97
- 3. Depending on the output, use the primitive function `sampler` to sample outcomes or the `estimator` to estimate values.
97
+ 3. Depending on the output, use the Sampler primitive to sample outcomes or the Estimator primitive to estimate expectation values.
98
98
 
99
99
  Create an example quantum circuit using the `QuantumCircuit` class:
100
100
 
@@ -102,32 +102,32 @@ Create an example quantum circuit using the `QuantumCircuit` class:
102
102
  import numpy as np
103
103
  from qiskit import QuantumCircuit
104
104
 
105
- # 1. A quantum circuit for preparing the quantum state |000> + i |111>
106
- qc_example = QuantumCircuit(3)
107
- qc_example.h(0) # generate superpostion
108
- qc_example.p(np.pi/2,0) # add quantum phase
109
- qc_example.cx(0,1) # 0th-qubit-Controlled-NOT gate on 1st qubit
110
- qc_example.cx(0,2) # 0th-qubit-Controlled-NOT gate on 2nd qubit
105
+ # 1. A quantum circuit for preparing the quantum state |000> + i |111> / √2
106
+ qc = QuantumCircuit(3)
107
+ qc.h(0) # generate superposition
108
+ qc.p(np.pi / 2, 0) # add quantum phase
109
+ qc.cx(0, 1) # 0th-qubit-Controlled-NOT gate on 1st qubit
110
+ qc.cx(0, 2) # 0th-qubit-Controlled-NOT gate on 2nd qubit
111
111
  ```
112
112
 
113
- This simple example makes an entangled state known as a [GHZ state](https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state) $(|000\rangle + i|111\rangle)/\sqrt{2}$. It uses the standard quantum gates: Hadamard gate (`h`), Phase gate (`p`), and CNOT gate (`cx`).
113
+ This simple example creates an entangled state known as a [GHZ state](https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state) $(|000\rangle + i|111\rangle)/\sqrt{2}$. It uses the standard quantum gates: Hadamard gate (`h`), Phase gate (`p`), and CNOT gate (`cx`).
114
114
 
115
- Once you've made your first quantum circuit, choose which primitive function you will use. Starting with `sampler`,
115
+ Once you've made your first quantum circuit, choose which primitive you will use. Starting with the Sampler,
116
116
  we use `measure_all(inplace=False)` to get a copy of the circuit in which all the qubits are measured:
117
117
 
118
118
  ```python
119
119
  # 2. Add the classical output in the form of measurement of all qubits
120
- qc_measured = qc_example.measure_all(inplace=False)
120
+ qc_measured = qc.measure_all(inplace=False)
121
121
 
122
122
  # 3. Execute using the Sampler primitive
123
- from qiskit.primitives.sampler import Sampler
124
- sampler = Sampler()
125
- job = sampler.run(qc_measured, shots=1000)
123
+ from qiskit.primitives import StatevectorSampler
124
+ sampler = StatevectorSampler()
125
+ job = sampler.run([qc_measured], shots=1000)
126
126
  result = job.result()
127
- print(f" > Quasi probability distribution: {result.quasi_dists}")
127
+ print(f" > Counts: {result[0].data["meas"].get_counts()}")
128
128
  ```
129
- Running this will give an outcome similar to `{0: 0.497, 7: 0.503}` which is `000` 50% of the time and `111` 50% of the time up to statistical fluctuations.
130
- To illustrate the power of Estimator, we now use the quantum information toolbox to create the operator $XXY+XYX+YXX-YYY$ and pass it to the `run()` function, along with our quantum circuit. Note the Estimator requires a circuit _**without**_ measurement, so we use the `qc_example` circuit we created earlier.
129
+ Running this will give an outcome similar to `{'000': 497, '111': 503}` which is `000` 50% of the time and `111` 50% of the time up to statistical fluctuations.
130
+ To illustrate the power of the Estimator, we now use the quantum information toolbox to create the operator $XXY+XYX+YXX-YYY$ and pass it to the `run()` function, along with our quantum circuit. Note that the Estimator requires a circuit _**without**_ measurements, so we use the `qc` circuit we created earlier.
131
131
 
132
132
  ```python
133
133
  # 2. Define the observable to be measured
@@ -135,32 +135,32 @@ from qiskit.quantum_info import SparsePauliOp
135
135
  operator = SparsePauliOp.from_list([("XXY", 1), ("XYX", 1), ("YXX", 1), ("YYY", -1)])
136
136
 
137
137
  # 3. Execute using the Estimator primitive
138
- from qiskit.primitives import Estimator
139
- estimator = Estimator()
140
- job = estimator.run(qc_example, operator, shots=1000)
138
+ from qiskit.primitives import StatevectorEstimator
139
+ estimator = StatevectorEstimator()
140
+ job = estimator.run([(qc, operator)], precision=1e-3)
141
141
  result = job.result()
142
- print(f" > Expectation values: {result.values}")
142
+ print(f" > Expectation values: {result[0].data.evs}")
143
143
  ```
144
144
 
145
145
  Running this will give the outcome `4`. For fun, try to assign a value of +/- 1 to each single-qubit operator X and Y
146
146
  and see if you can achieve this outcome. (Spoiler alert: this is not possible!)
147
147
 
148
- Using the Qiskit-provided `qiskit.primitives.Sampler` and `qiskit.primitives.Estimator` will not take you very far.
148
+ Using the Qiskit-provided `qiskit.primitives.StatevectorSampler` and `qiskit.primitives.StatevectorEstimator` will not take you very far.
149
149
  The power of quantum computing cannot be simulated on classical computers and you need to use real quantum hardware to scale to larger quantum circuits.
150
150
  However, running a quantum circuit on hardware requires rewriting to the basis gates and connectivity of the quantum hardware.
151
151
  The tool that does this is the [transpiler](https://docs.quantum.ibm.com/api/qiskit/transpiler), and Qiskit includes transpiler passes for synthesis, optimization, mapping, and scheduling.
152
152
  However, it also includes a default compiler, which works very well in most examples.
153
- The following code will map the example circuit to the `basis_gates = ['cz', 'sx', 'rz']` and a linear chain of qubits $0 \rightarrow 1 \rightarrow 2$ with the `coupling_map =[[0, 1], [1, 2]]`.
153
+ The following code will map the example circuit to the `basis_gates = ["cz", "sx", "rz"]` and a linear chain of qubits $0 \rightarrow 1 \rightarrow 2$ with the `coupling_map = [[0, 1], [1, 2]]`.
154
154
 
155
155
  ```python
156
156
  from qiskit import transpile
157
- qc_transpiled = transpile(qc_example, basis_gates = ['cz', 'sx', 'rz'], coupling_map =[[0, 1], [1, 2]] , optimization_level=3)
157
+ qc_transpiled = transpile(qc, basis_gates=["cz", "sx", "rz"], coupling_map=[[0, 1], [1, 2]], optimization_level=3)
158
158
  ```
159
159
 
160
160
  ### Executing your code on real quantum hardware
161
161
 
162
162
  Qiskit provides an abstraction layer that lets users run quantum circuits on hardware from any vendor that provides a compatible interface.
163
- The best way to use Qiskit is with a runtime environment that provides optimized implementations of `sampler` and `estimator` for a given hardware platform. This runtime may involve using pre- and post-processing, such as optimized transpiler passes with error suppression, error mitigation, and, eventually, error correction built in. A runtime implements `qiskit.primitives.BaseSampler` and `qiskit.primitives.BaseEstimator` interfaces. For example,
163
+ The best way to use Qiskit is with a runtime environment that provides optimized implementations of Sampler and Estimator for a given hardware platform. This runtime may involve using pre- and post-processing, such as optimized transpiler passes with error suppression, error mitigation, and, eventually, error correction built in. A runtime implements `qiskit.primitives.BaseSamplerV2` and `qiskit.primitives.BaseEstimatorV2` interfaces. For example,
164
164
  some packages that provide implementations of a runtime primitive implementation are:
165
165
 
166
166
  * https://github.com/Qiskit/qiskit-ibm-runtime