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/converters/__init__.py
CHANGED
@@ -17,27 +17,12 @@ Circuit Converters (:mod:`qiskit.converters`)
|
|
17
17
|
|
18
18
|
.. currentmodule:: qiskit.converters
|
19
19
|
|
20
|
-
QuantumCircuit -> circuit components
|
21
|
-
====================================
|
22
|
-
|
23
|
-
.. autofunction:: circuit_to_instruction
|
24
|
-
.. autofunction:: circuit_to_gate
|
25
|
-
|
26
|
-
QuantumCircuit <-> DagCircuit
|
27
|
-
=============================
|
28
|
-
|
29
20
|
.. autofunction:: circuit_to_dag
|
30
21
|
.. autofunction:: dag_to_circuit
|
31
|
-
|
32
|
-
|
33
|
-
================================
|
34
|
-
|
22
|
+
.. autofunction:: circuit_to_instruction
|
23
|
+
.. autofunction:: circuit_to_gate
|
35
24
|
.. autofunction:: dagdependency_to_circuit
|
36
25
|
.. autofunction:: circuit_to_dagdependency
|
37
|
-
|
38
|
-
DagCircuit <-> DagDependency
|
39
|
-
============================
|
40
|
-
|
41
26
|
.. autofunction:: dag_to_dagdependency
|
42
27
|
.. autofunction:: dagdependency_to_dag
|
43
28
|
"""
|
@@ -21,7 +21,7 @@ from typing import Any
|
|
21
21
|
|
22
22
|
import dill
|
23
23
|
|
24
|
-
from qiskit.utils.parallel import parallel_map
|
24
|
+
from qiskit.utils.parallel import parallel_map
|
25
25
|
from .base_tasks import Task, PassManagerIR
|
26
26
|
from .exceptions import PassManagerError
|
27
27
|
from .flow_controllers import FlowControllerLinear
|
@@ -225,16 +225,16 @@ class BasePassManager(ABC):
|
|
225
225
|
in_programs = [in_programs]
|
226
226
|
is_list = False
|
227
227
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
if
|
236
|
-
return
|
237
|
-
return
|
228
|
+
if len(in_programs) == 1:
|
229
|
+
out_program = _run_workflow(
|
230
|
+
program=in_programs[0],
|
231
|
+
pass_manager=self,
|
232
|
+
callback=callback,
|
233
|
+
**kwargs,
|
234
|
+
)
|
235
|
+
if is_list:
|
236
|
+
return [out_program]
|
237
|
+
return out_program
|
238
238
|
|
239
239
|
del callback
|
240
240
|
del kwargs
|
qiskit/primitives/__init__.py
CHANGED
@@ -51,7 +51,7 @@ define a computation unit of work for the estimator to complete:
|
|
51
51
|
* a collection parameter value sets to bind the circuit against, :math:`\theta_k`.
|
52
52
|
|
53
53
|
Running an estimator returns a :class:`~qiskit.primitives.BasePrimitiveJob` object, where calling
|
54
|
-
the method :meth:`~qiskit.primitives.BasePrimitiveJob.result` results in expectation value estimates
|
54
|
+
the method :meth:`~qiskit.primitives.BasePrimitiveJob.result` results in expectation value estimates
|
55
55
|
and metadata for each pub:
|
56
56
|
|
57
57
|
.. math::
|
@@ -95,7 +95,7 @@ Here is an example of how an estimator is used.
|
|
95
95
|
# [<psi2(theta2)|H2|psi2(theta2)>] ]
|
96
96
|
job2 = estimator.run(
|
97
97
|
[
|
98
|
-
(psi1, [H1, H3], [theta1, theta3]),
|
98
|
+
(psi1, [H1, H3], [theta1, theta3]),
|
99
99
|
(psi2, H2, theta2)
|
100
100
|
],
|
101
101
|
precision=0.01
|
@@ -103,7 +103,7 @@ Here is an example of how an estimator is used.
|
|
103
103
|
job_result = job2.result()
|
104
104
|
print(f"The primitive-job finished with result {job_result}")
|
105
105
|
|
106
|
-
|
106
|
+
|
107
107
|
Overview of SamplerV2
|
108
108
|
=====================
|
109
109
|
|
@@ -220,8 +220,8 @@ Here is an example of how the estimator is used.
|
|
220
220
|
# <psi2(theta2)|H2|psi2(theta2)>,
|
221
221
|
# <psi1(theta3)|H3|psi1(theta3)> ]
|
222
222
|
job2 = estimator.run(
|
223
|
-
[psi1, psi2, psi1],
|
224
|
-
[H1, H2, H3],
|
223
|
+
[psi1, psi2, psi1],
|
224
|
+
[H1, H2, H3],
|
225
225
|
[theta1, theta2, theta3]
|
226
226
|
)
|
227
227
|
job_result = job2.result()
|
@@ -417,10 +417,8 @@ Results V2
|
|
417
417
|
DataBin
|
418
418
|
PrimitiveResult
|
419
419
|
PubResult
|
420
|
-
SamplerPubResult
|
421
420
|
BasePrimitiveJob
|
422
421
|
PrimitiveJob
|
423
|
-
Shaped
|
424
422
|
|
425
423
|
Estimator V1
|
426
424
|
------------
|
@@ -466,16 +464,12 @@ from .containers import (
|
|
466
464
|
DataBin,
|
467
465
|
PrimitiveResult,
|
468
466
|
PubResult,
|
469
|
-
SamplerPubResult,
|
470
467
|
EstimatorPubLike,
|
471
468
|
SamplerPubLike,
|
472
469
|
BindingsArrayLike,
|
473
470
|
ObservableLike,
|
474
471
|
ObservablesArrayLike,
|
475
|
-
Shaped,
|
476
472
|
)
|
477
|
-
|
478
|
-
|
479
473
|
from .estimator import Estimator
|
480
474
|
from .primitive_job import BasePrimitiveJob, PrimitiveJob
|
481
475
|
from .sampler import Sampler
|
@@ -130,7 +130,6 @@ class BitArray(ShapedMixin):
|
|
130
130
|
return f"BitArray({desc})"
|
131
131
|
|
132
132
|
def __getitem__(self, indices):
|
133
|
-
"""Slices the array along an existing axis of the array."""
|
134
133
|
if isinstance(indices, tuple) and len(indices) >= self.ndim + 2:
|
135
134
|
raise ValueError(
|
136
135
|
"BitArrays cannot be sliced along the bits axis, see slice_bits() instead."
|
@@ -59,15 +59,15 @@ class ShapedMixin(Shaped):
|
|
59
59
|
return f"{type(self).__name__}(<{self.shape}>)"
|
60
60
|
|
61
61
|
@property
|
62
|
-
def shape(self)
|
62
|
+
def shape(self):
|
63
63
|
return self._shape
|
64
64
|
|
65
65
|
@property
|
66
|
-
def ndim(self)
|
66
|
+
def ndim(self):
|
67
67
|
return len(self._shape)
|
68
68
|
|
69
69
|
@property
|
70
|
-
def size(self)
|
70
|
+
def size(self):
|
71
71
|
return int(np.prod(self._shape, dtype=int))
|
72
72
|
|
73
73
|
|
qiskit/providers/__init__.py
CHANGED
@@ -131,6 +131,7 @@ Exceptions
|
|
131
131
|
.. autoexception:: JobTimeoutError
|
132
132
|
.. autoexception:: BackendConfigurationError
|
133
133
|
|
134
|
+
=====================
|
134
135
|
Writing a New Backend
|
135
136
|
=====================
|
136
137
|
|
@@ -163,7 +164,7 @@ For a simple example of a provider, see the
|
|
163
164
|
`qiskit-aqt-provider <https://github.com/Qiskit-Partners/qiskit-aqt-provider>`__
|
164
165
|
|
165
166
|
Provider
|
166
|
-
|
167
|
+
========
|
167
168
|
|
168
169
|
A provider class serves a single purpose: to get backend objects that enable
|
169
170
|
executing circuits on a device or simulator. The expectation is that any
|
@@ -194,7 +195,7 @@ authentication (if required) are present in the class and that the backends
|
|
194
195
|
method matches the required interface. The rest is up to the specific provider on how to implement.
|
195
196
|
|
196
197
|
Backend
|
197
|
-
|
198
|
+
=======
|
198
199
|
|
199
200
|
The backend classes are the core to the provider. These classes are what
|
200
201
|
provide the interface between Qiskit and the hardware or simulator that will
|
@@ -275,8 +276,8 @@ example would be something like::
|
|
275
276
|
return MyJob(self. job_handle, job_json, circuit)
|
276
277
|
|
277
278
|
|
278
|
-
|
279
|
-
|
279
|
+
Transpiler Interface
|
280
|
+
--------------------
|
280
281
|
|
281
282
|
The key piece of the :class:`~qiskit.providers.Backend` object is how it describes itself to the
|
282
283
|
compiler. This is handled with the :class:`~qiskit.transpiler.Target` class which defines
|
@@ -452,45 +453,8 @@ This way if these two compilation steps are **required** for running or providin
|
|
452
453
|
efficient output on ``Mybackend`` the transpiler will be able to perform these
|
453
454
|
custom steps without any manual user input.
|
454
455
|
|
455
|
-
|
456
|
-
|
457
|
-
Real-time variables
|
458
|
-
^^^^^^^^^^^^^^^^^^^
|
459
|
-
|
460
|
-
The transpiler will automatically handle real-time typed classical variables (see
|
461
|
-
:mod:`qiskit.circuit.classical`) and treat the :class:`.Store` instruction as a built-in
|
462
|
-
"directive", similar to :class:`.Barrier`. No special handling from backends is necessary to permit
|
463
|
-
this.
|
464
|
-
|
465
|
-
If your backend is *unable* to handle classical variables and storage, we recommend that you comment
|
466
|
-
on this in your documentation, and insert a check into your :meth:`~.BackendV2.run` method (see
|
467
|
-
:ref:`providers-guide-backend-run`) to eagerly reject circuits containing them. You can examine
|
468
|
-
:attr:`.QuantumCircuit.num_vars` for the presence of variables at the top level. If you accept
|
469
|
-
:ref:`control-flow operations <circuit-control-flow-repr>`, you might need to recursively search the
|
470
|
-
internal :attr:`~.ControlFlowOp.blocks` of each for scope-local variables with
|
471
|
-
:attr:`.QuantumCircuit.num_declared_vars`.
|
472
|
-
|
473
|
-
For example, a function to check for the presence of any manual storage locations, or manual stores
|
474
|
-
to memory::
|
475
|
-
|
476
|
-
from qiskit.circuit import Store, ControlFlowOp, QuantumCircuit
|
477
|
-
|
478
|
-
def has_realtime_logic(circuit: QuantumCircuit) -> bool:
|
479
|
-
if circuit.num_vars:
|
480
|
-
return True
|
481
|
-
for instruction in circuit.data:
|
482
|
-
if isinstance(instruction.operation, Store):
|
483
|
-
return True
|
484
|
-
elif isinstance(instruction.operation, ControlFlowOp):
|
485
|
-
for block in instruction.operation.blocks:
|
486
|
-
if has_realtime_logic(block):
|
487
|
-
return True
|
488
|
-
return False
|
489
|
-
|
490
|
-
.. _providers-guide-backend-run:
|
491
|
-
|
492
|
-
Backend.run Method
|
493
|
-
------------------
|
456
|
+
Run Method
|
457
|
+
----------
|
494
458
|
|
495
459
|
Of key importance is the :meth:`~qiskit.providers.BackendV2.run` method, which
|
496
460
|
is used to actually submit circuits to a device or simulator. The run method
|
@@ -520,8 +484,8 @@ An example run method would be something like::
|
|
520
484
|
job_handle = submit_to_backend(job_jsonb)
|
521
485
|
return MyJob(self. job_handle, job_json, circuit)
|
522
486
|
|
523
|
-
|
524
|
-
|
487
|
+
Options
|
488
|
+
-------
|
525
489
|
|
526
490
|
There are often several options for a backend that control how a circuit is run.
|
527
491
|
The typical example of this is something like the number of ``shots`` which is
|
@@ -551,7 +515,7 @@ for a full list of validation options.
|
|
551
515
|
|
552
516
|
|
553
517
|
Job
|
554
|
-
|
518
|
+
===
|
555
519
|
|
556
520
|
The output from the :obj:`~qiskit.providers.BackendV2.run` method is a :class:`~qiskit.providers.JobV1`
|
557
521
|
object. Each provider is expected to implement a custom job subclass that
|
@@ -648,7 +612,7 @@ and for a sync job::
|
|
648
612
|
return JobStatus.DONE
|
649
613
|
|
650
614
|
Primitives
|
651
|
-
|
615
|
+
==========
|
652
616
|
|
653
617
|
While not directly part of the provider interface, the :mod:`qiskit.primitives`
|
654
618
|
module is tightly coupled with providers. Specifically the primitive
|
@@ -676,8 +640,12 @@ implementations. Also the built-in implementations: :class:`~.Sampler`,
|
|
676
640
|
:class:`~.Estimator`, :class:`~.BackendSampler`, and :class:`~.BackendEstimator`
|
677
641
|
can serve as references/models on how to implement these as well.
|
678
642
|
|
679
|
-
|
680
|
-
|
643
|
+
======================================
|
644
|
+
Migrating between Backend API Versions
|
645
|
+
======================================
|
646
|
+
|
647
|
+
BackendV1 -> BackendV2
|
648
|
+
======================
|
681
649
|
|
682
650
|
The :obj:`~BackendV2` class re-defined user access for most properties of a
|
683
651
|
backend to make them work with native Qiskit data structures and have flatter
|
@@ -27,15 +27,36 @@ via the `BasicProvider` provider, e.g.:
|
|
27
27
|
backend = BasicProvider().get_backend('basic_simulator')
|
28
28
|
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
Simulators
|
31
|
+
==========
|
32
32
|
|
33
33
|
.. autosummary::
|
34
34
|
:toctree: ../stubs/
|
35
35
|
|
36
36
|
BasicSimulator
|
37
|
+
|
38
|
+
Provider
|
39
|
+
========
|
40
|
+
|
41
|
+
.. autosummary::
|
42
|
+
:toctree: ../stubs/
|
43
|
+
|
37
44
|
BasicProvider
|
45
|
+
|
46
|
+
Job Class
|
47
|
+
=========
|
48
|
+
|
49
|
+
.. autosummary::
|
50
|
+
:toctree: ../stubs/
|
51
|
+
|
38
52
|
BasicProviderJob
|
53
|
+
|
54
|
+
Exceptions
|
55
|
+
==========
|
56
|
+
|
57
|
+
.. autosummary::
|
58
|
+
:toctree: ../stubs/
|
59
|
+
|
39
60
|
BasicProviderError
|
40
61
|
"""
|
41
62
|
|
@@ -24,7 +24,7 @@ The fake provider module in Qiskit contains fake (simulated) backend classes
|
|
24
24
|
useful for testing the transpiler and other backend-facing functionality.
|
25
25
|
|
26
26
|
Example Usage
|
27
|
-
|
27
|
+
=============
|
28
28
|
|
29
29
|
Here is an example of using a simulated backend for transpilation and running.
|
30
30
|
|
@@ -234,7 +234,7 @@ class InstructionToQobjConverter:
|
|
234
234
|
"name": "setf",
|
235
235
|
"t0": time_offset + instruction.start_time,
|
236
236
|
"ch": instruction.channel.name,
|
237
|
-
"frequency": instruction.frequency /
|
237
|
+
"frequency": instruction.frequency / 1e9,
|
238
238
|
}
|
239
239
|
return self._qobj_model(**command_dict)
|
240
240
|
|
@@ -257,7 +257,7 @@ class InstructionToQobjConverter:
|
|
257
257
|
"name": "shiftf",
|
258
258
|
"t0": time_offset + instruction.start_time,
|
259
259
|
"ch": instruction.channel.name,
|
260
|
-
"frequency": instruction.frequency /
|
260
|
+
"frequency": instruction.frequency / 1e9,
|
261
261
|
}
|
262
262
|
return self._qobj_model(**command_dict)
|
263
263
|
|
@@ -746,7 +746,7 @@ class QobjToInstructionConverter:
|
|
746
746
|
.. note::
|
747
747
|
|
748
748
|
We assume frequency value is expressed in string with "GHz".
|
749
|
-
Operand value is thus scaled by a factor of
|
749
|
+
Operand value is thus scaled by a factor of 1e9.
|
750
750
|
|
751
751
|
Args:
|
752
752
|
instruction: SetFrequency qobj instruction
|
@@ -755,7 +755,7 @@ class QobjToInstructionConverter:
|
|
755
755
|
Qiskit Pulse set frequency instructions
|
756
756
|
"""
|
757
757
|
channel = self.get_channel(instruction.ch)
|
758
|
-
frequency = self.disassemble_value(instruction.frequency) *
|
758
|
+
frequency = self.disassemble_value(instruction.frequency) * 1e9
|
759
759
|
|
760
760
|
yield instructions.SetFrequency(frequency, channel)
|
761
761
|
|
@@ -768,7 +768,7 @@ class QobjToInstructionConverter:
|
|
768
768
|
.. note::
|
769
769
|
|
770
770
|
We assume frequency value is expressed in string with "GHz".
|
771
|
-
Operand value is thus scaled by a factor of
|
771
|
+
Operand value is thus scaled by a factor of 1e9.
|
772
772
|
|
773
773
|
Args:
|
774
774
|
instruction: ShiftFrequency qobj instruction
|
@@ -777,7 +777,7 @@ class QobjToInstructionConverter:
|
|
777
777
|
Qiskit Pulse shift frequency schedule instructions
|
778
778
|
"""
|
779
779
|
channel = self.get_channel(instruction.ch)
|
780
|
-
frequency = self.disassemble_value(instruction.frequency) *
|
780
|
+
frequency = self.disassemble_value(instruction.frequency) * 1e9
|
781
781
|
|
782
782
|
yield instructions.ShiftFrequency(frequency, channel)
|
783
783
|
|