qiskit 1.1.0__cp38-abi3-win32.whl → 1.1.0rc1__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.
- qiskit/VERSION.txt +1 -1
- qiskit/_accelerate.pyd +0 -0
- qiskit/assembler/__init__.py +10 -5
- qiskit/circuit/__init__.py +150 -17
- qiskit/circuit/_classical_resource_map.py +0 -3
- qiskit/circuit/classical/expr/__init__.py +1 -1
- qiskit/circuit/classical/types/__init__.py +4 -5
- qiskit/circuit/classicalfunction/__init__.py +0 -1
- qiskit/circuit/library/__init__.py +19 -3
- qiskit/circuit/quantumcircuit.py +151 -1065
- qiskit/converters/__init__.py +2 -17
- qiskit/passmanager/passmanager.py +11 -11
- qiskit/primitives/__init__.py +5 -11
- qiskit/primitives/containers/__init__.py +0 -1
- qiskit/primitives/containers/bit_array.py +0 -1
- qiskit/primitives/containers/shape.py +3 -3
- qiskit/providers/__init__.py +17 -49
- qiskit/providers/basic_provider/__init__.py +23 -2
- qiskit/providers/fake_provider/__init__.py +1 -1
- qiskit/providers/models/__init__.py +2 -2
- qiskit/qobj/converters/pulse_instruction.py +6 -6
- qiskit/qpy/__init__.py +60 -58
- qiskit/quantum_info/operators/symplectic/pauli.py +4 -7
- qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +3 -7
- qiskit/result/__init__.py +0 -6
- qiskit/scheduler/__init__.py +1 -10
- qiskit/scheduler/methods/__init__.py +8 -1
- qiskit/synthesis/__init__.py +6 -1
- qiskit/transpiler/passes/__init__.py +2 -4
- qiskit/transpiler/passes/basis/basis_translator.py +2 -2
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/commuting_2q_gate_router.py +1 -8
- qiskit/transpiler/passes/routing/star_prerouting.py +5 -5
- qiskit/utils/__init__.py +2 -3
- qiskit/utils/parallel.py +15 -24
- qiskit/visualization/gate_map.py +1 -9
- {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/METADATA +1 -1
- {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/RECORD +41 -41
- {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/LICENSE.txt +0 -0
- {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/WHEEL +0 -0
- {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/entry_points.txt +0 -0
- {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/top_level.txt +0 -0
qiskit/VERSION.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.0rc1
|
qiskit/_accelerate.pyd
CHANGED
Binary file
|
qiskit/assembler/__init__.py
CHANGED
@@ -17,18 +17,23 @@ Circuit and Schedule Assembler (:mod:`qiskit.assembler`)
|
|
17
17
|
|
18
18
|
.. currentmodule:: qiskit.assembler
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
Circuit Assembler
|
21
|
+
=================
|
23
22
|
|
24
23
|
.. autofunction:: assemble_circuits
|
25
24
|
|
25
|
+
Schedule Assembler
|
26
|
+
==================
|
27
|
+
|
26
28
|
.. autofunction:: assemble_schedules
|
27
29
|
|
30
|
+
Disassembler
|
31
|
+
============
|
32
|
+
|
28
33
|
.. autofunction:: disassemble
|
29
34
|
|
30
|
-
|
31
|
-
|
35
|
+
RunConfig
|
36
|
+
=========
|
32
37
|
|
33
38
|
.. autosummary::
|
34
39
|
:toctree: ../stubs/
|
qiskit/circuit/__init__.py
CHANGED
@@ -203,8 +203,8 @@ virtual qubit
|
|
203
203
|
|
204
204
|
.. _circuit-module-api:
|
205
205
|
|
206
|
-
API overview of qiskit.circuit
|
207
|
-
|
206
|
+
API overview of :mod:`qiskit.circuit`
|
207
|
+
=====================================
|
208
208
|
|
209
209
|
All objects here are described in more detail, and in their greater context in the following
|
210
210
|
sections. This section provides an overview of the API elements documented here.
|
@@ -321,6 +321,16 @@ an abstract circuit or a physical circuit. There is much more information about
|
|
321
321
|
:class:`QuantumCircuit` class itself and the multitude of available methods on it in its class
|
322
322
|
documentation.
|
323
323
|
|
324
|
+
..
|
325
|
+
TODO: the intention is to replace this `autosummary` directive with a proper entry in the API
|
326
|
+
toctree once the `QuantumCircuit` class-level documentation has been completely rewritten into
|
327
|
+
more of this style. For now, this just ensures it gets *any* page generated.
|
328
|
+
|
329
|
+
.. autosummary::
|
330
|
+
:toctree: ../stubs/
|
331
|
+
|
332
|
+
QuantumCircuit
|
333
|
+
|
324
334
|
Internally, a :class:`QuantumCircuit` contains the qubits, classical bits, compile-time parameters,
|
325
335
|
real-time variables, and other tracking information about the data it acts on and how it is
|
326
336
|
parametrized. It then contains a sequence of :class:`CircuitInstruction`\ s, which contain
|
@@ -380,7 +390,7 @@ hardware.
|
|
380
390
|
Circuits track registers, but registers themselves impart almost no behavioral differences on
|
381
391
|
circuits. The only exception is that :class:`ClassicalRegister`\ s can be implicitly cast to
|
382
392
|
unsigned integers for use in conditional comparisons of :ref:`control flow operations
|
383
|
-
<circuit-control-flow
|
393
|
+
<circuit-control-flow>`.
|
384
394
|
|
385
395
|
Classical registers and bits were the original way of representing classical data in Qiskit, and
|
386
396
|
remain the most supported currently. Longer term, the data model is moving towards a more complete
|
@@ -423,8 +433,6 @@ methods to perform post-append mutations on instructions (which *will* be propag
|
|
423
433
|
circuit), but these are now discouraged and you should use the alternatives noted in those methods.
|
424
434
|
|
425
435
|
|
426
|
-
.. _circuit-operations-instructions:
|
427
|
-
|
428
436
|
Operations, instructions and gates
|
429
437
|
----------------------------------
|
430
438
|
|
@@ -590,14 +598,17 @@ The :class:`Store` instruction is particularly special, in that it allows writin
|
|
590
598
|
Real-time classical computation
|
591
599
|
-------------------------------
|
592
600
|
|
593
|
-
..
|
594
|
-
:mod:`qiskit.circuit.classical`
|
595
|
-
Module-level documentation for how the variable-, expression- and type-systems work, the
|
596
|
-
objects used to represent them, and the classical operations available.
|
601
|
+
.. note::
|
597
602
|
|
598
|
-
|
599
|
-
|
600
|
-
|
603
|
+
The primary documentation for real-time classical computation is in the module-level
|
604
|
+
documentation of :mod:`qiskit.circuit.classical`.
|
605
|
+
|
606
|
+
You might also want to read about the circuit methods for working with real-time variables on
|
607
|
+
the :class:`QuantumCircuit` class page.
|
608
|
+
|
609
|
+
..
|
610
|
+
TODO: write a section in the QuantumCircuit-level guide about real-time-variable methods and
|
611
|
+
cross-ref to it.
|
601
612
|
|
602
613
|
Qiskit has rudimentary low-level support for representing real-time classical computations, which
|
603
614
|
happen during the QPU execution and affect the results. We are still relatively early into hardware
|
@@ -663,7 +674,7 @@ avoid you needing to come up with many names), you can use the convenience const
|
|
663
674
|
|
664
675
|
ParameterVector
|
665
676
|
|
666
|
-
.. _circuit-control-flow
|
677
|
+
.. _circuit-control-flow:
|
667
678
|
|
668
679
|
Control flow in circuits
|
669
680
|
------------------------
|
@@ -707,8 +718,11 @@ that affect the flow of control when within loops. These correspond to typical
|
|
707
718
|
The classes representations are documented here, but please note that manually constructing
|
708
719
|
these classes is a low-level operation that we do not expect users to need to do frequently.
|
709
720
|
|
710
|
-
|
711
|
-
|
721
|
+
..
|
722
|
+
TODO: make this below statement valid, and reinsert.
|
723
|
+
|
724
|
+
Users should read :ref:`circuit-creating-control-flow` for the recommended workflows for
|
725
|
+
building control-flow-enabled circuits.
|
712
726
|
|
713
727
|
Since :class:`ControlFlowOp` subclasses are also :class:`Instruction` subclasses, this means that
|
714
728
|
the way they are stored in :class:`CircuitInstruction` instances has them "applied" to a sequence of
|
@@ -758,8 +772,11 @@ them to the block using :meth:`~QuantumCircuit.add_capture` (or the ``captures``
|
|
758
772
|
argument), but user code will typically use the control-flow builder interface, which handles this
|
759
773
|
automatically.
|
760
774
|
|
761
|
-
|
762
|
-
|
775
|
+
..
|
776
|
+
TODO: make the below sentence valid, then re-insert.
|
777
|
+
|
778
|
+
Consult :ref:`the control-flow construction documentation <circuit-creating-control-flow>` for
|
779
|
+
more information on how to build circuits with control flow.
|
763
780
|
|
764
781
|
.. _circuit-custom-gates:
|
765
782
|
|
@@ -903,6 +920,122 @@ After this, for the duration of the Python interpreter session, translators like
|
|
903
920
|
Working with circuit-level objects
|
904
921
|
==================================
|
905
922
|
|
923
|
+
Circuit properties
|
924
|
+
------------------
|
925
|
+
|
926
|
+
..
|
927
|
+
TODO: rewrite this section and move it into the `QuantumCircuit` class-level overview of its
|
928
|
+
functions.
|
929
|
+
|
930
|
+
When constructing quantum circuits, there are several properties that help quantify
|
931
|
+
the "size" of the circuits, and their ability to be run on a noisy quantum device.
|
932
|
+
Some of these, like number of qubits, are straightforward to understand, while others
|
933
|
+
like depth and number of tensor components require a bit more explanation. Here we will
|
934
|
+
explain all of these properties, and, in preparation for understanding how circuits change
|
935
|
+
when run on actual devices, highlight the conditions under which they change.
|
936
|
+
|
937
|
+
Consider the following circuit:
|
938
|
+
|
939
|
+
.. plot::
|
940
|
+
:include-source:
|
941
|
+
|
942
|
+
from qiskit import QuantumCircuit
|
943
|
+
qc = QuantumCircuit(12)
|
944
|
+
for idx in range(5):
|
945
|
+
qc.h(idx)
|
946
|
+
qc.cx(idx, idx+5)
|
947
|
+
|
948
|
+
qc.cx(1, 7)
|
949
|
+
qc.x(8)
|
950
|
+
qc.cx(1, 9)
|
951
|
+
qc.x(7)
|
952
|
+
qc.cx(1, 11)
|
953
|
+
qc.swap(6, 11)
|
954
|
+
qc.swap(6, 9)
|
955
|
+
qc.swap(6, 10)
|
956
|
+
qc.x(6)
|
957
|
+
qc.draw('mpl')
|
958
|
+
|
959
|
+
From the plot, it is easy to see that this circuit has 12 qubits, and a collection of
|
960
|
+
Hadamard, CNOT, X, and SWAP gates. But how to quantify this programmatically? Because we
|
961
|
+
can do single-qubit gates on all the qubits simultaneously, the number of qubits in this
|
962
|
+
circuit is equal to the **width** of the circuit:
|
963
|
+
|
964
|
+
.. code-block::
|
965
|
+
|
966
|
+
qc.width()
|
967
|
+
|
968
|
+
.. parsed-literal::
|
969
|
+
|
970
|
+
12
|
971
|
+
|
972
|
+
We can also just get the number of qubits directly:
|
973
|
+
|
974
|
+
.. code-block::
|
975
|
+
|
976
|
+
qc.num_qubits
|
977
|
+
|
978
|
+
.. parsed-literal::
|
979
|
+
|
980
|
+
12
|
981
|
+
|
982
|
+
.. important::
|
983
|
+
|
984
|
+
For a quantum circuit composed from just qubits, the circuit width is equal
|
985
|
+
to the number of qubits. This is the definition used in quantum computing. However,
|
986
|
+
for more complicated circuits with classical registers, and classically controlled gates,
|
987
|
+
this equivalence breaks down. As such, from now on we will not refer to the number of
|
988
|
+
qubits in a quantum circuit as the width.
|
989
|
+
|
990
|
+
|
991
|
+
It is also straightforward to get the number and type of the gates in a circuit using
|
992
|
+
:meth:`QuantumCircuit.count_ops`:
|
993
|
+
|
994
|
+
.. code-block::
|
995
|
+
|
996
|
+
qc.count_ops()
|
997
|
+
|
998
|
+
.. parsed-literal::
|
999
|
+
|
1000
|
+
OrderedDict([('cx', 8), ('h', 5), ('x', 3), ('swap', 3)])
|
1001
|
+
|
1002
|
+
We can also get just the raw count of operations by computing the circuits
|
1003
|
+
:meth:`QuantumCircuit.size`:
|
1004
|
+
|
1005
|
+
.. code-block::
|
1006
|
+
|
1007
|
+
qc.size()
|
1008
|
+
|
1009
|
+
.. parsed-literal::
|
1010
|
+
|
1011
|
+
19
|
1012
|
+
|
1013
|
+
A particularly important circuit property is known as the circuit **depth**. The depth
|
1014
|
+
of a quantum circuit is a measure of how many "layers" of quantum gates, executed in
|
1015
|
+
parallel, it takes to complete the computation defined by the circuit. Because quantum
|
1016
|
+
gates take time to implement, the depth of a circuit roughly corresponds to the amount of
|
1017
|
+
time it takes the quantum computer to execute the circuit. Thus, the depth of a circuit
|
1018
|
+
is one important quantity used to measure if a quantum circuit can be run on a device.
|
1019
|
+
|
1020
|
+
The depth of a quantum circuit has a mathematical definition as the longest path in a
|
1021
|
+
directed acyclic graph (DAG). However, such a definition is a bit hard to grasp, even for
|
1022
|
+
experts. Fortunately, the depth of a circuit can be easily understood by anyone familiar
|
1023
|
+
with playing `Tetris <https://en.wikipedia.org/wiki/Tetris>`_. Lets see how to compute this
|
1024
|
+
graphically:
|
1025
|
+
|
1026
|
+
.. image:: /source_images/depth.gif
|
1027
|
+
|
1028
|
+
|
1029
|
+
We can verify our graphical result using :meth:`QuantumCircuit.depth`:
|
1030
|
+
|
1031
|
+
.. code-block::
|
1032
|
+
|
1033
|
+
qc.depth()
|
1034
|
+
|
1035
|
+
.. parsed-literal::
|
1036
|
+
|
1037
|
+
9
|
1038
|
+
|
906
1039
|
.. _circuit-abstract-to-physical:
|
907
1040
|
|
908
1041
|
Converting abstract circuits to physical circuits
|
@@ -143,6 +143,3 @@ class VariableMapper(expr.ExprVisitor[expr.Expr]):
|
|
143
143
|
|
144
144
|
def visit_cast(self, node, /):
|
145
145
|
return expr.Cast(node.operand.accept(self), node.type, implicit=node.implicit)
|
146
|
-
|
147
|
-
def visit_index(self, node, /):
|
148
|
-
return expr.Index(node.target.accept(self), node.index.accept(self), node.type)
|
@@ -43,7 +43,7 @@ The base for dynamic variables is the :class:`Var`, which can be either an arbit
|
|
43
43
|
real-time variable, or a wrapper around a :class:`.Clbit` or :class:`.ClassicalRegister`.
|
44
44
|
|
45
45
|
.. autoclass:: Var
|
46
|
-
:members: var, name
|
46
|
+
:members: var, name
|
47
47
|
|
48
48
|
Similarly, literals used in expressions (such as integers) should be lifted to :class:`Value` nodes
|
49
49
|
with associated types.
|
@@ -47,14 +47,13 @@ type, which may be slightly different to the 'classical' programming languages y
|
|
47
47
|
Working with types
|
48
48
|
==================
|
49
49
|
|
50
|
-
There are some
|
51
|
-
|
52
|
-
users who are building expressions using the
|
50
|
+
There are some functions on these types exposed here as well. These are mostly expected to be used
|
51
|
+
only in manipulations of the expression tree; users who are building expressions using the
|
53
52
|
:ref:`user-facing construction interface <circuit-classical-expressions-expr-construction>` should
|
54
53
|
not need to use these.
|
55
54
|
|
56
55
|
Partial ordering of types
|
57
|
-
|
56
|
+
-------------------------
|
58
57
|
|
59
58
|
The type system is equipped with a partial ordering, where :math:`a < b` is interpreted as
|
60
59
|
":math:`a` is a strict subtype of :math:`b`". Note that the partial ordering is a subset of the
|
@@ -79,7 +78,7 @@ Some helper methods are then defined in terms of this low-level :func:`order` pr
|
|
79
78
|
|
80
79
|
|
81
80
|
Casting between types
|
82
|
-
|
81
|
+
---------------------
|
83
82
|
|
84
83
|
It is common to need to cast values of one type to another type. The casting rules for this are
|
85
84
|
embedded into the :mod:`types` module. You can query the casting kinds using :func:`cast_kind`:
|
@@ -129,19 +129,35 @@ For example:
|
|
129
129
|
Standard Directives
|
130
130
|
===================
|
131
131
|
|
132
|
+
..
|
133
|
+
This summary table deliberately does not generate toctree entries; these directives are "owned"
|
134
|
+
by ``qiskit.circuit``.
|
135
|
+
|
132
136
|
Directives are operations to the quantum stack that are meant to be interpreted by the backend or
|
133
137
|
the transpiler. In general, the transpiler or backend might optionally ignore them if there is no
|
134
138
|
implementation for them.
|
135
139
|
|
136
|
-
|
140
|
+
..
|
141
|
+
This summary table deliberately does not generate toctree entries; these directives are "owned"
|
142
|
+
by ``qiskit.circuit``.
|
143
|
+
|
144
|
+
.. autosummary::
|
145
|
+
|
146
|
+
Barrier
|
137
147
|
|
138
148
|
Standard Operations
|
139
149
|
===================
|
140
150
|
|
141
151
|
Operations are non-reversible changes in the quantum state of the circuit.
|
142
152
|
|
143
|
-
|
144
|
-
|
153
|
+
..
|
154
|
+
This summary table deliberately does not generate toctree entries; these directives are "owned"
|
155
|
+
by ``qiskit.circuit``.
|
156
|
+
|
157
|
+
.. autosummary::
|
158
|
+
|
159
|
+
Measure
|
160
|
+
Reset
|
145
161
|
|
146
162
|
Generalized Gates
|
147
163
|
=================
|