qiskit 1.2.0rc1__cp38-abi3-win32.whl → 1.2.1__cp38-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 (50) hide show
  1. qiskit/VERSION.txt +1 -1
  2. qiskit/_accelerate.pyd +0 -0
  3. qiskit/circuit/__init__.py +15 -2
  4. qiskit/circuit/library/basis_change/qft.py +3 -1
  5. qiskit/circuit/library/data_preparation/initializer.py +5 -2
  6. qiskit/circuit/library/data_preparation/state_preparation.py +2 -2
  7. qiskit/circuit/library/standard_gates/__init__.py +32 -25
  8. qiskit/circuit/quantumcircuit.py +43 -18
  9. qiskit/compiler/transpiler.py +1 -1
  10. qiskit/providers/basic_provider/basic_simulator.py +1 -1
  11. qiskit/providers/fake_provider/fake_openpulse_2q.py +3 -3
  12. qiskit/providers/fake_provider/fake_openpulse_3q.py +2 -3
  13. qiskit/providers/fake_provider/fake_pulse_backend.py +2 -1
  14. qiskit/providers/fake_provider/fake_qasm_backend.py +2 -1
  15. qiskit/providers/fake_provider/generic_backend_v2.py +434 -18
  16. qiskit/providers/models/__init__.py +47 -21
  17. qiskit/pulse/library/symbolic_pulses.py +4 -3
  18. qiskit/qasm3/exporter.py +7 -1
  19. qiskit/qpy/__init__.py +1 -1
  20. qiskit/quantum_info/operators/operator.py +24 -0
  21. qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +1 -1
  22. qiskit/synthesis/clifford/clifford_decompose_bm.py +1 -1
  23. qiskit/synthesis/clifford/clifford_decompose_greedy.py +1 -1
  24. qiskit/synthesis/linear/cnot_synth.py +1 -1
  25. qiskit/synthesis/one_qubit/one_qubit_decompose.py +2 -1
  26. qiskit/synthesis/permutation/permutation_full.py +2 -2
  27. qiskit/synthesis/permutation/permutation_lnn.py +3 -1
  28. qiskit/synthesis/two_qubit/two_qubit_decompose.py +2 -2
  29. qiskit/transpiler/instruction_durations.py +4 -0
  30. qiskit/transpiler/passes/__init__.py +2 -0
  31. qiskit/transpiler/passes/basis/basis_translator.py +2 -1
  32. qiskit/transpiler/passes/optimization/__init__.py +1 -0
  33. qiskit/transpiler/passes/optimization/consolidate_blocks.py +7 -1
  34. qiskit/transpiler/passes/optimization/hoare_opt.py +12 -8
  35. qiskit/transpiler/passes/optimization/split_2q_unitaries.py +16 -20
  36. qiskit/transpiler/passes/scheduling/alignments/pulse_gate_validation.py +1 -1
  37. qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +9 -3
  38. qiskit/transpiler/passes/synthesis/unitary_synthesis.py +1 -1
  39. qiskit/transpiler/preset_passmanagers/builtin_plugins.py +10 -54
  40. qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +9 -0
  41. qiskit/utils/optionals.py +173 -150
  42. qiskit/visualization/bloch.py +44 -1
  43. qiskit/visualization/dag_visualization.py +10 -3
  44. qiskit/visualization/gate_map.py +28 -6
  45. {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/METADATA +20 -20
  46. {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/RECORD +50 -50
  47. {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/WHEEL +1 -1
  48. {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/LICENSE.txt +0 -0
  49. {qiskit-1.2.0rc1.dist-info → qiskit-1.2.1.dist-info}/entry_points.txt +0 -0
  50. {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
- .. list-table::
29
- :widths: 25 75
28
+ .. py:data:: HAS_AER
30
29
 
31
- * - .. py:data:: HAS_AER
32
- - `Qiskit Aer <https://qiskit.github.io/qiskit-aer/>` provides high-performance simulators for
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
- * - .. py:data:: HAS_IBMQ
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
- * - .. py:data:: HAS_IGNIS
40
- - :mod:`Qiskit Ignis <qiskit.ignis>` provides tools for quantum hardware verification, noise
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
- * - .. py:data:: HAS_TOQM
44
- - `Qiskit TOQM <https://github.com/qiskit-toqm/qiskit-toqm>`__ provides transpiler passes
45
- for the `Time-optimal Qubit mapping algorithm <https://doi.org/10.1145/3445814.3446706>`__.
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
- .. list-table::
52
- :widths: 25 75
53
-
54
- * - .. py:data:: HAS_CONSTRAINT
55
- - `python-constraint <https://github.com/python-constraint/python-constraint>`__ is a
56
- constraint satisfaction problem solver, used in the :class:`~.CSPLayout` transpiler pass.
57
-
58
- * - .. py:data:: HAS_CPLEX
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
- - `CVXPY <https://www.cvxpy.org/>`__ is a Python package for solving convex optimization
66
- problems. It is required for calculating diamond norms with
67
- :func:`.quantum_info.diamond_norm`.
68
-
69
- * - .. py:data:: HAS_DOCPLEX
70
- - `IBM Decision Optimization CPLEX Modelling
71
- <http://ibmdecisionoptimization.github.io/docplex-doc/>`__ is a library for prescriptive
72
- analysis. Like CPLEX, this is no longer by Qiskit, but it weas historically and the
73
- optional remains for backwards compatibility.
74
-
75
- * - .. py:data:: HAS_FIXTURES
76
- - The test suite has additional features that are available if the optional `fixtures
77
- <https://launchpad.net/python-fixtures>`__ module is installed. This generally also needs
78
- :data:`HAS_TESTTOOLS` as well. This is generally only needed for Qiskit developers.
79
-
80
- * - .. py:data:: HAS_IPYTHON
81
- - If `the IPython kernel <https://ipython.org/>`__ is available, certain additional
82
- visualizations and line magics are made available.
83
-
84
- * - .. py:data:: HAS_IPYWIDGETS
85
- - Monitoring widgets for jobs running on external backends can be provided if `ipywidgets
86
- <https://ipywidgets.readthedocs.io/en/latest/>`__ is available.
87
-
88
- * - .. py:data:: HAS_JAX
89
- - Some methods of gradient calculation within :mod:`.opflow.gradients` require `JAX
90
- <https://github.com/google/jax>`__ for autodifferentiation.
91
-
92
- * - .. py:data:: HAS_JUPYTER
93
- - Some of the tests require a complete `Jupyter <https://jupyter.org/>`__ installation to test
94
- interactivity features.
95
-
96
- * - .. py:data:: HAS_MATPLOTLIB
97
- - Qiskit provides several visualization tools in the :mod:`.visualization` module.
98
- Almost all of these are built using `Matplotlib <https://matplotlib.org/>`__, which must
99
- be installed in order to use them.
100
-
101
- * - .. py:data:: HAS_NETWORKX
102
- - No longer used by Qiskit. Internally, Qiskit now uses the high-performance `rustworkx
103
- <https://github.com/Qiskit/rustworkx>`__ library as a core dependency, and during the
104
- change-over period, it was sometimes convenient to convert things into the Python-only
105
- `NetworkX <https://networkx.org/>`__ format. Some tests of application modules, such as
106
- `Qiskit Nature <https://qiskit-community.github.io/qiskit-nature/>`__ still use NetworkX.
107
-
108
- * - .. py:data:: HAS_NLOPT
109
- - `NLopt <https://nlopt.readthedocs.io/en/latest/>`__ is a nonlinear optimization library,
110
- used by the global optimizers in the :mod:`.algorithms.optimizers` module.
111
-
112
- * - .. py:data:: HAS_PIL
113
- - PIL is a Python image-manipulation library. Qiskit actually uses the `pillow
114
- <https://pillow.readthedocs.io/en/stable/>`__ fork of PIL if it is available when generating
115
- certain visualizations, for example of both :class:`.QuantumCircuit` and
116
- :class:`.DAGCircuit` in certain modes.
117
-
118
- * - .. py:data:: HAS_PYDOT
119
- - For some graph visualizations, Qiskit uses `pydot <https://github.com/pydot/pydot>`__ as an
120
- interface to GraphViz (see :data:`HAS_GRAPHVIZ`).
121
-
122
- * - .. py:data:: HAS_PYGMENTS
123
- - Pygments is a code highlighter and formatter used by many environments that involve rich
124
- display of code blocks, including Sphinx and Jupyter. Qiskit uses this when producing rich
125
- output for these environments.
126
-
127
- * - .. py:data:: HAS_PYLATEX
128
- - Various LaTeX-based visualizations, especially the circuit drawers, need access to the
129
- `pylatexenc <https://github.com/phfaist/pylatexenc>`__ project to work correctly.
130
-
131
- * - .. py:data:: HAS_QASM3_IMPORT
132
- - The functions :func:`.qasm3.load` and :func:`.qasm3.loads` for importing OpenQASM 3 programs
133
- into :class:`.QuantumCircuit` instances use `an external importer package
134
- <https://qiskit.github.io/qiskit-qasm3-import>`__.
135
-
136
- * - .. py:data:: HAS_SEABORN
137
- - Qiskit provides several visualization tools in the :mod:`.visualization` module. Some
138
- of these are built using `Seaborn <https://seaborn.pydata.org/>`__, which must be installed
139
- in order to use them.
140
-
141
- * - .. py:data:: HAS_SKLEARN
142
- - Some of the gradient functions in :mod:`.opflow.gradients` use regularisation methods from
143
- `Scikit Learn <https://scikit-learn.org/stable/>`__.
144
-
145
- * - .. py:data:: HAS_SKQUANT
146
- - Some of the optimisers in :mod:`.algorithms.optimizers` are based on those found in `Scikit
147
- Quant <https://github.com/scikit-quant/scikit-quant>`__, which must be installed to use
148
- them.
149
-
150
- * - .. py:data:: HAS_SQSNOBFIT
151
- - `SQSnobFit <https://pypi.org/project/SQSnobFit/>`__ is a library for the "stable noisy
152
- optimization by branch and fit" algorithm. It is used by the :class:`.SNOBFIT` optimizer.
153
-
154
- * - .. py:data:: HAS_SYMENGINE
155
- - `Symengine <https://github.com/symengine/symengine>`__ is a fast C++ backend for the
156
- symbolic-manipulation library `Sympy <https://www.sympy.org/en/index.html>`__. Qiskit uses
157
- special methods from Symengine to accelerate its handling of
158
- :class:`~.circuit.Parameter`\\ s if available.
159
-
160
- * - .. py:data:: HAS_TESTTOOLS
161
- - Qiskit's test suite has more advanced functionality available if the optional
162
- `testtools <https://pypi.org/project/testtools/>`__ library is installed. This is generally
163
- only needed for Qiskit developers.
164
-
165
- * - .. py:data:: HAS_TWEEDLEDUM
166
- - `Tweedledum <https://github.com/boschmitt/tweedledum>`__ is an extension library for
167
- synthesis and optimization of circuits that may involve classical oracles. Qiskit's
168
- :class:`.PhaseOracle` uses this, which is used in turn by amplification algorithms via
169
- the :class:`.AmplificationProblem`.
170
-
171
- * - .. py:data:: HAS_Z3
172
- - `Z3 <https://github.com/Z3Prover/z3>`__ is a theorem prover, used in the
173
- :class:`.CrosstalkAdaptiveSchedule` and :class:`.HoareOptimizer` transpiler passes.
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
- .. list-table::
179
- :widths: 25 75
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
- * - .. py:data:: HAS_GRAPHVIZ
182
- - For some graph visualizations, Qiskit uses the `GraphViz <https://graphviz.org/>`__
183
- visualization tool via its ``pydot`` interface (see :data:`HAS_PYDOT`).
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
- * - .. py:data:: HAS_PDFLATEX
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
- * - .. py:data:: HAS_PDFTOCAIRO
191
- - Visualization tools that convert LaTeX-generated files into rasterized images use the
192
- ``pdftocairo`` tool. This is part of the `Poppler suite of PDF tools
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
@@ -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
- if tuple(int(x) for x in matplotlib.__version__.split(".")) >= (3, 4, 0):
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
- else:
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
- else:
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
- else:
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
 
@@ -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
- font_size = max(int(20 / max_characters), 1)
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.0rc1
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 >=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
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 >=0.11
39
+ Requires-Dist: symengine>=0.11
40
40
  Provides-Extra: all
41
- Requires-Dist: qiskit[crosstalk-pass,csp-layout-pass,qasm3-import,visualization] ; extra == 'all'
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 >=4.7 ; extra == 'crosstalk-pass'
43
+ Requires-Dist: z3-solver>=4.7; extra == "crosstalk-pass"
44
44
  Provides-Extra: csp-layout-pass
45
- Requires-Dist: python-constraint >=1.4 ; extra == 'csp-layout-pass'
45
+ Requires-Dist: python-constraint>=1.4; extra == "csp-layout-pass"
46
46
  Provides-Extra: qasm3-import
47
- Requires-Dist: qiskit-qasm3-import >=0.1.0 ; extra == 'qasm3-import'
47
+ Requires-Dist: qiskit-qasm3-import>=0.1.0; extra == "qasm3-import"
48
48
  Provides-Extra: visualization
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'
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/api/migration-guides/qiskit-1.0-installation).
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/start/install-qiskit-source).
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