qiskit 1.2.0rc1__cp38-abi3-macosx_10_9_universal2.whl → 1.2.1__cp38-abi3-macosx_10_9_universal2.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.abi3.so +0 -0
- qiskit/circuit/__init__.py +15 -2
- qiskit/circuit/library/basis_change/qft.py +3 -1
- qiskit/circuit/library/data_preparation/initializer.py +5 -2
- qiskit/circuit/library/data_preparation/state_preparation.py +2 -2
- qiskit/circuit/library/standard_gates/__init__.py +32 -25
- qiskit/circuit/quantumcircuit.py +43 -18
- qiskit/compiler/transpiler.py +1 -1
- qiskit/providers/basic_provider/basic_simulator.py +1 -1
- qiskit/providers/fake_provider/fake_openpulse_2q.py +3 -3
- qiskit/providers/fake_provider/fake_openpulse_3q.py +2 -3
- qiskit/providers/fake_provider/fake_pulse_backend.py +2 -1
- qiskit/providers/fake_provider/fake_qasm_backend.py +2 -1
- qiskit/providers/fake_provider/generic_backend_v2.py +434 -18
- qiskit/providers/models/__init__.py +47 -21
- qiskit/pulse/library/symbolic_pulses.py +4 -3
- qiskit/qasm3/exporter.py +7 -1
- qiskit/qpy/__init__.py +1 -1
- qiskit/quantum_info/operators/operator.py +24 -0
- qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +1 -1
- qiskit/synthesis/clifford/clifford_decompose_bm.py +1 -1
- qiskit/synthesis/clifford/clifford_decompose_greedy.py +1 -1
- qiskit/synthesis/linear/cnot_synth.py +1 -1
- qiskit/synthesis/one_qubit/one_qubit_decompose.py +2 -1
- qiskit/synthesis/permutation/permutation_full.py +2 -2
- qiskit/synthesis/permutation/permutation_lnn.py +3 -1
- qiskit/synthesis/two_qubit/two_qubit_decompose.py +2 -2
- qiskit/transpiler/instruction_durations.py +4 -0
- qiskit/transpiler/passes/__init__.py +2 -0
- qiskit/transpiler/passes/basis/basis_translator.py +2 -1
- qiskit/transpiler/passes/optimization/__init__.py +1 -0
- qiskit/transpiler/passes/optimization/consolidate_blocks.py +7 -1
- qiskit/transpiler/passes/optimization/hoare_opt.py +12 -8
- qiskit/transpiler/passes/optimization/split_2q_unitaries.py +16 -20
- qiskit/transpiler/passes/scheduling/alignments/pulse_gate_validation.py +1 -1
- qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +9 -3
- qiskit/transpiler/passes/synthesis/unitary_synthesis.py +1 -1
- qiskit/transpiler/preset_passmanagers/builtin_plugins.py +10 -54
- qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +9 -0
- qiskit/utils/optionals.py +173 -150
- qiskit/visualization/bloch.py +44 -1
- qiskit/visualization/dag_visualization.py +10 -3
- qiskit/visualization/gate_map.py +28 -6
- {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/METADATA +20 -20
- {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/RECORD +50 -50
- {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/WHEEL +1 -1
- {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/LICENSE.txt +0 -0
- {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/entry_points.txt +0 -0
- {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/top_level.txt +0 -0
qiskit/utils/optionals.py
CHANGED
@@ -25,172 +25,195 @@ Available Testers
|
|
25
25
|
Qiskit Components
|
26
26
|
-----------------
|
27
27
|
|
28
|
-
..
|
29
|
-
:widths: 25 75
|
28
|
+
.. py:data:: HAS_AER
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
the quantum circuits constructed within Qiskit.
|
30
|
+
`Qiskit Aer <https://qiskit.github.io/qiskit-aer/>` provides high-performance simulators for
|
31
|
+
the quantum circuits constructed within Qiskit.
|
34
32
|
|
35
|
-
|
36
|
-
- The :mod:`Qiskit IBMQ Provider <qiskit.providers.ibmq>` is used for accessing IBM Quantum
|
37
|
-
hardware in the IBM cloud.
|
33
|
+
.. py:data:: HAS_IBMQ
|
38
34
|
|
39
|
-
|
40
|
-
|
41
|
-
characterization, and error correction.
|
35
|
+
The :mod:`Qiskit IBMQ Provider <qiskit.providers.ibmq>` is used for accessing IBM Quantum
|
36
|
+
hardware in the IBM cloud.
|
42
37
|
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
.. py:data:: HAS_IGNIS
|
39
|
+
|
40
|
+
:mod:`Qiskit Ignis <qiskit.ignis>` provides tools for quantum hardware verification, noise
|
41
|
+
characterization, and error correction.
|
42
|
+
|
43
|
+
.. py:data:: HAS_TOQM
|
44
|
+
|
45
|
+
`Qiskit TOQM <https://github.com/qiskit-toqm/qiskit-toqm>`__ provides transpiler passes
|
46
|
+
for the `Time-optimal Qubit mapping algorithm <https://doi.org/10.1145/3445814.3446706>`__.
|
46
47
|
|
47
48
|
|
48
49
|
External Python Libraries
|
49
50
|
-------------------------
|
50
51
|
|
51
|
-
..
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
52
|
+
.. py:data:: HAS_CONSTRAINT
|
53
|
+
|
54
|
+
`python-constraint <https://github.com/python-constraint/python-constraint>`__ is a
|
55
|
+
constraint satisfaction problem solver, used in the :class:`~.CSPLayout` transpiler pass.
|
56
|
+
|
57
|
+
.. py:data:: HAS_CPLEX
|
58
|
+
|
59
|
+
The `IBM CPLEX Optimizer <https://www.ibm.com/analytics/cplex-optimizer>`__ is a
|
60
|
+
high-performance mathematical programming solver for linear, mixed-integer and quadratic
|
61
|
+
programming. This is no longer by Qiskit, but it weas historically and the optional
|
62
|
+
remains for backwards compatibility.
|
63
|
+
|
64
|
+
.. py:data:: HAS_CVXPY
|
65
|
+
|
66
|
+
`CVXPY <https://www.cvxpy.org/>`__ is a Python package for solving convex optimization
|
67
|
+
problems. It is required for calculating diamond norms with
|
68
|
+
:func:`.quantum_info.diamond_norm`.
|
69
|
+
|
70
|
+
.. py:data:: HAS_DOCPLEX
|
71
|
+
|
72
|
+
`IBM Decision Optimization CPLEX Modelling
|
73
|
+
<http://ibmdecisionoptimization.github.io/docplex-doc/>`__ is a library for prescriptive
|
74
|
+
analysis. Like CPLEX, this is no longer by Qiskit, but it weas historically and the
|
75
|
+
optional remains for backwards compatibility.
|
76
|
+
|
77
|
+
.. py:data:: HAS_FIXTURES
|
78
|
+
|
79
|
+
The test suite has additional features that are available if the optional `fixtures
|
80
|
+
<https://launchpad.net/python-fixtures>`__ module is installed. This generally also needs
|
81
|
+
:data:`HAS_TESTTOOLS` as well. This is generally only needed for Qiskit developers.
|
82
|
+
|
83
|
+
.. py:data:: HAS_IPYTHON
|
84
|
+
|
85
|
+
If `the IPython kernel <https://ipython.org/>`__ is available, certain additional
|
86
|
+
visualizations and line magics are made available.
|
87
|
+
|
88
|
+
.. py:data:: HAS_IPYWIDGETS
|
89
|
+
|
90
|
+
Monitoring widgets for jobs running on external backends can be provided if `ipywidgets
|
91
|
+
<https://ipywidgets.readthedocs.io/en/latest/>`__ is available.
|
92
|
+
|
93
|
+
.. py:data:: HAS_JAX
|
94
|
+
|
95
|
+
Some methods of gradient calculation within :mod:`.opflow.gradients` require `JAX
|
96
|
+
<https://github.com/google/jax>`__ for autodifferentiation.
|
97
|
+
|
98
|
+
.. py:data:: HAS_JUPYTER
|
99
|
+
|
100
|
+
Some of the tests require a complete `Jupyter <https://jupyter.org/>`__ installation to test
|
101
|
+
interactivity features.
|
102
|
+
|
103
|
+
.. py:data:: HAS_MATPLOTLIB
|
104
|
+
|
105
|
+
Qiskit provides several visualization tools in the :mod:`.visualization` module.
|
106
|
+
Almost all of these are built using `Matplotlib <https://matplotlib.org/>`__, which must
|
107
|
+
be installed in order to use them.
|
108
|
+
|
109
|
+
.. py:data:: HAS_NETWORKX
|
110
|
+
|
111
|
+
No longer used by Qiskit. Internally, Qiskit now uses the high-performance `rustworkx
|
112
|
+
<https://github.com/Qiskit/rustworkx>`__ library as a core dependency, and during the
|
113
|
+
change-over period, it was sometimes convenient to convert things into the Python-only
|
114
|
+
`NetworkX <https://networkx.org/>`__ format. Some tests of application modules, such as
|
115
|
+
`Qiskit Nature <https://qiskit-community.github.io/qiskit-nature/>`__ still use NetworkX.
|
116
|
+
|
117
|
+
.. py:data:: HAS_NLOPT
|
118
|
+
|
119
|
+
`NLopt <https://nlopt.readthedocs.io/en/latest/>`__ is a nonlinear optimization library,
|
120
|
+
used by the global optimizers in the :mod:`.algorithms.optimizers` module.
|
121
|
+
|
122
|
+
.. py:data:: HAS_PIL
|
123
|
+
|
124
|
+
PIL is a Python image-manipulation library. Qiskit actually uses the `pillow
|
125
|
+
<https://pillow.readthedocs.io/en/stable/>`__ fork of PIL if it is available when generating
|
126
|
+
certain visualizations, for example of both :class:`.QuantumCircuit` and
|
127
|
+
:class:`.DAGCircuit` in certain modes.
|
128
|
+
|
129
|
+
.. py:data:: HAS_PYDOT
|
130
|
+
|
131
|
+
For some graph visualizations, Qiskit uses `pydot <https://github.com/pydot/pydot>`__ as an
|
132
|
+
interface to GraphViz (see :data:`HAS_GRAPHVIZ`).
|
133
|
+
|
134
|
+
.. py:data:: HAS_PYGMENTS
|
135
|
+
|
136
|
+
Pygments is a code highlighter and formatter used by many environments that involve rich
|
137
|
+
display of code blocks, including Sphinx and Jupyter. Qiskit uses this when producing rich
|
138
|
+
output for these environments.
|
139
|
+
|
140
|
+
.. py:data:: HAS_PYLATEX
|
141
|
+
|
142
|
+
Various LaTeX-based visualizations, especially the circuit drawers, need access to the
|
143
|
+
`pylatexenc <https://github.com/phfaist/pylatexenc>`__ project to work correctly.
|
144
|
+
|
145
|
+
.. py:data:: HAS_QASM3_IMPORT
|
146
|
+
|
147
|
+
The functions :func:`.qasm3.load` and :func:`.qasm3.loads` for importing OpenQASM 3 programs
|
148
|
+
into :class:`.QuantumCircuit` instances use `an external importer package
|
149
|
+
<https://qiskit.github.io/qiskit-qasm3-import>`__.
|
150
|
+
|
151
|
+
.. py:data:: HAS_SEABORN
|
152
|
+
|
153
|
+
Qiskit provides several visualization tools in the :mod:`.visualization` module. Some
|
154
|
+
of these are built using `Seaborn <https://seaborn.pydata.org/>`__, which must be installed
|
155
|
+
in order to use them.
|
156
|
+
|
157
|
+
.. py:data:: HAS_SKLEARN
|
158
|
+
|
159
|
+
Some of the gradient functions in :mod:`.opflow.gradients` use regularisation methods from
|
160
|
+
`Scikit Learn <https://scikit-learn.org/stable/>`__.
|
161
|
+
|
162
|
+
.. py:data:: HAS_SKQUANT
|
163
|
+
|
164
|
+
Some of the optimisers in :mod:`.algorithms.optimizers` are based on those found in `Scikit
|
165
|
+
Quant <https://github.com/scikit-quant/scikit-quant>`__, which must be installed to use
|
166
|
+
them.
|
167
|
+
|
168
|
+
.. py:data:: HAS_SQSNOBFIT
|
169
|
+
|
170
|
+
`SQSnobFit <https://pypi.org/project/SQSnobFit/>`__ is a library for the "stable noisy
|
171
|
+
optimization by branch and fit" algorithm. It is used by the :class:`.SNOBFIT` optimizer.
|
172
|
+
|
173
|
+
.. py:data:: HAS_SYMENGINE
|
174
|
+
|
175
|
+
`Symengine <https://github.com/symengine/symengine>`__ is a fast C++ backend for the
|
176
|
+
symbolic-manipulation library `Sympy <https://www.sympy.org/en/index.html>`__. Qiskit uses
|
177
|
+
special methods from Symengine to accelerate its handling of
|
178
|
+
:class:`~.circuit.Parameter`\\ s if available.
|
179
|
+
|
180
|
+
.. py:data:: HAS_TESTTOOLS
|
181
|
+
|
182
|
+
Qiskit's test suite has more advanced functionality available if the optional
|
183
|
+
`testtools <https://pypi.org/project/testtools/>`__ library is installed. This is generally
|
184
|
+
only needed for Qiskit developers.
|
185
|
+
|
186
|
+
.. py:data:: HAS_TWEEDLEDUM
|
187
|
+
|
188
|
+
`Tweedledum <https://github.com/boschmitt/tweedledum>`__ is an extension library for
|
189
|
+
synthesis and optimization of circuits that may involve classical oracles. Qiskit's
|
190
|
+
:class:`.PhaseOracle` uses this, which is used in turn by amplification algorithms via
|
191
|
+
the :class:`.AmplificationProblem`.
|
192
|
+
|
193
|
+
.. py:data:: HAS_Z3
|
194
|
+
|
195
|
+
`Z3 <https://github.com/Z3Prover/z3>`__ is a theorem prover, used in the
|
196
|
+
:class:`.CrosstalkAdaptiveSchedule` and :class:`.HoareOptimizer` transpiler passes.
|
174
197
|
|
175
198
|
External Command-Line Tools
|
176
199
|
---------------------------
|
177
200
|
|
178
|
-
..
|
179
|
-
|
201
|
+
.. py:data:: HAS_GRAPHVIZ
|
202
|
+
|
203
|
+
For some graph visualizations, Qiskit uses the `GraphViz <https://graphviz.org/>`__
|
204
|
+
visualization tool via its ``pydot`` interface (see :data:`HAS_PYDOT`).
|
205
|
+
|
206
|
+
.. py:data:: HAS_PDFLATEX
|
180
207
|
|
181
|
-
|
182
|
-
|
183
|
-
|
208
|
+
Visualization tools that use LaTeX in their output, such as the circuit drawers, require
|
209
|
+
``pdflatex`` to be available. You will generally need to ensure that you have a working
|
210
|
+
LaTeX installation available, and the ``qcircuit.tex`` package.
|
184
211
|
|
185
|
-
|
186
|
-
- Visualization tools that use LaTeX in their output, such as the circuit drawers, require
|
187
|
-
``pdflatex`` to be available. You will generally need to ensure that you have a working
|
188
|
-
LaTeX installation available, and the ``qcircuit.tex`` package.
|
212
|
+
.. py:data:: HAS_PDFTOCAIRO
|
189
213
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
<https://poppler.freedesktop.org/>`__.
|
214
|
+
Visualization tools that convert LaTeX-generated files into rasterized images use the
|
215
|
+
``pdftocairo`` tool. This is part of the `Poppler suite of PDF tools
|
216
|
+
<https://poppler.freedesktop.org/>`__.
|
194
217
|
|
195
218
|
|
196
219
|
Lazy Checker Classes
|
qiskit/visualization/bloch.py
CHANGED
@@ -50,6 +50,7 @@ __all__ = ["Bloch"]
|
|
50
50
|
|
51
51
|
import math
|
52
52
|
import os
|
53
|
+
import re
|
53
54
|
import numpy as np
|
54
55
|
import matplotlib
|
55
56
|
import matplotlib.pyplot as plt
|
@@ -60,6 +61,47 @@ from mpl_toolkits.mplot3d.art3d import Patch3D
|
|
60
61
|
from .utils import matplotlib_close_if_inline
|
61
62
|
|
62
63
|
|
64
|
+
# This version pattern is taken from the pypa packaging project:
|
65
|
+
# https://github.com/pypa/packaging/blob/21.3/packaging/version.py#L223-L254
|
66
|
+
# which is dual licensed Apache 2.0 and BSD see the source for the original
|
67
|
+
# authors and other details
|
68
|
+
VERSION_PATTERN = (
|
69
|
+
"^"
|
70
|
+
+ r"""
|
71
|
+
v?
|
72
|
+
(?:
|
73
|
+
(?:(?P<epoch>[0-9]+)!)? # epoch
|
74
|
+
(?P<release>[0-9]+(?:\.[0-9]+)*) # release segment
|
75
|
+
(?P<pre> # pre-release
|
76
|
+
[-_\.]?
|
77
|
+
(?P<pre_l>(a|b|c|rc|alpha|beta|pre|preview))
|
78
|
+
[-_\.]?
|
79
|
+
(?P<pre_n>[0-9]+)?
|
80
|
+
)?
|
81
|
+
(?P<post> # post release
|
82
|
+
(?:-(?P<post_n1>[0-9]+))
|
83
|
+
|
|
84
|
+
(?:
|
85
|
+
[-_\.]?
|
86
|
+
(?P<post_l>post|rev|r)
|
87
|
+
[-_\.]?
|
88
|
+
(?P<post_n2>[0-9]+)?
|
89
|
+
)
|
90
|
+
)?
|
91
|
+
(?P<dev> # dev release
|
92
|
+
[-_\.]?
|
93
|
+
(?P<dev_l>dev)
|
94
|
+
[-_\.]?
|
95
|
+
(?P<dev_n>[0-9]+)?
|
96
|
+
)?
|
97
|
+
)
|
98
|
+
(?:\+(?P<local>[a-z0-9]+(?:[-_\.][a-z0-9]+)*))? # local version
|
99
|
+
"""
|
100
|
+
+ "$"
|
101
|
+
)
|
102
|
+
VERSION_PATTERN_REGEX = re.compile(VERSION_PATTERN, re.VERBOSE | re.IGNORECASE)
|
103
|
+
|
104
|
+
|
63
105
|
class Arrow3D(Patch3D, FancyArrowPatch):
|
64
106
|
"""Makes a fancy arrow"""
|
65
107
|
|
@@ -419,7 +461,8 @@ class Bloch:
|
|
419
461
|
self.fig = plt.figure(figsize=self.figsize)
|
420
462
|
|
421
463
|
if not self._ext_axes:
|
422
|
-
|
464
|
+
version_match = VERSION_PATTERN_REGEX.search(matplotlib.__version__)
|
465
|
+
if tuple(int(x) for x in version_match.group("release").split(".")) >= (3, 4, 0):
|
423
466
|
self.axes = Axes3D(
|
424
467
|
self.fig, azim=self.view[0], elev=self.view[1], auto_add_to_figure=False
|
425
468
|
)
|
@@ -174,10 +174,13 @@ def dag_drawer(dag, scale=0.7, filename=None, style="color"):
|
|
174
174
|
label = register_bit_labels.get(
|
175
175
|
node.wire, f"q_{dag.find_bit(node.wire).index}"
|
176
176
|
)
|
177
|
-
|
177
|
+
elif isinstance(node.wire, Clbit):
|
178
178
|
label = register_bit_labels.get(
|
179
179
|
node.wire, f"c_{dag.find_bit(node.wire).index}"
|
180
180
|
)
|
181
|
+
else:
|
182
|
+
label = str(node.wire.name)
|
183
|
+
|
181
184
|
n["label"] = label
|
182
185
|
n["color"] = "black"
|
183
186
|
n["style"] = "filled"
|
@@ -187,10 +190,12 @@ def dag_drawer(dag, scale=0.7, filename=None, style="color"):
|
|
187
190
|
label = register_bit_labels.get(
|
188
191
|
node.wire, f"q[{dag.find_bit(node.wire).index}]"
|
189
192
|
)
|
190
|
-
|
193
|
+
elif isinstance(node.wire, Clbit):
|
191
194
|
label = register_bit_labels.get(
|
192
195
|
node.wire, f"c[{dag.find_bit(node.wire).index}]"
|
193
196
|
)
|
197
|
+
else:
|
198
|
+
label = str(node.wire.name)
|
194
199
|
n["label"] = label
|
195
200
|
n["color"] = "black"
|
196
201
|
n["style"] = "filled"
|
@@ -203,8 +208,10 @@ def dag_drawer(dag, scale=0.7, filename=None, style="color"):
|
|
203
208
|
e = {}
|
204
209
|
if isinstance(edge, Qubit):
|
205
210
|
label = register_bit_labels.get(edge, f"q_{dag.find_bit(edge).index}")
|
206
|
-
|
211
|
+
elif isinstance(edge, Clbit):
|
207
212
|
label = register_bit_labels.get(edge, f"c_{dag.find_bit(edge).index}")
|
213
|
+
else:
|
214
|
+
label = str(edge.name)
|
208
215
|
e["label"] = label
|
209
216
|
return e
|
210
217
|
|
qiskit/visualization/gate_map.py
CHANGED
@@ -945,6 +945,7 @@ def plot_gate_map(
|
|
945
945
|
font_color,
|
946
946
|
ax,
|
947
947
|
filename,
|
948
|
+
planar=rx.is_planar(coupling_map.graph.to_undirected(multigraph=False)),
|
948
949
|
)
|
949
950
|
|
950
951
|
|
@@ -966,6 +967,8 @@ def plot_coupling_map(
|
|
966
967
|
font_color="white",
|
967
968
|
ax=None,
|
968
969
|
filename=None,
|
970
|
+
*,
|
971
|
+
planar=True,
|
969
972
|
):
|
970
973
|
"""Plots an arbitrary coupling map of qubits (embedded in a plane).
|
971
974
|
|
@@ -987,6 +990,7 @@ def plot_coupling_map(
|
|
987
990
|
font_color (str): The font color for the qubit labels.
|
988
991
|
ax (Axes): A Matplotlib axes instance.
|
989
992
|
filename (str): file path to save image to.
|
993
|
+
planar (bool): If the coupling map is planar or not. Default: ``True`` (i.e. it is planar)
|
990
994
|
|
991
995
|
Returns:
|
992
996
|
Figure: A Matplotlib figure instance.
|
@@ -1057,7 +1061,14 @@ def plot_coupling_map(
|
|
1057
1061
|
|
1058
1062
|
if font_size is None:
|
1059
1063
|
max_characters = max(1, max(len(str(x)) for x in qubit_labels))
|
1060
|
-
|
1064
|
+
if max_characters == 1:
|
1065
|
+
font_size = 20
|
1066
|
+
elif max_characters == 2:
|
1067
|
+
font_size = 14
|
1068
|
+
elif max_characters == 3:
|
1069
|
+
font_size = 12
|
1070
|
+
else:
|
1071
|
+
font_size = 1
|
1061
1072
|
|
1062
1073
|
def color_node(node):
|
1063
1074
|
if qubit_coordinates:
|
@@ -1065,8 +1076,6 @@ def plot_coupling_map(
|
|
1065
1076
|
"label": str(qubit_labels[node]),
|
1066
1077
|
"color": f'"{qubit_color[node]}"',
|
1067
1078
|
"fillcolor": f'"{qubit_color[node]}"',
|
1068
|
-
"style": "filled",
|
1069
|
-
"shape": "circle",
|
1070
1079
|
"pos": f'"{qubit_coordinates[node][0]},{qubit_coordinates[node][1]}"',
|
1071
1080
|
"pin": "True",
|
1072
1081
|
}
|
@@ -1075,11 +1084,11 @@ def plot_coupling_map(
|
|
1075
1084
|
"label": str(qubit_labels[node]),
|
1076
1085
|
"color": f'"{qubit_color[node]}"',
|
1077
1086
|
"fillcolor": f'"{qubit_color[node]}"',
|
1078
|
-
"style": "filled",
|
1079
|
-
"shape": "circle",
|
1080
1087
|
}
|
1088
|
+
out_dict["style"] = "filled"
|
1089
|
+
out_dict["shape"] = "circle"
|
1081
1090
|
out_dict["fontcolor"] = f'"{font_color}"'
|
1082
|
-
out_dict["fontsize"] = str(font_size)
|
1091
|
+
out_dict["fontsize"] = f'"{str(font_size)}!"'
|
1083
1092
|
out_dict["height"] = str(qubit_size * px)
|
1084
1093
|
out_dict["fixedsize"] = "True"
|
1085
1094
|
out_dict["fontname"] = '"DejaVu Sans"'
|
@@ -1093,9 +1102,22 @@ def plot_coupling_map(
|
|
1093
1102
|
}
|
1094
1103
|
return out_dict
|
1095
1104
|
|
1105
|
+
graph_attributes = None
|
1106
|
+
if not qubit_coordinates:
|
1107
|
+
if planar:
|
1108
|
+
graph_attributes = {
|
1109
|
+
"overlap_scaling": "-7",
|
1110
|
+
"overlap": "prism",
|
1111
|
+
"model": "subset",
|
1112
|
+
}
|
1113
|
+
else:
|
1114
|
+
graph_attributes = {
|
1115
|
+
"overlap": "true",
|
1116
|
+
}
|
1096
1117
|
plot = graphviz_draw(
|
1097
1118
|
graph,
|
1098
1119
|
method="neato",
|
1120
|
+
graph_attr=graph_attributes,
|
1099
1121
|
node_attr_fn=color_node,
|
1100
1122
|
edge_attr_fn=color_edge,
|
1101
1123
|
filename=filename,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: qiskit
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.1
|
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
|
@@ -28,29 +28,29 @@ Classifier: Topic :: Scientific/Engineering
|
|
28
28
|
Requires-Python: >=3.8
|
29
29
|
Description-Content-Type: text/markdown
|
30
30
|
License-File: LICENSE.txt
|
31
|
-
Requires-Dist: rustworkx
|
32
|
-
Requires-Dist: numpy
|
33
|
-
Requires-Dist: scipy
|
34
|
-
Requires-Dist: sympy
|
35
|
-
Requires-Dist: dill
|
36
|
-
Requires-Dist: python-dateutil
|
37
|
-
Requires-Dist: stevedore
|
31
|
+
Requires-Dist: rustworkx>=0.15.0
|
32
|
+
Requires-Dist: numpy<3,>=1.17
|
33
|
+
Requires-Dist: scipy>=1.5
|
34
|
+
Requires-Dist: sympy>=1.3
|
35
|
+
Requires-Dist: dill>=0.3
|
36
|
+
Requires-Dist: python-dateutil>=2.8.0
|
37
|
+
Requires-Dist: stevedore>=3.0.0
|
38
38
|
Requires-Dist: typing-extensions
|
39
|
-
Requires-Dist: symengine
|
39
|
+
Requires-Dist: symengine>=0.11
|
40
40
|
Provides-Extra: all
|
41
|
-
Requires-Dist: qiskit[crosstalk-pass,csp-layout-pass,qasm3-import,visualization]
|
41
|
+
Requires-Dist: qiskit[crosstalk-pass,csp-layout-pass,qasm3-import,visualization]; extra == "all"
|
42
42
|
Provides-Extra: crosstalk-pass
|
43
|
-
Requires-Dist: z3-solver
|
43
|
+
Requires-Dist: z3-solver>=4.7; extra == "crosstalk-pass"
|
44
44
|
Provides-Extra: csp-layout-pass
|
45
|
-
Requires-Dist: python-constraint
|
45
|
+
Requires-Dist: python-constraint>=1.4; extra == "csp-layout-pass"
|
46
46
|
Provides-Extra: qasm3-import
|
47
|
-
Requires-Dist: qiskit-qasm3-import
|
47
|
+
Requires-Dist: qiskit-qasm3-import>=0.1.0; extra == "qasm3-import"
|
48
48
|
Provides-Extra: visualization
|
49
|
-
Requires-Dist: matplotlib
|
50
|
-
Requires-Dist: pydot
|
51
|
-
Requires-Dist: Pillow
|
52
|
-
Requires-Dist: pylatexenc
|
53
|
-
Requires-Dist: seaborn
|
49
|
+
Requires-Dist: matplotlib>=3.3; extra == "visualization"
|
50
|
+
Requires-Dist: pydot; extra == "visualization"
|
51
|
+
Requires-Dist: Pillow>=4.2.1; extra == "visualization"
|
52
|
+
Requires-Dist: pylatexenc>=1.4; extra == "visualization"
|
53
|
+
Requires-Dist: seaborn>=0.9.0; extra == "visualization"
|
54
54
|
|
55
55
|
# Qiskit
|
56
56
|
|
@@ -77,7 +77,7 @@ For more details on how to use Qiskit, refer to the documentation located here:
|
|
77
77
|
## Installation
|
78
78
|
|
79
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/
|
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
81
|
|
82
82
|
We encourage installing Qiskit via ``pip``:
|
83
83
|
|
@@ -87,7 +87,7 @@ pip install qiskit
|
|
87
87
|
|
88
88
|
Pip will handle all dependencies automatically and you will always install the latest (and well-tested) version.
|
89
89
|
|
90
|
-
To install from source, follow the instructions in the [documentation](https://docs.quantum.ibm.com/
|
90
|
+
To install from source, follow the instructions in the [documentation](https://docs.quantum.ibm.com/guides/install-qiskit-source).
|
91
91
|
|
92
92
|
## Create your first quantum program in Qiskit
|
93
93
|
|