qiskit 1.3.3__cp39-abi3-win32.whl → 1.4.1__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/__init__.py +1 -0
- qiskit/_accelerate.pyd +0 -0
- qiskit/circuit/bit.py +12 -0
- qiskit/circuit/classicalfunction/__init__.py +13 -1
- qiskit/circuit/classicalfunction/boolean_expression.py +10 -1
- qiskit/circuit/classicalfunction/classicalfunction.py +10 -1
- qiskit/circuit/classicalfunction/exceptions.py +7 -1
- qiskit/circuit/instruction.py +8 -2
- qiskit/circuit/library/generalized_gates/mcmt.py +5 -6
- qiskit/circuit/library/phase_oracle.py +24 -17
- qiskit/circuit/quantumcircuit.py +64 -1
- qiskit/circuit/register.py +13 -0
- qiskit/compiler/assembler.py +16 -8
- qiskit/dagcircuit/dagdependency_v2.py +4 -2
- qiskit/passmanager/passmanager.py +19 -1
- qiskit/primitives/backend_estimator_v2.py +17 -0
- qiskit/primitives/backend_sampler_v2.py +15 -0
- qiskit/providers/backend_compat.py +46 -11
- qiskit/providers/basic_provider/basic_simulator.py +15 -3
- qiskit/providers/exceptions.py +23 -2
- qiskit/providers/models/backendproperties.py +19 -1
- qiskit/providers/models/backendstatus.py +10 -0
- qiskit/providers/models/jobstatus.py +11 -0
- qiskit/pulse/schedule.py +1 -1
- qiskit/pulse/utils.py +1 -1
- qiskit/qpy/binary_io/value.py +14 -0
- qiskit/result/result.py +109 -20
- qiskit/synthesis/evolution/product_formula.py +1 -2
- qiskit/synthesis/evolution/qdrift.py +1 -2
- qiskit/synthesis/evolution/suzuki_trotter.py +1 -2
- qiskit/transpiler/passes/calibration/rzx_templates.py +7 -0
- qiskit/transpiler/passes/layout/apply_layout.py +1 -0
- qiskit/transpiler/passes/layout/dense_layout.py +12 -0
- qiskit/transpiler/passes/layout/vf2_layout.py +11 -0
- qiskit/transpiler/passes/layout/vf2_post_layout.py +22 -0
- qiskit/transpiler/passes/optimization/normalize_rx_angle.py +8 -0
- qiskit/transpiler/passes/routing/star_prerouting.py +17 -2
- qiskit/transpiler/passes/synthesis/unitary_synthesis.py +11 -0
- qiskit/transpiler/passmanager_config.py +11 -0
- qiskit/transpiler/preset_passmanagers/builtin_plugins.py +188 -118
- qiskit/transpiler/preset_passmanagers/common.py +133 -83
- qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +29 -3
- qiskit/transpiler/target.py +41 -9
- qiskit/visualization/gate_map.py +50 -0
- qiskit/visualization/pulse_v2/interface.py +0 -2
- qiskit/visualization/timeline/core.py +9 -0
- qiskit/visualization/timeline/interface.py +7 -3
- {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/METADATA +1 -1
- {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/RECORD +54 -54
- {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/WHEEL +1 -1
- {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/LICENSE.txt +0 -0
- {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/entry_points.txt +0 -0
- {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/top_level.txt +0 -0
qiskit/VERSION.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.1
|
qiskit/__init__.py
CHANGED
@@ -110,6 +110,7 @@ sys.modules["qiskit._accelerate.filter_op_nodes"] = _accelerate.filter_op_nodes
|
|
110
110
|
sys.modules["qiskit._accelerate.twirling"] = _accelerate.twirling
|
111
111
|
sys.modules["qiskit._accelerate.high_level_synthesis"] = _accelerate.high_level_synthesis
|
112
112
|
sys.modules["qiskit._accelerate.remove_identity_equiv"] = _accelerate.remove_identity_equiv
|
113
|
+
sys.modules["qiskit._accelerate.circuit_duration"] = _accelerate.circuit_duration
|
113
114
|
|
114
115
|
from qiskit.exceptions import QiskitError, MissingOptionalLibraryError
|
115
116
|
|
qiskit/_accelerate.pyd
CHANGED
Binary file
|
qiskit/circuit/bit.py
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
Quantum bit and Classical bit objects.
|
15
15
|
"""
|
16
16
|
import copy
|
17
|
+
import warnings
|
17
18
|
|
18
19
|
from qiskit.circuit.exceptions import CircuitError
|
19
20
|
|
@@ -57,6 +58,17 @@ class Bit:
|
|
57
58
|
self._hash = hash((self._register, self._index))
|
58
59
|
self._repr = f"{self.__class__.__name__}({self._register}, {self._index})"
|
59
60
|
|
61
|
+
def __init_subclass__(cls):
|
62
|
+
# In Qiskit 2.0, `Bit` and `Register` will move to Rust space, and the allowable types of
|
63
|
+
# them will be fixed, similar to if the classes had been marked as `final`.
|
64
|
+
if cls.__module__.split(".", 2)[0] != __name__.split(".", 2)[0]:
|
65
|
+
warnings.warn(
|
66
|
+
"subclassing 'Bit' is not supported, and may not be possible in Qiskit 2.0",
|
67
|
+
category=DeprecationWarning,
|
68
|
+
stacklevel=2,
|
69
|
+
)
|
70
|
+
return cls
|
71
|
+
|
60
72
|
def __repr__(self):
|
61
73
|
"""Return the official string representing the bit."""
|
62
74
|
if (self._register, self._index) == (None, None):
|
@@ -20,6 +20,10 @@ ClassicalFunction compiler (:mod:`qiskit.circuit.classicalfunction`)
|
|
20
20
|
Overview
|
21
21
|
========
|
22
22
|
|
23
|
+
.. warning::
|
24
|
+
|
25
|
+
This module is deprecated as of Qiskit 1.4.0. It will be removed in the Qiskit 2.0 release.
|
26
|
+
|
23
27
|
The classical function compiler provides the necessary tools to map a classical
|
24
28
|
potentially irreversible functions into quantum circuits. Below is a simple example of
|
25
29
|
how to synthesize a simple boolean function defined using Python into a
|
@@ -111,7 +115,7 @@ Exceptions
|
|
111
115
|
ClassicalFunctionCompilerTypeError
|
112
116
|
|
113
117
|
"""
|
114
|
-
|
118
|
+
from qiskit.utils.deprecation import deprecate_func
|
115
119
|
from .classicalfunction import ClassicalFunction
|
116
120
|
from .exceptions import (
|
117
121
|
ClassicalFunctionParseError,
|
@@ -121,6 +125,14 @@ from .exceptions import (
|
|
121
125
|
from .boolean_expression import BooleanExpression
|
122
126
|
|
123
127
|
|
128
|
+
@deprecate_func(
|
129
|
+
since="1.4",
|
130
|
+
removal_timeline="in Qiskit 2.0",
|
131
|
+
additional_msg="Use `PhaseOracle` instead, which can be turned into a "
|
132
|
+
"bit-flip oracle by applying Hadamard gates on the target "
|
133
|
+
"qubit before and after the instruction, and conditioning."
|
134
|
+
"the instruction on the target qubit.",
|
135
|
+
)
|
124
136
|
def classical_function(func):
|
125
137
|
"""
|
126
138
|
Parses and type checks the callable ``func`` to compile it into an ``ClassicalFunction``
|
@@ -15,15 +15,24 @@
|
|
15
15
|
from os.path import basename, isfile
|
16
16
|
from typing import Callable, Optional
|
17
17
|
|
18
|
+
from qiskit.utils.deprecation import deprecate_func
|
18
19
|
from qiskit.circuit import QuantumCircuit
|
19
20
|
from qiskit.utils.optionals import HAS_TWEEDLEDUM
|
20
21
|
from .classical_element import ClassicalElement
|
21
22
|
|
22
23
|
|
23
|
-
@HAS_TWEEDLEDUM.require_in_instance
|
24
24
|
class BooleanExpression(ClassicalElement):
|
25
25
|
"""The Boolean Expression gate."""
|
26
26
|
|
27
|
+
@HAS_TWEEDLEDUM.require_in_instance
|
28
|
+
@deprecate_func(
|
29
|
+
since="1.4",
|
30
|
+
removal_timeline="in Qiskit 2.0",
|
31
|
+
additional_msg="Use `PhaseOracle` instead, which can be turned into a "
|
32
|
+
"bit-flip oracle by applying Hadamard gates on the target "
|
33
|
+
"qubit before and after the instruction, and conditioning."
|
34
|
+
"the instruction on the target qubit.",
|
35
|
+
)
|
27
36
|
def __init__(self, expression: str, name: str = None, var_order: list = None) -> None:
|
28
37
|
"""
|
29
38
|
Args:
|
@@ -15,6 +15,7 @@
|
|
15
15
|
import ast
|
16
16
|
from typing import Callable, Optional
|
17
17
|
|
18
|
+
from qiskit.utils.deprecation import deprecate_func
|
18
19
|
from qiskit.circuit import QuantumCircuit, QuantumRegister
|
19
20
|
from qiskit.exceptions import QiskitError
|
20
21
|
from qiskit.utils.optionals import HAS_TWEEDLEDUM
|
@@ -23,10 +24,18 @@ from .classical_function_visitor import ClassicalFunctionVisitor
|
|
23
24
|
from .utils import tweedledum2qiskit
|
24
25
|
|
25
26
|
|
26
|
-
@HAS_TWEEDLEDUM.require_in_instance
|
27
27
|
class ClassicalFunction(ClassicalElement):
|
28
28
|
"""Represent a classical function and its logic network."""
|
29
29
|
|
30
|
+
@HAS_TWEEDLEDUM.require_in_instance
|
31
|
+
@deprecate_func(
|
32
|
+
since="1.4",
|
33
|
+
removal_timeline="in Qiskit 2.0",
|
34
|
+
additional_msg="Use `PhaseOracle` instead, which can be turned into a "
|
35
|
+
"bit-flip oracle by applying Hadamard gates on the target "
|
36
|
+
"qubit before and after the instruction, and conditioning."
|
37
|
+
"the instruction on the target qubit.",
|
38
|
+
)
|
30
39
|
def __init__(self, source, name=None):
|
31
40
|
"""Creates a ``ClassicalFunction`` from Python source code in ``source``.
|
32
41
|
|
@@ -10,7 +10,13 @@
|
|
10
10
|
# copyright notice, and modified files need to carry a notice indicating
|
11
11
|
# that they have been altered from the originals.
|
12
12
|
|
13
|
-
"""Exceptions for ClassicalFunction compiler
|
13
|
+
"""Exceptions for ClassicalFunction compiler
|
14
|
+
|
15
|
+
.. warning::
|
16
|
+
|
17
|
+
This module is deprecated as of qiskit 1.4.0 version. It will be removed in the Qiskit 2.0 release.
|
18
|
+
|
19
|
+
"""
|
14
20
|
|
15
21
|
from qiskit.exceptions import QiskitError
|
16
22
|
|
qiskit/circuit/instruction.py
CHANGED
@@ -64,14 +64,20 @@ class Instruction(Operation):
|
|
64
64
|
def __init__(self, name, num_qubits, num_clbits, params, duration=None, unit="dt", label=None):
|
65
65
|
"""Create a new instruction.
|
66
66
|
|
67
|
+
.. deprecated:: 1.3
|
68
|
+
The parameters ``duration`` and ``unit`` are deprecated since
|
69
|
+
Qiskit 1.3, and they will be removed in 2.0 or later.
|
70
|
+
An instruction's duration is defined in a backend's Target object.
|
71
|
+
|
67
72
|
Args:
|
68
73
|
name (str): instruction name
|
69
74
|
num_qubits (int): instruction's qubit width
|
70
75
|
num_clbits (int): instruction's clbit width
|
71
76
|
params (list[int|float|complex|str|ndarray|list|ParameterExpression]):
|
72
77
|
list of parameters
|
73
|
-
duration (int
|
74
|
-
|
78
|
+
duration (int|float): (DEPRECATED) instruction's duration. it must be
|
79
|
+
an integer if ``unit`` is ``'dt'``
|
80
|
+
unit (str): (DEPRECATED) time unit of duration
|
75
81
|
label (str or None): An optional label for identifying the instruction.
|
76
82
|
|
77
83
|
Raises:
|
@@ -49,7 +49,7 @@ class MCMT(QuantumCircuit):
|
|
49
49
|
:class:`~qiskit.circuit.library.MCMTVChain`.
|
50
50
|
"""
|
51
51
|
|
52
|
-
@deprecate_func(since="1.
|
52
|
+
@deprecate_func(since="1.4", additional_msg="Use MCMTGate instead.")
|
53
53
|
def __init__(
|
54
54
|
self,
|
55
55
|
gate: Gate | Callable[[QuantumCircuit, circuit.Qubit, circuit.Qubit], circuit.Instruction],
|
@@ -76,7 +76,7 @@ class MCMT(QuantumCircuit):
|
|
76
76
|
warnings.warn(
|
77
77
|
"Passing a callable to MCMT is pending deprecation since Qiskit 1.3. Pass a "
|
78
78
|
"gate instance or the gate name instead, e.g. pass 'h' instead of QuantumCircuit.h.",
|
79
|
-
category=
|
79
|
+
category=DeprecationWarning,
|
80
80
|
stacklevel=2,
|
81
81
|
)
|
82
82
|
gate = gate.__name__
|
@@ -84,7 +84,7 @@ class MCMT(QuantumCircuit):
|
|
84
84
|
warnings.warn(
|
85
85
|
"Passing a QuantumCircuit is pending deprecation since Qiskit 1.3. Pass a gate "
|
86
86
|
"or turn the circuit into a gate using the ``to_gate`` method, instead.",
|
87
|
-
category=
|
87
|
+
category=DeprecationWarning,
|
88
88
|
stacklevel=2,
|
89
89
|
)
|
90
90
|
gate = gate.to_gate()
|
@@ -158,9 +158,8 @@ class MCMTVChain(MCMT):
|
|
158
158
|
"""
|
159
159
|
|
160
160
|
@deprecate_func(
|
161
|
-
since="1.
|
161
|
+
since="1.4",
|
162
162
|
additional_msg="Use MCMTGate with the V-chain synthesis plugin instead.",
|
163
|
-
pending=True,
|
164
163
|
)
|
165
164
|
def __init__(
|
166
165
|
self,
|
@@ -277,7 +276,7 @@ class MCMTGate(ControlledGate):
|
|
277
276
|
warnings.warn(
|
278
277
|
"Passing a controlled gate to MCMT is pending deprecation since Qiskit 1.3. Pass a "
|
279
278
|
"single-qubit gate instance or the gate name instead, e.g. pass 'h' instead of 'ch'.",
|
280
|
-
category=
|
279
|
+
category=DeprecationWarning,
|
281
280
|
stacklevel=2,
|
282
281
|
)
|
283
282
|
base_gate = gate.base_gate
|
@@ -63,31 +63,38 @@ class PhaseOracle(QuantumCircuit):
|
|
63
63
|
var_order(list): A list with the order in which variables will be created.
|
64
64
|
(default: by appearance)
|
65
65
|
"""
|
66
|
-
|
67
|
-
|
66
|
+
# ignore deprecation warning for BooleanExpression; implementation is changing in 2.0
|
67
|
+
import warnings
|
68
|
+
|
69
|
+
with warnings.catch_warnings():
|
70
|
+
warnings.simplefilter("ignore", DeprecationWarning)
|
71
|
+
from qiskit.circuit.classicalfunction.boolean_expression import BooleanExpression
|
72
|
+
from qiskit.circuit.classicalfunction.classical_element import ClassicalElement
|
68
73
|
|
69
|
-
|
70
|
-
|
74
|
+
if not isinstance(expression, ClassicalElement):
|
75
|
+
expression = BooleanExpression(expression, var_order=var_order)
|
71
76
|
|
72
|
-
|
77
|
+
self.boolean_expression = expression
|
73
78
|
|
74
|
-
|
79
|
+
if synthesizer is None:
|
75
80
|
|
76
|
-
|
77
|
-
|
78
|
-
|
81
|
+
def synthesizer(boolean_expression):
|
82
|
+
from tweedledum.synthesis import pkrm_synth # pylint: disable=import-error
|
83
|
+
from qiskit.circuit.classicalfunction.utils import tweedledum2qiskit
|
79
84
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
+
truth_table = boolean_expression._tweedledum_bool_expression.truth_table(
|
86
|
+
output_bit=0
|
87
|
+
)
|
88
|
+
tweedledum_circuit = pkrm_synth(
|
89
|
+
truth_table, {"pkrm_synth": {"phase_esop": True}}
|
90
|
+
)
|
91
|
+
return tweedledum2qiskit(tweedledum_circuit)
|
85
92
|
|
86
|
-
|
93
|
+
oracle = expression.synth(synthesizer=synthesizer)
|
87
94
|
|
88
|
-
|
95
|
+
super().__init__(oracle.num_qubits, name="Phase Oracle")
|
89
96
|
|
90
|
-
|
97
|
+
self.compose(oracle, inplace=True, copy=False)
|
91
98
|
|
92
99
|
def evaluate_bitstring(self, bitstring: str) -> bool:
|
93
100
|
"""Evaluate the oracle on a bitstring.
|
qiskit/circuit/quantumcircuit.py
CHANGED
@@ -40,6 +40,7 @@ from typing import (
|
|
40
40
|
import numpy as np
|
41
41
|
from qiskit._accelerate.circuit import CircuitData
|
42
42
|
from qiskit._accelerate.circuit import StandardGate
|
43
|
+
from qiskit._accelerate.circuit_duration import compute_estimated_duration
|
43
44
|
from qiskit.exceptions import QiskitError
|
44
45
|
from qiskit.utils.multiprocessing import is_main_process
|
45
46
|
from qiskit.circuit.instruction import Instruction
|
@@ -156,6 +157,8 @@ class QuantumCircuit:
|
|
156
157
|
:attr:`data` List of individual :class:`CircuitInstruction`\\ s that make up the
|
157
158
|
circuit.
|
158
159
|
:attr:`duration` Total duration of the circuit, added by scheduling transpiler passes.
|
160
|
+
This attribute is deprecated and :meth:`.estimate_duration` should
|
161
|
+
be used instead.
|
159
162
|
|
160
163
|
:attr:`layout` Hardware layout and routing information added by the transpiler.
|
161
164
|
:attr:`num_ancillas` The number of ancilla qubits in the circuit.
|
@@ -903,8 +906,9 @@ class QuantumCircuit:
|
|
903
906
|
|
904
907
|
If a :class:`QuantumCircuit` has been scheduled as part of a transpilation pipeline, the timing
|
905
908
|
information for individual qubits can be accessed. The whole-circuit timing information is
|
906
|
-
available through the :
|
909
|
+
available through the :meth:`estimate_duration` method and :attr:`op_start_times` attribute.
|
907
910
|
|
911
|
+
.. automethod:: estimate_duration
|
908
912
|
.. automethod:: qubit_duration
|
909
913
|
.. automethod:: qubit_start_time
|
910
914
|
.. automethod:: qubit_stop_time
|
@@ -6651,6 +6655,65 @@ class QuantumCircuit:
|
|
6651
6655
|
else:
|
6652
6656
|
return 0 # If there are no instructions over bits
|
6653
6657
|
|
6658
|
+
def estimate_duration(self, target, unit: str = "s") -> int | float:
|
6659
|
+
"""Estimate the duration of a scheduled circuit
|
6660
|
+
|
6661
|
+
This method computes the estimate of the circuit duration by finding
|
6662
|
+
the longest duration path in the circuit based on the durations
|
6663
|
+
provided by a given target. This method only works for simple circuits
|
6664
|
+
that have no control flow or other classical feed-forward operations.
|
6665
|
+
|
6666
|
+
Args:
|
6667
|
+
target (Target): The :class:`.Target` instance that contains durations for
|
6668
|
+
the instructions if the target is missing duration data for any of the
|
6669
|
+
instructions in the circuit an :class:`.QiskitError` will be raised. This
|
6670
|
+
should be the same target object used as the target for transpilation.
|
6671
|
+
unit: The unit to return the duration in. This defaults to "s" for seconds
|
6672
|
+
but this can be a supported SI prefix for seconds returns. For example
|
6673
|
+
setting this to "n" will return in unit of nanoseconds. Supported values
|
6674
|
+
of this type are "f", "p", "n", "u", "µ", "m", "k", "M", "G", "T", and
|
6675
|
+
"P". Additionally, a value of "dt" is also accepted to output an integer
|
6676
|
+
in units of "dt". For this to function "dt" must be specified in the
|
6677
|
+
``target``.
|
6678
|
+
|
6679
|
+
Returns:
|
6680
|
+
The estimated duration for the execution of a single shot of the circuit in
|
6681
|
+
the specified unit.
|
6682
|
+
|
6683
|
+
Raises:
|
6684
|
+
QiskitError: If the circuit is not scheduled or contains other
|
6685
|
+
details that prevent computing an estimated duration from
|
6686
|
+
(such as parameterized delay).
|
6687
|
+
"""
|
6688
|
+
from qiskit.converters import circuit_to_dag
|
6689
|
+
|
6690
|
+
dur = compute_estimated_duration(circuit_to_dag(self), target)
|
6691
|
+
if unit == "s":
|
6692
|
+
return dur
|
6693
|
+
if unit == "dt":
|
6694
|
+
from qiskit.circuit.duration import duration_in_dt # pylint: disable=cyclic-import
|
6695
|
+
|
6696
|
+
return duration_in_dt(dur, target.dt)
|
6697
|
+
|
6698
|
+
prefix_dict = {
|
6699
|
+
"f": 1e-15,
|
6700
|
+
"p": 1e-12,
|
6701
|
+
"n": 1e-9,
|
6702
|
+
"u": 1e-6,
|
6703
|
+
"µ": 1e-6,
|
6704
|
+
"m": 1e-3,
|
6705
|
+
"k": 1e3,
|
6706
|
+
"M": 1e6,
|
6707
|
+
"G": 1e9,
|
6708
|
+
"T": 1e12,
|
6709
|
+
"P": 1e15,
|
6710
|
+
}
|
6711
|
+
if unit not in prefix_dict:
|
6712
|
+
raise QiskitError(
|
6713
|
+
f"Specified unit: {unit} is not a valid/supported SI prefix, 's', or 'dt'"
|
6714
|
+
)
|
6715
|
+
return dur / prefix_dict[unit]
|
6716
|
+
|
6654
6717
|
|
6655
6718
|
class _OuterCircuitScopeInterface(CircuitScopeInterface):
|
6656
6719
|
# This is an explicit interface-fulfilling object friend of QuantumCircuit that acts as its
|
qiskit/circuit/register.py
CHANGED
@@ -17,7 +17,9 @@ Base register reference object.
|
|
17
17
|
"""
|
18
18
|
|
19
19
|
from __future__ import annotations
|
20
|
+
|
20
21
|
import itertools
|
22
|
+
import warnings
|
21
23
|
import numpy as np
|
22
24
|
|
23
25
|
from qiskit.circuit.exceptions import CircuitError
|
@@ -125,6 +127,17 @@ class Register:
|
|
125
127
|
# until first access.
|
126
128
|
self._bit_indices = None
|
127
129
|
|
130
|
+
def __init_subclass__(cls):
|
131
|
+
# In Qiskit 2.0, `Bit` and `Register` will move to Rust space, and the allowable types of
|
132
|
+
# them will be fixed, similar to if the classes had been marked as `final`.
|
133
|
+
if cls.__module__.split(".", 2)[0] != __name__.split(".", 2)[0]:
|
134
|
+
warnings.warn(
|
135
|
+
"subclassing 'Register' is not supported, and may not be possible in Qiskit 2.0",
|
136
|
+
category=DeprecationWarning,
|
137
|
+
stacklevel=2,
|
138
|
+
)
|
139
|
+
return cls
|
140
|
+
|
128
141
|
@property
|
129
142
|
def name(self):
|
130
143
|
"""Get the register name."""
|
qiskit/compiler/assembler.py
CHANGED
@@ -261,14 +261,22 @@ def _assemble(
|
|
261
261
|
|
262
262
|
# assemble either circuits or schedules
|
263
263
|
if all(isinstance(exp, QuantumCircuit) for exp in experiments):
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
264
|
+
with warnings.catch_warnings():
|
265
|
+
# Internally calls deprecated BasicSimulator.configuration()`
|
266
|
+
warnings.filterwarnings(
|
267
|
+
"ignore",
|
268
|
+
category=DeprecationWarning,
|
269
|
+
message=r".+\.basic_provider\.basic_simulator\.BasicSimulator\.configuration.+",
|
270
|
+
module="qiskit",
|
271
|
+
)
|
272
|
+
run_config = _parse_circuit_args(
|
273
|
+
parameter_binds,
|
274
|
+
backend,
|
275
|
+
meas_level,
|
276
|
+
meas_return,
|
277
|
+
parametric_pulses,
|
278
|
+
**run_config_common_dict,
|
279
|
+
)
|
272
280
|
|
273
281
|
# If circuits are parameterized, bind parameters and remove from run_config
|
274
282
|
bound_experiments, run_config = _expand_parameters(
|
@@ -13,6 +13,7 @@
|
|
13
13
|
"""_DAGDependencyV2 class for representing non-commutativity in a circuit.
|
14
14
|
"""
|
15
15
|
|
16
|
+
import itertools
|
16
17
|
import math
|
17
18
|
from collections import OrderedDict, defaultdict, namedtuple
|
18
19
|
from typing import Dict, List, Generator, Any
|
@@ -344,7 +345,6 @@ class _DAGDependencyV2:
|
|
344
345
|
op=operation,
|
345
346
|
qargs=qargs,
|
346
347
|
cargs=cargs,
|
347
|
-
dag=self,
|
348
348
|
)
|
349
349
|
new_node._node_id = self._multi_graph.add_node(new_node)
|
350
350
|
self._update_edges()
|
@@ -459,7 +459,9 @@ class _DAGDependencyV2:
|
|
459
459
|
"""
|
460
460
|
|
461
461
|
def _key(x):
|
462
|
-
return
|
462
|
+
return ",".join(
|
463
|
+
f"{self.find_bit(q).index:04d}" for q in itertools.chain(x.qargs, x.cargs)
|
464
|
+
)
|
463
465
|
|
464
466
|
if key is None:
|
465
467
|
key = _key
|
@@ -14,6 +14,7 @@
|
|
14
14
|
from __future__ import annotations
|
15
15
|
|
16
16
|
import logging
|
17
|
+
import warnings
|
17
18
|
from abc import ABC, abstractmethod
|
18
19
|
from collections.abc import Callable, Iterable
|
19
20
|
from itertools import chain
|
@@ -29,6 +30,8 @@ from .compilation_status import PropertySet, WorkflowStatus, PassManagerState
|
|
29
30
|
|
30
31
|
logger = logging.getLogger(__name__)
|
31
32
|
|
33
|
+
_MISSING = object()
|
34
|
+
|
32
35
|
|
33
36
|
class BasePassManager(ABC):
|
34
37
|
"""Pass manager base class."""
|
@@ -174,6 +177,8 @@ class BasePassManager(ABC):
|
|
174
177
|
in_programs: Any | list[Any],
|
175
178
|
callback: Callable = None,
|
176
179
|
num_processes: int = None,
|
180
|
+
*,
|
181
|
+
property_set: object = _MISSING,
|
177
182
|
**kwargs,
|
178
183
|
) -> Any:
|
179
184
|
"""Run all the passes on the specified ``in_programs``.
|
@@ -211,12 +216,25 @@ class BasePassManager(ABC):
|
|
211
216
|
execution is enabled. This argument overrides ``num_processes`` in the user
|
212
217
|
configuration file, and the ``QISKIT_NUM_PROCS`` environment variable. If set
|
213
218
|
to ``None`` the system default or local user configuration will be used.
|
214
|
-
|
219
|
+
property_set: Currently a key that will be interpreted as all other arbitrary
|
220
|
+
``kwargs``. In Qiskit 2.0, this will instead seed the :class:`.PropertySet` of the
|
221
|
+
compilation (but does not do so in this version).
|
215
222
|
kwargs: Arbitrary arguments passed to the compiler frontend and backend.
|
216
223
|
|
217
224
|
Returns:
|
218
225
|
The transformed program(s).
|
219
226
|
"""
|
227
|
+
if property_set is not _MISSING:
|
228
|
+
warnings.warn(
|
229
|
+
"From Qiskit 2.0, 'property_set' will be a reserved keyword argument of"
|
230
|
+
" 'BasePassManager.run', and not passed on to the conversion functions."
|
231
|
+
" This subclass of 'BasePassManager' needs to use a different keyword argument"
|
232
|
+
" for passing on this data.",
|
233
|
+
FutureWarning,
|
234
|
+
stacklevel=2,
|
235
|
+
)
|
236
|
+
kwargs["property_set"] = property_set
|
237
|
+
|
220
238
|
if not self._tasks and not kwargs and callback is None:
|
221
239
|
return in_programs
|
222
240
|
|
@@ -15,6 +15,7 @@
|
|
15
15
|
from __future__ import annotations
|
16
16
|
|
17
17
|
import math
|
18
|
+
import warnings
|
18
19
|
from collections import defaultdict
|
19
20
|
from collections.abc import Iterable
|
20
21
|
from dataclasses import dataclass
|
@@ -131,12 +132,28 @@ class BackendEstimatorV2(BaseEstimatorV2):
|
|
131
132
|
options: dict | None = None,
|
132
133
|
):
|
133
134
|
"""
|
135
|
+
.. deprecated:: 1.4
|
136
|
+
The method ``BackendEstimatorV2.__init__`` will stop supporting inputs of type
|
137
|
+
:class:`.BackendV1` in the `backend` parameter in a future release no
|
138
|
+
earlier than 2.0. :class:`.BackendV1` is deprecated and implementations should
|
139
|
+
move to :class:`.BackendV2`.
|
140
|
+
|
134
141
|
Args:
|
135
142
|
backend: The backend to run the primitive on.
|
136
143
|
options: The options to control the default precision (``default_precision``),
|
137
144
|
the operator grouping (``abelian_grouping``), and
|
138
145
|
the random seed for the simulator (``seed_simulator``).
|
139
146
|
"""
|
147
|
+
|
148
|
+
if not isinstance(backend, BackendV2):
|
149
|
+
warnings.warn(
|
150
|
+
"The method `BackendEstimatorV2.__init__` will stop supporting inputs of "
|
151
|
+
f"type `BackendV1` ( {backend} ) in the `backend` parameter in a future "
|
152
|
+
"release no earlier than 2.0. `BackendV1` is deprecated and implementations "
|
153
|
+
"should move to `BackendV2`.",
|
154
|
+
category=DeprecationWarning,
|
155
|
+
stacklevel=2,
|
156
|
+
)
|
140
157
|
self._backend = backend
|
141
158
|
self._options = Options(**options) if options else Options()
|
142
159
|
|
@@ -123,11 +123,26 @@ class BackendSamplerV2(BaseSamplerV2):
|
|
123
123
|
options: dict | None = None,
|
124
124
|
):
|
125
125
|
"""
|
126
|
+
.. deprecated:: 1.4
|
127
|
+
The method ``BackendSamplerV2.__init__`` will stop supporting inputs of type
|
128
|
+
:class:`.BackendV1` in the `backend` parameter in a future release no
|
129
|
+
earlier than 2.0. :class:`.BackendV1` is deprecated and implementations should
|
130
|
+
move to :class:`.BackendV2`.
|
131
|
+
|
126
132
|
Args:
|
127
133
|
backend: The backend to run the primitive on.
|
128
134
|
options: The options to control the default shots (``default_shots``) and
|
129
135
|
the random seed for the simulator (``seed_simulator``).
|
130
136
|
"""
|
137
|
+
if not isinstance(backend, BackendV2):
|
138
|
+
warnings.warn(
|
139
|
+
"The method `BackendSamplerV2.__init__` will stop supporting inputs of "
|
140
|
+
f"type `BackendV1` ( {backend} ) in the `backend` parameter in a future "
|
141
|
+
"release no earlier than 2.0. `BackendV1` is deprecated and implementations "
|
142
|
+
"should move to `BackendV2`.",
|
143
|
+
category=DeprecationWarning,
|
144
|
+
stacklevel=2,
|
145
|
+
)
|
131
146
|
self._backend = backend
|
132
147
|
self._options = Options(**options) if options else Options()
|
133
148
|
|
@@ -25,6 +25,7 @@ from qiskit.circuit.controlflow import CONTROL_FLOW_OP_NAMES
|
|
25
25
|
from qiskit.providers.models.pulsedefaults import PulseDefaults
|
26
26
|
from qiskit.providers.options import Options
|
27
27
|
from qiskit.providers.exceptions import BackendPropertyError
|
28
|
+
from qiskit.utils import deprecate_func
|
28
29
|
from qiskit.utils.deprecate_pulse import deprecate_pulse_arg, deprecate_pulse_dependency
|
29
30
|
|
30
31
|
|
@@ -59,9 +60,19 @@ def convert_to_target(
|
|
59
60
|
Returns:
|
60
61
|
A ``Target`` instance.
|
61
62
|
"""
|
62
|
-
return
|
63
|
-
|
64
|
-
)
|
63
|
+
# If a deprecated error is raised during the conversion, we should not return the
|
64
|
+
# deprecation warning to the user,as it is not actionable for them.
|
65
|
+
with warnings.catch_warnings():
|
66
|
+
warnings.filterwarnings(
|
67
|
+
"ignore",
|
68
|
+
category=DeprecationWarning,
|
69
|
+
message=".*``qiskit.providers.exceptions.BackendPropertyError``",
|
70
|
+
module="qiskit",
|
71
|
+
)
|
72
|
+
target = _convert_to_target(
|
73
|
+
configuration, properties, defaults, custom_name_mapping, add_delay, filter_faulty
|
74
|
+
)
|
75
|
+
return target
|
65
76
|
|
66
77
|
|
67
78
|
def _convert_to_target(
|
@@ -368,6 +379,12 @@ class BackendV2Converter(BackendV2):
|
|
368
379
|
)
|
369
380
|
"""
|
370
381
|
|
382
|
+
@deprecate_func(
|
383
|
+
since="1.4",
|
384
|
+
removal_timeline="in the 2.0 release",
|
385
|
+
additional_msg="Since ``BackendV1`` is deprecated, this conversion tool from BackendV1 to "
|
386
|
+
"BackendV2 is going to be removed with BackendV1.",
|
387
|
+
)
|
371
388
|
def __init__(
|
372
389
|
self,
|
373
390
|
backend: BackendV1,
|
@@ -426,14 +443,32 @@ class BackendV2Converter(BackendV2):
|
|
426
443
|
:rtype: Target
|
427
444
|
"""
|
428
445
|
if self._target is None:
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
446
|
+
# If a deprecated error is raised during the conversion,
|
447
|
+
# we should not return the deprecation warning to the user,
|
448
|
+
# as it is not actionable for them.
|
449
|
+
with warnings.catch_warnings():
|
450
|
+
warnings.filterwarnings(
|
451
|
+
"ignore",
|
452
|
+
category=DeprecationWarning,
|
453
|
+
message=".*``qiskit.providers.exceptions.BackendPropertyError``",
|
454
|
+
module="qiskit",
|
455
|
+
)
|
456
|
+
# convert_to_target is deprecated along BackendV2Converter
|
457
|
+
# They both need to be removed at the same time
|
458
|
+
warnings.filterwarnings(
|
459
|
+
"ignore",
|
460
|
+
category=DeprecationWarning,
|
461
|
+
message=r".+qiskit\.providers\.backend_compat\.convert_to_target.+",
|
462
|
+
module="qiskit",
|
463
|
+
)
|
464
|
+
self._target = _convert_to_target(
|
465
|
+
configuration=self._config,
|
466
|
+
properties=self._properties,
|
467
|
+
defaults=self._defaults,
|
468
|
+
custom_name_mapping=self._name_mapping,
|
469
|
+
add_delay=self._add_delay,
|
470
|
+
filter_faulty=self._filter_faulty,
|
471
|
+
)
|
437
472
|
return self._target
|
438
473
|
|
439
474
|
@property
|