qiskit 1.3.1__cp39-abi3-win32.whl → 1.3.3__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.
- qiskit/VERSION.txt +1 -1
- qiskit/_accelerate.pyd +0 -0
- qiskit/circuit/__init__.py +7 -2
- qiskit/circuit/controlledgate.py +2 -0
- qiskit/circuit/delay.py +5 -0
- qiskit/circuit/library/__init__.py +1 -0
- qiskit/circuit/library/arithmetic/piecewise_chebyshev.py +1 -0
- qiskit/circuit/library/basis_change/qft.py +3 -0
- qiskit/circuit/library/boolean_logic/inner_product.py +2 -0
- qiskit/circuit/library/boolean_logic/quantum_and.py +4 -0
- qiskit/circuit/library/boolean_logic/quantum_or.py +4 -0
- qiskit/circuit/library/boolean_logic/quantum_xor.py +2 -0
- qiskit/circuit/library/fourier_checking.py +2 -0
- qiskit/circuit/library/generalized_gates/gms.py +1 -0
- qiskit/circuit/library/generalized_gates/gr.py +4 -0
- qiskit/circuit/library/generalized_gates/mcmt.py +1 -0
- qiskit/circuit/library/generalized_gates/permutation.py +5 -1
- qiskit/circuit/library/generalized_gates/unitary.py +1 -1
- qiskit/circuit/library/graph_state.py +2 -0
- qiskit/circuit/library/grover_operator.py +7 -3
- qiskit/circuit/library/hidden_linear_function.py +2 -0
- qiskit/circuit/library/iqp.py +5 -0
- qiskit/circuit/library/n_local/efficient_su2.py +7 -2
- qiskit/circuit/library/n_local/evolved_operator_ansatz.py +3 -0
- qiskit/circuit/library/n_local/excitation_preserving.py +14 -8
- qiskit/circuit/library/n_local/n_local.py +10 -5
- qiskit/circuit/library/n_local/pauli_two_design.py +5 -2
- qiskit/circuit/library/n_local/qaoa_ansatz.py +1 -0
- qiskit/circuit/library/n_local/real_amplitudes.py +10 -4
- qiskit/circuit/library/overlap.py +1 -0
- qiskit/circuit/library/phase_estimation.py +2 -0
- qiskit/circuit/library/quantum_volume.py +3 -0
- qiskit/circuit/library/standard_gates/rz.py +7 -7
- qiskit/circuit/library/standard_gates/xx_minus_yy.py +0 -30
- qiskit/circuit/operation.py +1 -0
- qiskit/circuit/parameter.py +1 -0
- qiskit/circuit/parameterexpression.py +1 -1
- qiskit/circuit/parametervector.py +25 -5
- qiskit/circuit/quantumcircuit.py +17 -20
- qiskit/circuit/random/utils.py +2 -0
- qiskit/compiler/transpiler.py +1 -1
- qiskit/converters/dag_to_circuit.py +1 -0
- qiskit/primitives/statevector_estimator.py +1 -0
- qiskit/providers/fake_provider/__init__.py +1 -0
- qiskit/pulse/builder.py +8 -0
- qiskit/pulse/library/symbolic_pulses.py +1 -0
- qiskit/qasm2/export.py +2 -2
- qiskit/qasm3/__init__.py +1 -0
- qiskit/qasm3/exporter.py +6 -3
- qiskit/quantum_info/operators/channel/transformations.py +15 -0
- qiskit/quantum_info/operators/symplectic/pauli_list.py +8 -8
- qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +10 -1
- qiskit/quantum_info/states/statevector.py +1 -0
- qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py +1 -0
- qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py +1 -0
- qiskit/synthesis/evolution/product_formula.py +0 -6
- qiskit/synthesis/evolution/suzuki_trotter.py +22 -5
- qiskit/transpiler/__init__.py +780 -529
- qiskit/transpiler/layout.py +9 -6
- qiskit/transpiler/passes/layout/sabre_layout.py +13 -0
- qiskit/transpiler/passes/optimization/remove_identity_equiv.py +2 -3
- qiskit/transpiler/passes/routing/star_prerouting.py +1 -0
- qiskit/transpiler/passes/scheduling/dynamical_decoupling.py +1 -0
- qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +1 -0
- qiskit/transpiler/passes/scheduling/scheduling/alap.py +1 -1
- qiskit/transpiler/passes/scheduling/scheduling/asap.py +1 -1
- qiskit/transpiler/passes/synthesis/hls_plugins.py +48 -9
- qiskit/transpiler/passes/utils/filter_op_nodes.py +2 -1
- qiskit/transpiler/passes/utils/remove_barriers.py +1 -0
- qiskit/transpiler/preset_passmanagers/__init__.py +31 -11
- qiskit/transpiler/preset_passmanagers/builtin_plugins.py +19 -22
- qiskit/transpiler/preset_passmanagers/plugin.py +33 -42
- qiskit/transpiler/target.py +1 -1
- qiskit/visualization/__init__.py +6 -0
- qiskit/visualization/circuit/circuit_visualization.py +1 -0
- qiskit/visualization/circuit/text.py +3 -2
- qiskit/visualization/counts_visualization.py +2 -0
- qiskit/visualization/dag_visualization.py +1 -0
- qiskit/visualization/gate_map.py +7 -3
- qiskit/visualization/pulse_v2/interface.py +4 -1
- qiskit/visualization/state_visualization.py +13 -2
- qiskit/visualization/timeline/interface.py +6 -3
- {qiskit-1.3.1.dist-info → qiskit-1.3.3.dist-info}/METADATA +20 -23
- {qiskit-1.3.1.dist-info → qiskit-1.3.3.dist-info}/RECORD +88 -88
- {qiskit-1.3.1.dist-info → qiskit-1.3.3.dist-info}/WHEEL +1 -1
- {qiskit-1.3.1.dist-info → qiskit-1.3.3.dist-info}/LICENSE.txt +0 -0
- {qiskit-1.3.1.dist-info → qiskit-1.3.3.dist-info}/entry_points.txt +0 -0
- {qiskit-1.3.1.dist-info → qiskit-1.3.3.dist-info}/top_level.txt +0 -0
@@ -11,6 +11,8 @@
|
|
11
11
|
# that they have been altered from the originals.
|
12
12
|
|
13
13
|
"""
|
14
|
+
.. _transpiler-preset-stage-plugins:
|
15
|
+
|
14
16
|
=======================================================================================
|
15
17
|
Transpiler Stage Plugin Interface (:mod:`qiskit.transpiler.preset_passmanagers.plugin`)
|
16
18
|
=======================================================================================
|
@@ -35,8 +37,10 @@ see :mod:`qiskit.transpiler.passes.synthesis.plugin`.
|
|
35
37
|
Plugin Stages
|
36
38
|
=============
|
37
39
|
|
38
|
-
|
39
|
-
load external plugins
|
40
|
+
There are six stages in the preset pass managers, all of which actively
|
41
|
+
load external plugins using corresponding entry points. The following table summarizes
|
42
|
+
each stage. For more details on the description and expectations of each stage, follow the link
|
43
|
+
in the stages' names to the full documentation.
|
40
44
|
|
41
45
|
.. list-table:: Stages
|
42
46
|
:header-rows: 1
|
@@ -44,57 +48,44 @@ load external plugins via corresponding entry points.
|
|
44
48
|
* - Stage Name
|
45
49
|
- Entry Point
|
46
50
|
- Reserved Names
|
47
|
-
-
|
48
|
-
|
51
|
+
- Summary
|
52
|
+
|
53
|
+
* - :ref:`init <transpiler-preset-stage-init>`
|
49
54
|
- ``qiskit.transpiler.init``
|
50
55
|
- ``default``
|
51
|
-
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
* - ``layout``
|
56
|
+
- High-level, logical optimizations on abstract circuits, and reduction of multi-qubit
|
57
|
+
operations to one- and two-qubit operations.
|
58
|
+
|
59
|
+
* - :ref:`layout <transpiler-preset-stage-layout>`
|
56
60
|
- ``qiskit.transpiler.layout``
|
57
61
|
- ``trivial``, ``dense``, ``sabre``, ``default``
|
58
|
-
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
layout. The embedding of the :class:`~.Layout` can be generated with
|
63
|
-
:func:`~.generate_embed_passmanager`.
|
64
|
-
* - ``routing``
|
62
|
+
- Choose an initial mapping of virtual qubits to physical qubits, including expansion of the
|
63
|
+
circuit to include explicit ancillas. This stage is sometimes combined with ``routing``.
|
64
|
+
|
65
|
+
* - :ref:`routing <transpiler-preset-stage-routing>`
|
65
66
|
- ``qiskit.transpiler.routing``
|
66
67
|
- ``basic``, ``stochastic``, ``lookahead``, ``sabre``
|
67
|
-
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
of this stage is also expected to have the ``final_layout`` property set field
|
73
|
-
set with a :class:`~.Layout` object that maps the :class:`.Qubit` to the
|
74
|
-
output final position of that qubit in the circuit. If there is an
|
75
|
-
existing ``final_layout`` entry in the property set (such as might be set
|
76
|
-
by an optimization pass that introduces a permutation) it is expected
|
77
|
-
that the final layout will be the composition of the two layouts (this
|
78
|
-
can be computed using :meth:`.DAGCircuit.compose`, for example:
|
79
|
-
``second_final_layout.compose(first_final_layout, dag.qubits)``).
|
80
|
-
* - ``translation``
|
68
|
+
- Insert gates into the circuit to ensure it matches the connectivity constraints of the
|
69
|
+
:class:`.Target`. The inserted gates do not need to be in the target ISA yet, so are often
|
70
|
+
just output as ``swap`` instructions. This stage is sometimes subsumed by ``layout``.
|
71
|
+
|
72
|
+
* - :ref:`translation <transpiler-preset-stage-translation>`
|
81
73
|
- ``qiskit.transpiler.translation``
|
82
|
-
- ``translator``, ``synthesis
|
83
|
-
-
|
84
|
-
|
85
|
-
* -
|
74
|
+
- ``translator``, ``synthesis``
|
75
|
+
- Rewrite all gates outside the target ISA to use only gates within the ISA.
|
76
|
+
|
77
|
+
* - :ref:`optimization <transpiler-preset-stage-optimization>`
|
86
78
|
- ``qiskit.transpiler.optimization``
|
87
79
|
- ``default``
|
88
|
-
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
* - ``scheduling``
|
80
|
+
- Low-level, physical-circuit-aware optimizations. Unlike ``init``, the ``optimization`` stage
|
81
|
+
acts at the level of a physical circuit.
|
82
|
+
|
83
|
+
* - :ref:`scheduling <transpiler-preset-stage-scheduling>`
|
93
84
|
- ``qiskit.transpiler.scheduling``
|
94
85
|
- ``alap``, ``asap``, ``default``
|
95
|
-
-
|
96
|
-
|
97
|
-
|
86
|
+
- Insert :class:`~.circuit.Delay` instructions to make the wall-clock timing of the circuit
|
87
|
+
fully explicit.
|
88
|
+
|
98
89
|
|
99
90
|
Writing Plugins
|
100
91
|
===============
|
qiskit/transpiler/target.py
CHANGED
@@ -725,7 +725,7 @@ class Target(BaseTarget):
|
|
725
725
|
|
726
726
|
@property
|
727
727
|
def instructions(self):
|
728
|
-
"""Get the list of tuples
|
728
|
+
"""Get the list of tuples (:class:`~qiskit.circuit.Instruction`, (qargs))
|
729
729
|
for the target
|
730
730
|
|
731
731
|
For globally defined variable width operations the tuple will be of the form
|
qiskit/visualization/__init__.py
CHANGED
@@ -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
|
@@ -1153,9 +1153,10 @@ class TextDrawing:
|
|
1153
1153
|
if not self.plotbarriers:
|
1154
1154
|
return layer, current_cons, current_cons_cond, connection_label
|
1155
1155
|
|
1156
|
-
|
1156
|
+
top_qubit = min(node.qargs, key=lambda q: self._wire_map.get(q, float("inf")))
|
1157
|
+
for qubit in node.qargs:
|
1157
1158
|
if qubit in self.qubits:
|
1158
|
-
label = op.label if
|
1159
|
+
label = op.label if qubit == top_qubit else ""
|
1159
1160
|
layer.set_qubit(qubit, Barrier(label))
|
1160
1161
|
|
1161
1162
|
elif isinstance(op, SwapGate):
|
@@ -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.
|
qiskit/visualization/gate_map.py
CHANGED
@@ -75,13 +75,14 @@ def plot_gate_map(
|
|
75
75
|
Figure: A Matplotlib figure instance.
|
76
76
|
|
77
77
|
Raises:
|
78
|
-
QiskitError:
|
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:
|
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:
|
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:
|
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
|
+
Metadata-Version: 2.2
|
2
2
|
Name: qiskit
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.3
|
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
|
@@ -56,7 +56,7 @@ Requires-Dist: qiskit[crosstalk-pass,csp-layout-pass,qasm3-import,visualization]
|
|
56
56
|
|
57
57
|
[](https://opensource.org/licenses/Apache-2.0) <!--- long-description-skip-begin -->
|
58
58
|
[](https://github.com/Qiskit/qiskit/releases)
|
59
|
-
[](https://github.com/Qiskit/qiskit/releases?q=tag%3A0)
|
59
|
+
<!-- [](https://github.com/Qiskit/qiskit/releases?q=tag%3A0) -->
|
60
60
|
[](https://pypi.org/project/qiskit/)
|
61
61
|
[](https://coveralls.io/github/Qiskit/qiskit?branch=main)
|
62
62
|

|
@@ -76,9 +76,6 @@ For more details on how to use Qiskit, refer to the documentation located here:
|
|
76
76
|
|
77
77
|
## Installation
|
78
78
|
|
79
|
-
> [!WARNING]
|
80
|
-
> Do not try to upgrade an existing Qiskit 0.* environment to Qiskit 1.0 in-place. [Read more](https://docs.quantum.ibm.com/migration-guides/qiskit-1.0-installation).
|
81
|
-
|
82
79
|
We encourage installing Qiskit via ``pip``:
|
83
80
|
|
84
81
|
```bash
|
@@ -94,7 +91,7 @@ To install from source, follow the instructions in the [documentation](https://d
|
|
94
91
|
Now that Qiskit is installed, it's time to begin working with Qiskit. The essential parts of a quantum program are:
|
95
92
|
1. Define and build a quantum circuit that represents the quantum state
|
96
93
|
2. Define the classical output by measurements or a set of observable operators
|
97
|
-
3. Depending on the output, use the primitive
|
94
|
+
3. Depending on the output, use the Sampler primitive to sample outcomes or the Estimator primitive to estimate expectation values.
|
98
95
|
|
99
96
|
Create an example quantum circuit using the `QuantumCircuit` class:
|
100
97
|
|
@@ -102,22 +99,22 @@ Create an example quantum circuit using the `QuantumCircuit` class:
|
|
102
99
|
import numpy as np
|
103
100
|
from qiskit import QuantumCircuit
|
104
101
|
|
105
|
-
# 1. A quantum circuit for preparing the quantum state |000> + i |111>
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
102
|
+
# 1. A quantum circuit for preparing the quantum state |000> + i |111> / √2
|
103
|
+
qc = QuantumCircuit(3)
|
104
|
+
qc.h(0) # generate superposition
|
105
|
+
qc.p(np.pi / 2, 0) # add quantum phase
|
106
|
+
qc.cx(0, 1) # 0th-qubit-Controlled-NOT gate on 1st qubit
|
107
|
+
qc.cx(0, 2) # 0th-qubit-Controlled-NOT gate on 2nd qubit
|
111
108
|
```
|
112
109
|
|
113
|
-
This simple example
|
110
|
+
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
111
|
|
115
|
-
Once you've made your first quantum circuit, choose which primitive
|
112
|
+
Once you've made your first quantum circuit, choose which primitive you will use. Starting with the Sampler,
|
116
113
|
we use `measure_all(inplace=False)` to get a copy of the circuit in which all the qubits are measured:
|
117
114
|
|
118
115
|
```python
|
119
116
|
# 2. Add the classical output in the form of measurement of all qubits
|
120
|
-
qc_measured =
|
117
|
+
qc_measured = qc.measure_all(inplace=False)
|
121
118
|
|
122
119
|
# 3. Execute using the Sampler primitive
|
123
120
|
from qiskit.primitives import StatevectorSampler
|
@@ -127,7 +124,7 @@ result = job.result()
|
|
127
124
|
print(f" > Counts: {result[0].data["meas"].get_counts()}")
|
128
125
|
```
|
129
126
|
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 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**_
|
127
|
+
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
128
|
|
132
129
|
```python
|
133
130
|
# 2. Define the observable to be measured
|
@@ -137,7 +134,7 @@ operator = SparsePauliOp.from_list([("XXY", 1), ("XYX", 1), ("YXX", 1), ("YYY",
|
|
137
134
|
# 3. Execute using the Estimator primitive
|
138
135
|
from qiskit.primitives import StatevectorEstimator
|
139
136
|
estimator = StatevectorEstimator()
|
140
|
-
job = estimator.run([(
|
137
|
+
job = estimator.run([(qc, operator)], precision=1e-3)
|
141
138
|
result = job.result()
|
142
139
|
print(f" > Expectation values: {result[0].data.evs}")
|
143
140
|
```
|
@@ -150,17 +147,17 @@ The power of quantum computing cannot be simulated on classical computers and yo
|
|
150
147
|
However, running a quantum circuit on hardware requires rewriting to the basis gates and connectivity of the quantum hardware.
|
151
148
|
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
149
|
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 = [
|
150
|
+
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
151
|
|
155
152
|
```python
|
156
153
|
from qiskit import transpile
|
157
|
-
qc_transpiled = transpile(
|
154
|
+
qc_transpiled = transpile(qc, basis_gates=["cz", "sx", "rz"], coupling_map=[[0, 1], [1, 2]], optimization_level=3)
|
158
155
|
```
|
159
156
|
|
160
157
|
### Executing your code on real quantum hardware
|
161
158
|
|
162
159
|
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
|
160
|
+
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
161
|
some packages that provide implementations of a runtime primitive implementation are:
|
165
162
|
|
166
163
|
* https://github.com/Qiskit/qiskit-ibm-runtime
|
@@ -200,9 +197,9 @@ to the project at different levels. If you use Qiskit, please cite as per the in
|
|
200
197
|
|
201
198
|
The changelog for a particular release is dynamically generated and gets
|
202
199
|
written to the release page on Github for each release. For example, you can
|
203
|
-
find the page for the `
|
200
|
+
find the page for the `1.2.0` release here:
|
204
201
|
|
205
|
-
<https://github.com/Qiskit/qiskit/releases/tag/
|
202
|
+
<https://github.com/Qiskit/qiskit/releases/tag/1.2.0>
|
206
203
|
|
207
204
|
The changelog for the current release can be found in the releases tab:
|
208
205
|
[](https://github.com/Qiskit/qiskit/releases)
|