qiskit 1.3.3__cp39-abi3-macosx_11_0_arm64.whl → 1.4.1__cp39-abi3-macosx_11_0_arm64.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 (54) hide show
  1. qiskit/VERSION.txt +1 -1
  2. qiskit/__init__.py +1 -0
  3. qiskit/_accelerate.abi3.so +0 -0
  4. qiskit/circuit/bit.py +12 -0
  5. qiskit/circuit/classicalfunction/__init__.py +13 -1
  6. qiskit/circuit/classicalfunction/boolean_expression.py +10 -1
  7. qiskit/circuit/classicalfunction/classicalfunction.py +10 -1
  8. qiskit/circuit/classicalfunction/exceptions.py +7 -1
  9. qiskit/circuit/instruction.py +8 -2
  10. qiskit/circuit/library/generalized_gates/mcmt.py +5 -6
  11. qiskit/circuit/library/phase_oracle.py +24 -17
  12. qiskit/circuit/quantumcircuit.py +64 -1
  13. qiskit/circuit/register.py +13 -0
  14. qiskit/compiler/assembler.py +16 -8
  15. qiskit/dagcircuit/dagdependency_v2.py +4 -2
  16. qiskit/passmanager/passmanager.py +19 -1
  17. qiskit/primitives/backend_estimator_v2.py +17 -0
  18. qiskit/primitives/backend_sampler_v2.py +15 -0
  19. qiskit/providers/backend_compat.py +46 -11
  20. qiskit/providers/basic_provider/basic_simulator.py +15 -3
  21. qiskit/providers/exceptions.py +23 -2
  22. qiskit/providers/models/backendproperties.py +19 -1
  23. qiskit/providers/models/backendstatus.py +10 -0
  24. qiskit/providers/models/jobstatus.py +11 -0
  25. qiskit/pulse/schedule.py +1 -1
  26. qiskit/pulse/utils.py +1 -1
  27. qiskit/qpy/binary_io/value.py +14 -0
  28. qiskit/result/result.py +109 -20
  29. qiskit/synthesis/evolution/product_formula.py +1 -2
  30. qiskit/synthesis/evolution/qdrift.py +1 -2
  31. qiskit/synthesis/evolution/suzuki_trotter.py +1 -2
  32. qiskit/transpiler/passes/calibration/rzx_templates.py +7 -0
  33. qiskit/transpiler/passes/layout/apply_layout.py +1 -0
  34. qiskit/transpiler/passes/layout/dense_layout.py +12 -0
  35. qiskit/transpiler/passes/layout/vf2_layout.py +11 -0
  36. qiskit/transpiler/passes/layout/vf2_post_layout.py +22 -0
  37. qiskit/transpiler/passes/optimization/normalize_rx_angle.py +8 -0
  38. qiskit/transpiler/passes/routing/star_prerouting.py +17 -2
  39. qiskit/transpiler/passes/synthesis/unitary_synthesis.py +11 -0
  40. qiskit/transpiler/passmanager_config.py +11 -0
  41. qiskit/transpiler/preset_passmanagers/builtin_plugins.py +188 -118
  42. qiskit/transpiler/preset_passmanagers/common.py +133 -83
  43. qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +29 -3
  44. qiskit/transpiler/target.py +41 -9
  45. qiskit/visualization/gate_map.py +50 -0
  46. qiskit/visualization/pulse_v2/interface.py +0 -2
  47. qiskit/visualization/timeline/core.py +9 -0
  48. qiskit/visualization/timeline/interface.py +7 -3
  49. {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/METADATA +1 -1
  50. {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/RECORD +54 -54
  51. {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/WHEEL +1 -1
  52. {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/LICENSE.txt +0 -0
  53. {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/entry_points.txt +0 -0
  54. {qiskit-1.3.3.dist-info → qiskit-1.4.1.dist-info}/top_level.txt +0 -0
@@ -576,8 +576,14 @@ class BasicSimulator(BackendV2):
576
576
  self._memory = getattr(qobj.config, "memory", False)
577
577
  self._qobj_config = qobj.config
578
578
  start = time.time()
579
- for experiment in qobj.experiments:
580
- result_list.append(self.run_experiment(experiment))
579
+ with warnings.catch_warnings():
580
+ warnings.filterwarnings(
581
+ "ignore",
582
+ category=DeprecationWarning,
583
+ message=r".+qiskit\.providers\.basic_provider\.basic_simulator\..+",
584
+ )
585
+ for experiment in qobj.experiments:
586
+ result_list.append(self.run_experiment(experiment))
581
587
  end = time.time()
582
588
  result = {
583
589
  "backend_name": self.name,
@@ -590,9 +596,15 @@ class BasicSimulator(BackendV2):
590
596
  "time_taken": (end - start),
591
597
  "header": qobj.header.to_dict(),
592
598
  }
593
-
594
599
  return Result.from_dict(result)
595
600
 
601
+ @deprecate_func(
602
+ since="1.4.0",
603
+ removal_timeline="in Qiskit 2.0.0",
604
+ additional_msg="This method takes a `QasmQobjExperiment` as input argument. "
605
+ "The `Qobj` class and related functionality are part of the deprecated "
606
+ "`BackendV1` workflow, and no longer necessary for `BackendV2`. Use `run` instead.",
607
+ )
596
608
  def run_experiment(self, experiment: QasmQobjExperiment) -> dict[str, ...]:
597
609
  """Run an experiment (circuit) and return a single experiment result.
598
610
 
@@ -13,6 +13,7 @@
13
13
  """Exceptions for errors raised while handling Backends and Jobs."""
14
14
 
15
15
  from qiskit.exceptions import QiskitError
16
+ from qiskit.utils import deprecate_func
16
17
 
17
18
 
18
19
  class JobError(QiskitError):
@@ -36,10 +37,30 @@ class QiskitBackendNotFoundError(QiskitError):
36
37
  class BackendPropertyError(QiskitError):
37
38
  """Base class for errors raised while looking for a backend property."""
38
39
 
39
- pass
40
+ @deprecate_func(
41
+ since="1.4",
42
+ removal_timeline="in the 2.0 release",
43
+ additional_msg="The models in ``qiskit.providers.models`` and related objects are part "
44
+ "of the deprecated `BackendV1` workflow, and no longer necessary for `BackendV2`. If a user "
45
+ "workflow requires these representations it likely relies on deprecated functionality and "
46
+ "should be updated to use `BackendV2`.",
47
+ stacklevel=2,
48
+ )
49
+ def __init__(self, *message):
50
+ super().__init__(*message)
40
51
 
41
52
 
42
53
  class BackendConfigurationError(QiskitError):
43
54
  """Base class for errors raised by the BackendConfiguration."""
44
55
 
45
- pass
56
+ @deprecate_func(
57
+ since="1.4",
58
+ removal_timeline="in the 2.0 release",
59
+ additional_msg="The models in ``qiskit.providers.models`` and related objects are part "
60
+ "of the deprecated `BackendV1` workflow, and no longer necessary for `BackendV2`. If a user "
61
+ "workflow requires these representations it likely relies on deprecated functionality and "
62
+ "should be updated to use `BackendV2`.",
63
+ stacklevel=2,
64
+ )
65
+ def __init__(self, *message):
66
+ super().__init__(*message)
@@ -34,6 +34,15 @@ class Nduv:
34
34
  value: value.
35
35
  """
36
36
 
37
+ @deprecate_func(
38
+ since="1.4",
39
+ removal_timeline="in the 2.0 release",
40
+ additional_msg="The models in ``qiskit.providers.models`` and related objects are part "
41
+ "of the deprecated `BackendV1` workflow, and no longer necessary for `BackendV2`. If a user "
42
+ "workflow requires these representations it likely relies on deprecated functionality and "
43
+ "should be updated to use `BackendV2`.",
44
+ stacklevel=2,
45
+ )
37
46
  def __init__(self, date, name, unit, value):
38
47
  """Initialize a new name-date-unit-value object
39
48
 
@@ -97,6 +106,15 @@ class GateProperties:
97
106
 
98
107
  _data = {}
99
108
 
109
+ @deprecate_func(
110
+ since="1.4",
111
+ removal_timeline="in the 2.0 release",
112
+ additional_msg="The models in ``qiskit.providers.models`` and related objects are part "
113
+ "of the deprecated `BackendV1` workflow, and no longer necessary for `BackendV2`. If a user "
114
+ "workflow requires these representations it likely relies on deprecated functionality and "
115
+ "should be updated to use `BackendV2`.",
116
+ stacklevel=2,
117
+ )
100
118
  def __init__(self, qubits, gate, parameters, **kwargs):
101
119
  """Initialize a new :class:`GateProperties` object
102
120
 
@@ -180,7 +198,7 @@ class BackendProperties:
180
198
  "of the deprecated `BackendV1` workflow, and no longer necessary for `BackendV2`. If a user "
181
199
  "workflow requires these representations it likely relies on deprecated functionality and "
182
200
  "should be updated to use `BackendV2`.",
183
- stacklevel=3,
201
+ stacklevel=2,
184
202
  )
185
203
  def __init__(
186
204
  self, backend_name, backend_version, last_update_date, qubits, gates, general, **kwargs
@@ -14,11 +14,21 @@
14
14
 
15
15
  import html
16
16
  from qiskit.exceptions import QiskitError
17
+ from qiskit.utils import deprecate_func
17
18
 
18
19
 
19
20
  class BackendStatus:
20
21
  """Class representing Backend Status."""
21
22
 
23
+ @deprecate_func(
24
+ since="1.4",
25
+ removal_timeline="in the 2.0 release",
26
+ additional_msg="The models in ``qiskit.providers.models`` and related objects are part "
27
+ "of the deprecated `BackendV1` workflow, and no longer necessary for `BackendV2`. If a user "
28
+ "workflow requires these representations it likely relies on deprecated functionality and "
29
+ "should be updated to use `BackendV2`.",
30
+ stacklevel=2,
31
+ )
22
32
  def __init__(
23
33
  self,
24
34
  backend_name: str,
@@ -12,6 +12,8 @@
12
12
 
13
13
  """Class for job status."""
14
14
 
15
+ from qiskit.utils import deprecate_func
16
+
15
17
 
16
18
  class JobStatus:
17
19
  """Model for JobStatus.
@@ -24,6 +26,15 @@ class JobStatus:
24
26
 
25
27
  _data = {}
26
28
 
29
+ @deprecate_func(
30
+ since="1.4",
31
+ removal_timeline="in the 2.0 release",
32
+ additional_msg="The models in ``qiskit.providers.models`` and related objects are part "
33
+ "of the deprecated `BackendV1` workflow, and no longer necessary for `BackendV2`. If a user "
34
+ "workflow requires these representations it likely relies on deprecated functionality and "
35
+ "should be updated to use `BackendV2`.",
36
+ stacklevel=2,
37
+ )
27
38
  def __init__(self, job_id, status, status_msg, **kwargs):
28
39
  self._data = {}
29
40
  self.job_id = job_id
qiskit/pulse/schedule.py CHANGED
@@ -1637,7 +1637,7 @@ def _common_method(*classes):
1637
1637
  return decorator
1638
1638
 
1639
1639
 
1640
- @deprecate_arg("show_barriers", new_alias="plot_barriers", since="1.1.0", pending=True)
1640
+ @deprecate_arg("show_barriers", new_alias="plot_barriers", since="1.4")
1641
1641
  @_common_method(Schedule, ScheduleBlock)
1642
1642
  def draw(
1643
1643
  self,
qiskit/pulse/utils.py CHANGED
@@ -51,7 +51,7 @@ def format_parameter_value(
51
51
  decimal: Number of digit to round returned value.
52
52
 
53
53
  Returns:
54
- Value casted to non-parameter data type, when possible.
54
+ Value cast to non-parameter data type, when possible.
55
55
  """
56
56
  if isinstance(operand, ParameterExpression):
57
57
  try:
@@ -142,6 +142,8 @@ def _encode_replay_subs(subs, file_obj, version):
142
142
 
143
143
 
144
144
  def _write_parameter_expression_v13(file_obj, obj, version):
145
+ # A symbol is `Parameter` or `ParameterVectorElement`.
146
+ # `symbol_map` maps symbols to ParameterExpression (which may be a symbol).
145
147
  symbol_map = {}
146
148
  for inst in obj._qpy_replay:
147
149
  if isinstance(inst, _SUBS):
@@ -234,9 +236,17 @@ def _write_parameter_expression(file_obj, obj, use_symengine, *, version):
234
236
  # serialize key
235
237
  if symbol_key == type_keys.Value.PARAMETER_VECTOR:
236
238
  symbol_data = common.data_to_binary(symbol, _write_parameter_vec)
239
+ elif symbol_key == type_keys.Value.PARAMETER_EXPRESSION:
240
+ symbol_data = common.data_to_binary(
241
+ symbol,
242
+ _write_parameter_expression,
243
+ use_symengine=use_symengine,
244
+ version=version,
245
+ )
237
246
  else:
238
247
  symbol_data = common.data_to_binary(symbol, _write_parameter)
239
248
  # serialize value
249
+
240
250
  value_key, value_data = dumps_value(
241
251
  symbol, version=version, use_symengine=use_symengine
242
252
  )
@@ -516,10 +526,13 @@ def _read_parameter_expression_v13(file_obj, vectors, version):
516
526
  symbol = _read_parameter(file_obj)
517
527
  elif symbol_key == type_keys.Value.PARAMETER_VECTOR:
518
528
  symbol = _read_parameter_vec(file_obj, vectors)
529
+ elif symbol_key == type_keys.Value.PARAMETER_EXPRESSION:
530
+ symbol = _read_parameter_expression_v13(file_obj, vectors, version)
519
531
  else:
520
532
  raise exceptions.QpyError(f"Invalid parameter expression map type: {symbol_key}")
521
533
 
522
534
  elem_key = type_keys.Value(elem_data.type)
535
+
523
536
  binary_data = file_obj.read(elem_data.size)
524
537
  if elem_key == type_keys.Value.INTEGER:
525
538
  value = struct.unpack("!q", binary_data)
@@ -534,6 +547,7 @@ def _read_parameter_expression_v13(file_obj, vectors, version):
534
547
  binary_data,
535
548
  _read_parameter_expression_v13,
536
549
  vectors=vectors,
550
+ version=version,
537
551
  )
538
552
  else:
539
553
  raise exceptions.QpyError(f"Invalid parameter expression map type: {elem_key}")
qiskit/result/result.py CHANGED
@@ -12,6 +12,7 @@
12
12
 
13
13
  """Model for schema-conformant Results."""
14
14
 
15
+ from collections.abc import Iterable
15
16
  import copy
16
17
  import warnings
17
18
 
@@ -25,47 +26,135 @@ from qiskit.result.counts import Counts
25
26
  from qiskit.qobj.utils import MeasLevel
26
27
  from qiskit.qobj import QobjHeader
27
28
 
29
+ _MISSING = object()
30
+
28
31
 
29
32
  class Result:
30
33
  """Model for Results.
31
34
 
32
- Attributes:
33
- backend_name (str): backend name.
34
- backend_version (str): backend version, in the form X.Y.Z.
35
- qobj_id (str): user-generated Qobj id.
36
- job_id (str): unique execution id from the backend.
37
- success (bool): True if complete input qobj executed correctly. (Implies
35
+ .. deprecated:: 1.4
36
+ The use of positional arguments in the constructor of :class:`.Result`
37
+ is deprecated as of Qiskit 1.4, and will be disabled in Qiskit 2.0.
38
+ Please set all arguments using kwarg syntax, i.e: ``Result(backend_name="name", ....)``.
39
+ In addition to this, the ``qobj_id`` argument is deprecated and will no longer
40
+ be used in Qiskit 2.0. It will, however, still be possible to set ``qobj_id`` as a
41
+ generic kwarg, which will land in the metadata field with the other generic kwargs.
42
+
43
+ Args:
44
+ backend_name (str): (REQUIRED) backend name.
45
+ backend_version (str): (REQUIRED) backend version, in the form X.Y.Z.
46
+ qobj_id (str): (REQUIRED) user-generated Qobj id.
47
+ job_id (str): (REQUIRED) unique execution id from the backend.
48
+ success (bool): (REQUIRED) True if complete input qobj executed correctly. (Implies
38
49
  each experiment success)
39
- results (list[ExperimentResult]): corresponding results for array of
50
+ results (list[ExperimentResult]): (REQUIRED) corresponding results for array of
40
51
  experiments of the input qobj
52
+ date (str): (OPTIONAL) date of the experiment
53
+ header(dict): (OPTIONAL)experiment header
54
+ kwargs: generic keyword arguments. (OPTIONAL) These will be stored in the metadata field.
41
55
  """
42
56
 
43
57
  _metadata = {}
44
58
 
45
59
  def __init__(
46
60
  self,
47
- backend_name,
48
- backend_version,
49
- qobj_id,
50
- job_id,
51
- success,
52
- results,
61
+ *args,
53
62
  date=None,
54
63
  status=None,
55
64
  header=None,
56
65
  **kwargs,
57
66
  ):
67
+ # The following arguments are required.
68
+ required_args = {
69
+ "backend_name": _MISSING,
70
+ "backend_version": _MISSING,
71
+ "qobj_id": _MISSING,
72
+ "job_id": _MISSING,
73
+ "success": _MISSING,
74
+ "results": _MISSING,
75
+ }
76
+ # Step 1: iterate over kwargs.
77
+ # An item from required_args might be set as a kwarg, so we must separate
78
+ # true kwargs from "required_args" kwargs.
79
+ true_kwargs = {}
80
+ for key, value in kwargs.items():
81
+ if key in required_args:
82
+ required_args[key] = value
83
+ else:
84
+ true_kwargs[key] = value
85
+ # Step 2: iterate over args, which are expected in the order of the index_map below.
86
+ index_map = ["backend_name", "backend_version", "qobj_id", "job_id", "success", "results"]
87
+ raise_qobj = False
88
+ missing_args = []
89
+ for index, name in enumerate(index_map):
90
+ try:
91
+ value = args[index]
92
+ required_args[name] = value
93
+ # The use of args is deprecated in 1.4 and will be removed in 2.0.
94
+ # Furthermore, qobj_id will be ignored if set as a kwarg in 2.0.
95
+ if name == "qobj_id":
96
+ warnings.warn(
97
+ "The use of positional arguments in `qiskit.result.result.Result.__init__()` "
98
+ "is deprecated as of Qiskit 1.4, and will be disabled in Qiskit 2.0. "
99
+ "Please set this value using kwarg syntax, "
100
+ f"i.e: `Result(...,{name}={name}_value)`. "
101
+ "The `qobj_id` argument will no longer be used in Qiskit 2.0, "
102
+ "but it will still be possible to "
103
+ "set as a kwarg that will land in the metadata field.",
104
+ category=DeprecationWarning,
105
+ stacklevel=2,
106
+ )
107
+ else:
108
+ warnings.warn(
109
+ "The use of positional arguments in `qiskit.result.result.Result.__init__()` "
110
+ "is deprecated as of Qiskit 1.4, and will be disabled in Qiskit 2.0. "
111
+ "Please set this value using kwarg syntax, "
112
+ f"i.e: `Result(...,{name}={name}_value)`. ",
113
+ category=DeprecationWarning,
114
+ stacklevel=2,
115
+ )
116
+ except IndexError:
117
+ if required_args[name] is _MISSING:
118
+ missing_args = [
119
+ key for (key, value) in required_args.items() if value is _MISSING
120
+ ]
121
+ elif name == "qobj_id":
122
+ raise_qobj = True
123
+ break
124
+
125
+ # The deprecation warning should be raised outside of the try-except,
126
+ # not to show a confusing trace that points to the IndexError
127
+ if len(missing_args) > 1:
128
+ raise TypeError(
129
+ f"Result.__init__() missing {len(missing_args)} required arguments: {missing_args}"
130
+ )
131
+ if len(missing_args) == 1:
132
+ raise TypeError(f"Result.__init__() missing a required argument: {missing_args[0]}")
133
+ if raise_qobj:
134
+ # qobj_id will be ignored if set as a kwarg in 2.0.
135
+ warnings.warn(
136
+ "The `qobj_id` argument will no longer be used in Qiskit 2.0, "
137
+ "but it will still be possible to "
138
+ "set as a kwarg that will land in the metadata field.",
139
+ category=DeprecationWarning,
140
+ stacklevel=2,
141
+ )
142
+
58
143
  self._metadata = {}
59
- self.backend_name = backend_name
60
- self.backend_version = backend_version
61
- self.qobj_id = qobj_id
62
- self.job_id = job_id
63
- self.success = success
64
- self.results = results
144
+ self.backend_name = required_args["backend_name"]
145
+ self.backend_version = required_args["backend_version"]
146
+ self.qobj_id = required_args["qobj_id"]
147
+ self.job_id = required_args["job_id"]
148
+ self.success = required_args["success"]
149
+ self.results = (
150
+ [required_args["results"]]
151
+ if not isinstance(required_args["results"], Iterable)
152
+ else required_args["results"]
153
+ )
65
154
  self.date = date
66
155
  self.status = status
67
156
  self.header = header
68
- self._metadata.update(kwargs)
157
+ self._metadata.update(true_kwargs)
69
158
 
70
159
  def __repr__(self):
71
160
  out = (
@@ -44,7 +44,7 @@ class ProductFormula(EvolutionSynthesis):
44
44
 
45
45
  @deprecate_arg(
46
46
  name="atomic_evolution",
47
- since="1.2",
47
+ since="1.4",
48
48
  predicate=lambda callable: callable is not None
49
49
  and len(inspect.signature(callable).parameters) == 2,
50
50
  deprecation_description=(
@@ -55,7 +55,6 @@ class ProductFormula(EvolutionSynthesis):
55
55
  "Instead you should update your 'atomic_evolution' function to be of the following "
56
56
  "type: 'Callable[[QuantumCircuit, Pauli | SparsePauliOp, float], None]'."
57
57
  ),
58
- pending=True,
59
58
  )
60
59
  def __init__(
61
60
  self,
@@ -43,7 +43,7 @@ class QDrift(ProductFormula):
43
43
 
44
44
  @deprecate_arg(
45
45
  name="atomic_evolution",
46
- since="1.2",
46
+ since="1.4",
47
47
  predicate=lambda callable: callable is not None
48
48
  and len(inspect.signature(callable).parameters) == 2,
49
49
  deprecation_description=(
@@ -54,7 +54,6 @@ class QDrift(ProductFormula):
54
54
  "Instead you should update your 'atomic_evolution' function to be of the following "
55
55
  "type: 'Callable[[QuantumCircuit, Pauli | SparsePauliOp, float], None]'."
56
56
  ),
57
- pending=True,
58
57
  )
59
58
  def __init__(
60
59
  self,
@@ -62,7 +62,7 @@ class SuzukiTrotter(ProductFormula):
62
62
 
63
63
  @deprecate_arg(
64
64
  name="atomic_evolution",
65
- since="1.2",
65
+ since="1.4",
66
66
  predicate=lambda callable: callable is not None
67
67
  and len(inspect.signature(callable).parameters) == 2,
68
68
  deprecation_description=(
@@ -73,7 +73,6 @@ class SuzukiTrotter(ProductFormula):
73
73
  "Instead you should update your 'atomic_evolution' function to be of the following "
74
74
  "type: 'Callable[[QuantumCircuit, Pauli | SparsePauliOp, float], None]'."
75
75
  ),
76
- pending=True,
77
76
  )
78
77
  def __init__(
79
78
  self,
@@ -16,10 +16,17 @@ Convenience function to load RZXGate based templates.
16
16
 
17
17
  from enum import Enum
18
18
  from typing import List, Dict
19
+ from qiskit.utils import deprecate_func
19
20
 
20
21
  from qiskit.circuit.library.templates import rzx
21
22
 
22
23
 
24
+ @deprecate_func(
25
+ since="1.4",
26
+ removal_timeline="in Qiskit 2.0",
27
+ additional_msg="Use the functions in "
28
+ "qiskit.circuit.library.templates.rzx instead to generate rzx templates",
29
+ )
23
30
  def rzx_templates(template_list: List[str] = None) -> Dict:
24
31
  """Convenience function to get the cost_dict and templates for template matching.
25
32
 
@@ -59,6 +59,7 @@ class ApplyLayout(TransformationPass):
59
59
  q = QuantumRegister(len(layout), "q")
60
60
 
61
61
  new_dag = DAGCircuit()
62
+ new_dag.name = dag.name
62
63
  new_dag.add_qreg(q)
63
64
  for var in dag.iter_input_vars():
64
65
  new_dag.add_input_var(var)
@@ -21,6 +21,8 @@ from qiskit.transpiler.basepasses import AnalysisPass
21
21
  from qiskit.transpiler.exceptions import TranspilerError
22
22
  from qiskit.transpiler.passes.layout import disjoint_utils
23
23
 
24
+ from qiskit.utils import deprecate_arg
25
+
24
26
  from qiskit._accelerate.dense_layout import best_subset
25
27
 
26
28
 
@@ -36,6 +38,16 @@ class DenseLayout(AnalysisPass):
36
38
  by being set in ``property_set``.
37
39
  """
38
40
 
41
+ @deprecate_arg(
42
+ name="backend_prop",
43
+ since="1.4",
44
+ package_name="Qiskit",
45
+ removal_timeline="in Qiskit 2.0",
46
+ additional_msg="The BackendProperties data structure has been deprecated and will be "
47
+ "removed in Qiskit 2.0. The `target` input argument should be used instead. "
48
+ "You can use Target.from_configuration() to build the target from the properties "
49
+ "object, but in 2.0 you will need to generate a target directly.",
50
+ )
39
51
  def __init__(self, coupling_map=None, backend_prop=None, target=None):
40
52
  """DenseLayout initializer.
41
53
 
@@ -24,6 +24,7 @@ from qiskit.transpiler.basepasses import AnalysisPass
24
24
  from qiskit.transpiler.exceptions import TranspilerError
25
25
  from qiskit.transpiler.passes.layout import vf2_utils
26
26
 
27
+ from qiskit.utils import deprecate_arg
27
28
 
28
29
  logger = logging.getLogger(__name__)
29
30
 
@@ -73,6 +74,16 @@ class VF2Layout(AnalysisPass):
73
74
  ``vf2_avg_error_map`` key in the property set when :class:`~.VF2Layout` is run.
74
75
  """
75
76
 
77
+ @deprecate_arg(
78
+ name="properties",
79
+ since="1.4",
80
+ package_name="Qiskit",
81
+ removal_timeline="in Qiskit 2.0",
82
+ additional_msg="The BackendProperties data structure has been deprecated and will be "
83
+ "removed in Qiskit 2.0. The `target` input argument should be used instead. "
84
+ "You can use Target.from_configuration() to build the target from the properties "
85
+ "object, but in 2.0 you will need to generate a target directly.",
86
+ )
76
87
  def __init__(
77
88
  self,
78
89
  coupling_map=None,
@@ -26,6 +26,7 @@ from qiskit.transpiler.exceptions import TranspilerError
26
26
  from qiskit.providers.exceptions import BackendPropertyError
27
27
  from qiskit.transpiler.passes.layout import vf2_utils
28
28
 
29
+ from qiskit.utils import deprecate_arg
29
30
 
30
31
  logger = logging.getLogger(__name__)
31
32
 
@@ -99,6 +100,27 @@ class VF2PostLayout(AnalysisPass):
99
100
  is run.
100
101
  """
101
102
 
103
+ @deprecate_arg(
104
+ name="properties",
105
+ since="1.4",
106
+ package_name="Qiskit",
107
+ removal_timeline="in Qiskit 2.0",
108
+ additional_msg="The BackendProperties data structure has been deprecated and will be "
109
+ "removed in Qiskit 2.0. The `target` input argument should be used instead. "
110
+ "You can use Target.from_configuration() to build the target from the properties "
111
+ "object, but in 2.0 you will need to generate a target directly.",
112
+ )
113
+ @deprecate_arg(
114
+ name="coupling_map",
115
+ since="1.4",
116
+ package_name="Qiskit",
117
+ removal_timeline="in Qiskit 2.0",
118
+ additional_msg="This argument was only used with `properties`, which relied on "
119
+ "the deprecated BackendProperties data structure. The `target` input argument "
120
+ "should be used instead. "
121
+ "You can use Target.from_configuration() to build the target from coupling "
122
+ "map + properties, but in 2.0 you will need to generate a target directly.",
123
+ )
102
124
  def __init__(
103
125
  self,
104
126
  target=None,
@@ -20,6 +20,8 @@ that differ within a resolution provided by the user.
20
20
 
21
21
  import numpy as np
22
22
 
23
+ from qiskit.utils import deprecate_func
24
+
23
25
  from qiskit.transpiler.basepasses import TransformationPass
24
26
  from qiskit.dagcircuit import DAGCircuit
25
27
  from qiskit.circuit.library.standard_gates import RXGate, RZGate, SXGate, XGate
@@ -48,6 +50,12 @@ class NormalizeRXAngle(TransformationPass):
48
50
  Note that pulse calibration might be attached per each rotation angle.
49
51
  """
50
52
 
53
+ @deprecate_func(
54
+ since="1.4",
55
+ removal_timeline="in Qiskit 2.0",
56
+ additional_msg="This pass was used as pre-processing step of ``RXCalibrationBuilder``."
57
+ " With the removal of Pulse in Qiskit 2.0, this pass is no longer needed.",
58
+ )
51
59
  def __init__(self, target=None, resolution_in_radian=0):
52
60
  """NormalizeRXAngle initializer.
53
61
 
@@ -11,12 +11,20 @@
11
11
  # that they have been altered from the originals.
12
12
 
13
13
  """Search for star connectivity patterns and replace them with."""
14
+ import itertools
14
15
  from typing import Iterable, Union, Optional, List, Tuple
15
16
  from math import floor, log10
16
17
 
17
18
  from qiskit.circuit import SwitchCaseOp, Clbit, ClassicalRegister, Barrier
18
19
  from qiskit.circuit.controlflow import condition_resources, node_resources
19
- from qiskit.dagcircuit import DAGOpNode, DAGDepNode, DAGDependency, DAGCircuit
20
+ from qiskit.dagcircuit import (
21
+ DAGOpNode,
22
+ DAGDepNode,
23
+ DAGDependency,
24
+ DAGCircuit,
25
+ DAGOutNode,
26
+ DAGInNode,
27
+ )
20
28
  from qiskit.transpiler.basepasses import TransformationPass
21
29
  from qiskit.transpiler.layout import Layout
22
30
  from qiskit.transpiler.passes.routing.sabre_swap import _build_sabre_dag, _apply_sabre_result
@@ -331,7 +339,14 @@ class StarPreRouting(TransformationPass):
331
339
  }
332
340
 
333
341
  def tie_breaker_key(node):
334
- return processing_order_index_map.get(node, node.sort_key)
342
+ processing_order = processing_order_index_map.get(node, None)
343
+ if processing_order is not None:
344
+ return processing_order
345
+ if isinstance(node, (DAGInNode, DAGOutNode)):
346
+ return str(node.wire)
347
+ return ",".join(
348
+ f"{dag.find_bit(q).index:04d}" for q in itertools.chain(node.qargs, node.cargs)
349
+ )
335
350
 
336
351
  rust_processing_order = _extract_nodes(dag.topological_op_nodes(key=tie_breaker_key), dag)
337
352
 
@@ -73,6 +73,7 @@ from qiskit.transpiler.passes.optimization.optimize_1q_decomposition import (
73
73
  from qiskit.transpiler.passes.synthesis import plugin
74
74
  from qiskit.transpiler.target import Target
75
75
 
76
+ from qiskit.utils.deprecation import deprecate_arg
76
77
  from qiskit._accelerate.unitary_synthesis import run_default_main_loop
77
78
 
78
79
  GATE_NAME_MAP = {
@@ -315,6 +316,16 @@ def _preferred_direction(
315
316
  class UnitarySynthesis(TransformationPass):
316
317
  """Synthesize gates according to their basis gates."""
317
318
 
319
+ @deprecate_arg(
320
+ name="backend_props",
321
+ since="1.4",
322
+ package_name="Qiskit",
323
+ removal_timeline="in Qiskit 2.0",
324
+ additional_msg="The BackendProperties data structure has been deprecated and will be "
325
+ "removed in Qiskit 2.0. The `target` input argument should be used instead. "
326
+ "You can use Target.from_configuration() to build the target from the properties "
327
+ "object, but in 2.0 you will need to generate a target directly.",
328
+ )
318
329
  def __init__(
319
330
  self,
320
331
  basis_gates: list[str] = None,