qiskit-aer 0.17.2__cp314-cp314-win_amd64.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 (83) hide show
  1. qiskit_aer/VERSION.txt +1 -0
  2. qiskit_aer/__init__.py +89 -0
  3. qiskit_aer/aererror.py +30 -0
  4. qiskit_aer/aerprovider.py +119 -0
  5. qiskit_aer/backends/__init__.py +20 -0
  6. qiskit_aer/backends/aer_compiler.py +1085 -0
  7. qiskit_aer/backends/aer_simulator.py +1025 -0
  8. qiskit_aer/backends/aerbackend.py +679 -0
  9. qiskit_aer/backends/backend_utils.py +567 -0
  10. qiskit_aer/backends/backendconfiguration.py +395 -0
  11. qiskit_aer/backends/backendproperties.py +590 -0
  12. qiskit_aer/backends/compatibility.py +287 -0
  13. qiskit_aer/backends/controller_wrappers.cp314-win_amd64.pyd +0 -0
  14. qiskit_aer/backends/libopenblas.dll +0 -0
  15. qiskit_aer/backends/name_mapping.py +306 -0
  16. qiskit_aer/backends/qasm_simulator.py +925 -0
  17. qiskit_aer/backends/statevector_simulator.py +330 -0
  18. qiskit_aer/backends/unitary_simulator.py +316 -0
  19. qiskit_aer/jobs/__init__.py +35 -0
  20. qiskit_aer/jobs/aerjob.py +143 -0
  21. qiskit_aer/jobs/utils.py +66 -0
  22. qiskit_aer/library/__init__.py +204 -0
  23. qiskit_aer/library/control_flow_instructions/__init__.py +16 -0
  24. qiskit_aer/library/control_flow_instructions/jump.py +47 -0
  25. qiskit_aer/library/control_flow_instructions/mark.py +30 -0
  26. qiskit_aer/library/control_flow_instructions/store.py +29 -0
  27. qiskit_aer/library/default_qubits.py +44 -0
  28. qiskit_aer/library/instructions_table.csv +21 -0
  29. qiskit_aer/library/save_instructions/__init__.py +44 -0
  30. qiskit_aer/library/save_instructions/save_amplitudes.py +168 -0
  31. qiskit_aer/library/save_instructions/save_clifford.py +63 -0
  32. qiskit_aer/library/save_instructions/save_data.py +129 -0
  33. qiskit_aer/library/save_instructions/save_density_matrix.py +91 -0
  34. qiskit_aer/library/save_instructions/save_expectation_value.py +257 -0
  35. qiskit_aer/library/save_instructions/save_matrix_product_state.py +71 -0
  36. qiskit_aer/library/save_instructions/save_probabilities.py +156 -0
  37. qiskit_aer/library/save_instructions/save_stabilizer.py +70 -0
  38. qiskit_aer/library/save_instructions/save_state.py +79 -0
  39. qiskit_aer/library/save_instructions/save_statevector.py +120 -0
  40. qiskit_aer/library/save_instructions/save_superop.py +62 -0
  41. qiskit_aer/library/save_instructions/save_unitary.py +63 -0
  42. qiskit_aer/library/set_instructions/__init__.py +19 -0
  43. qiskit_aer/library/set_instructions/set_density_matrix.py +78 -0
  44. qiskit_aer/library/set_instructions/set_matrix_product_state.py +83 -0
  45. qiskit_aer/library/set_instructions/set_stabilizer.py +77 -0
  46. qiskit_aer/library/set_instructions/set_statevector.py +78 -0
  47. qiskit_aer/library/set_instructions/set_superop.py +78 -0
  48. qiskit_aer/library/set_instructions/set_unitary.py +78 -0
  49. qiskit_aer/noise/__init__.py +265 -0
  50. qiskit_aer/noise/device/__init__.py +25 -0
  51. qiskit_aer/noise/device/models.py +397 -0
  52. qiskit_aer/noise/device/parameters.py +202 -0
  53. qiskit_aer/noise/errors/__init__.py +30 -0
  54. qiskit_aer/noise/errors/base_quantum_error.py +119 -0
  55. qiskit_aer/noise/errors/pauli_error.py +283 -0
  56. qiskit_aer/noise/errors/pauli_lindblad_error.py +363 -0
  57. qiskit_aer/noise/errors/quantum_error.py +451 -0
  58. qiskit_aer/noise/errors/readout_error.py +355 -0
  59. qiskit_aer/noise/errors/standard_errors.py +498 -0
  60. qiskit_aer/noise/noise_model.py +1231 -0
  61. qiskit_aer/noise/noiseerror.py +30 -0
  62. qiskit_aer/noise/passes/__init__.py +18 -0
  63. qiskit_aer/noise/passes/local_noise_pass.py +160 -0
  64. qiskit_aer/noise/passes/relaxation_noise_pass.py +137 -0
  65. qiskit_aer/primitives/__init__.py +44 -0
  66. qiskit_aer/primitives/estimator.py +751 -0
  67. qiskit_aer/primitives/estimator_v2.py +159 -0
  68. qiskit_aer/primitives/sampler.py +361 -0
  69. qiskit_aer/primitives/sampler_v2.py +256 -0
  70. qiskit_aer/quantum_info/__init__.py +32 -0
  71. qiskit_aer/quantum_info/states/__init__.py +16 -0
  72. qiskit_aer/quantum_info/states/aer_densitymatrix.py +313 -0
  73. qiskit_aer/quantum_info/states/aer_state.py +525 -0
  74. qiskit_aer/quantum_info/states/aer_statevector.py +302 -0
  75. qiskit_aer/utils/__init__.py +44 -0
  76. qiskit_aer/utils/noise_model_inserter.py +66 -0
  77. qiskit_aer/utils/noise_transformation.py +431 -0
  78. qiskit_aer/version.py +86 -0
  79. qiskit_aer-0.17.2.dist-info/METADATA +209 -0
  80. qiskit_aer-0.17.2.dist-info/RECORD +83 -0
  81. qiskit_aer-0.17.2.dist-info/WHEEL +5 -0
  82. qiskit_aer-0.17.2.dist-info/licenses/LICENSE.txt +203 -0
  83. qiskit_aer-0.17.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,287 @@
1
+ # This code is part of Qiskit.
2
+ #
3
+ # (C) Copyright IBM 2018, 2021.
4
+ #
5
+ # This code is licensed under the Apache License, Version 2.0. You may
6
+ # obtain a copy of this license in the LICENSE.txt file in the root directory
7
+ # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8
+ #
9
+ # Any modifications or derivative works of this code must retain this
10
+ # copyright notice, and modified files need to carry a notice indicating
11
+ # that they have been altered from the originals.
12
+ """
13
+ Compatibility classes for changes to save instruction return types.
14
+
15
+ These subclasses include a `__getattr__` method that allows existing
16
+ code which used numpy.ndarray attributes to continue functioning with
17
+ a deprecation warning.
18
+
19
+ Numpy functions that consumed these classes should already work due to
20
+ them having an `__array__` method for implicit array conversion.
21
+ """
22
+
23
+ import warnings
24
+ import numpy as np
25
+ import qiskit.quantum_info as qi
26
+
27
+
28
+ def _forward_attr(attr):
29
+ """Return True if attribute should be passed to legacy class"""
30
+ # Pass Iterable magic methods on to the Numpy array. We can't pass
31
+ # `__getitem__` (and consequently `__setitem__`, `__delitem__`) on because
32
+ # `Statevector` implements them itself.
33
+ if attr[:2] == "__" or attr in ["_data", "_op_shape"]:
34
+ return False
35
+ return True
36
+
37
+
38
+ def _deprecation_warning(instance, instances_name):
39
+ class_name = instance.__class__.__name__
40
+ warnings.warn(
41
+ f"The return type of saved {instances_name} has been changed from"
42
+ f" a `numpy.ndarray` to a `qiskit.quantum_info.{class_name}` as"
43
+ " of qiskit-aer 0.10. Accessing numpy array attributes is deprecated"
44
+ " and will result in an error in a future release. To continue using"
45
+ " saved result objects as arrays you can explicitly cast them using "
46
+ " `np.asarray(object)`.",
47
+ DeprecationWarning,
48
+ stacklevel=3,
49
+ )
50
+
51
+
52
+ class Statevector(qi.Statevector):
53
+ """Aer result backwards compatibility wrapper for qiskit Statevector."""
54
+
55
+ def __getattr__(self, attr):
56
+ if _forward_attr(attr) and hasattr(self._data, attr):
57
+ _deprecation_warning(self, "statevectors")
58
+ return getattr(self._data, attr)
59
+ return getattr(super(), attr)
60
+
61
+ def __eq__(self, other):
62
+ return (
63
+ isinstance(self, type(other))
64
+ and self._op_shape == other._op_shape
65
+ and np.allclose(self.data, other.data, rtol=self.rtol, atol=self.atol)
66
+ )
67
+
68
+ def __bool__(self):
69
+ # Explicit override to the default behaviour for Python objects to
70
+ # prevent the new `__len__` from messing with it.
71
+ return True
72
+
73
+ # Magic methods for the iterable/collection interface that need forwarding,
74
+ # but bypass `__getattr__`. `__getitem__` is defined by `Statevector`, so
75
+ # that can't be forwarded (and consequently neither can `__setitem__`
76
+ # without introducing an inconsistency).
77
+
78
+ def __len__(self):
79
+ _deprecation_warning(self, "statevectors")
80
+ return self._data.__len__()
81
+
82
+ def __iter__(self):
83
+ _deprecation_warning(self, "statevectors")
84
+ return self._data.__iter__()
85
+
86
+ def __contains__(self, value):
87
+ _deprecation_warning(self, "statevectors")
88
+ return self._data.__contains__(value)
89
+
90
+ def __reversed__(self):
91
+ _deprecation_warning(self, "statevectors")
92
+ return self._data.__reversed__()
93
+
94
+
95
+ class DensityMatrix(qi.DensityMatrix):
96
+ """Aer result backwards compatibility wrapper for qiskit DensityMatrix."""
97
+
98
+ def __getattr__(self, attr):
99
+ if _forward_attr(attr) and hasattr(self._data, attr):
100
+ _deprecation_warning(self, "density matrices")
101
+ return getattr(self._data, attr)
102
+ return getattr(super(), attr)
103
+
104
+ def __eq__(self, other):
105
+ return (
106
+ isinstance(self, type(other))
107
+ and self._op_shape == other._op_shape
108
+ and np.allclose(self.data, other.data, rtol=self.rtol, atol=self.atol)
109
+ )
110
+
111
+ def __len__(self):
112
+ _deprecation_warning(self, "density matrices")
113
+ return self._data.__len__()
114
+
115
+ def __iter__(self):
116
+ _deprecation_warning(self, "density matrices")
117
+ return self._data.__iter__()
118
+
119
+ def __contains__(self, value):
120
+ _deprecation_warning(self, "density matrices")
121
+ return self._data.__contains__(value)
122
+
123
+ def __reversed__(self):
124
+ _deprecation_warning(self, "density matrices")
125
+ return self._data.__reversed__()
126
+
127
+ def __getitem__(self, key):
128
+ _deprecation_warning(self, "density matrices")
129
+ return self._data.__getitem__(key)
130
+
131
+ def __setitem__(self, key, value):
132
+ _deprecation_warning(self, "density matrices")
133
+ return self._data.__setitem__(key, value)
134
+
135
+
136
+ class Operator(qi.Operator):
137
+ """Aer result backwards compatibility wrapper for qiskit Operator."""
138
+
139
+ def __getattr__(self, attr):
140
+ if _forward_attr(attr) and hasattr(self._data, attr):
141
+ _deprecation_warning(self, "unitaries")
142
+ return getattr(self._data, attr)
143
+ return getattr(super(), attr)
144
+
145
+ def __eq__(self, other):
146
+ return (
147
+ isinstance(self, type(other))
148
+ and self._op_shape == other._op_shape
149
+ and np.allclose(self.data, other.data, rtol=self.rtol, atol=self.atol)
150
+ )
151
+
152
+ def __bool__(self):
153
+ # Explicit override to the default behaviour for Python objects to
154
+ # prevent the new `__len__` from messing with it.
155
+ return True
156
+
157
+ def __len__(self):
158
+ _deprecation_warning(self, "unitaries")
159
+ return self._data.__len__()
160
+
161
+ def __iter__(self):
162
+ _deprecation_warning(self, "unitaries")
163
+ return self._data.__iter__()
164
+
165
+ def __contains__(self, value):
166
+ _deprecation_warning(self, "unitaries")
167
+ return self._data.__contains__(value)
168
+
169
+ def __reversed__(self):
170
+ _deprecation_warning(self, "unitaries")
171
+ return self._data.__reversed__()
172
+
173
+ def __getitem__(self, key):
174
+ _deprecation_warning(self, "unitaries")
175
+ return self._data.__getitem__(key)
176
+
177
+ def __setitem__(self, key, value):
178
+ _deprecation_warning(self, "unitaries")
179
+ return self._data.__setitem__(key, value)
180
+
181
+
182
+ class SuperOp(qi.SuperOp):
183
+ """Aer result backwards compatibility wrapper for qiskit SuperOp."""
184
+
185
+ def __getattr__(self, attr):
186
+ if _forward_attr(attr) and hasattr(self._data, attr):
187
+ _deprecation_warning(self, "superoperators")
188
+ return getattr(self._data, attr)
189
+ return getattr(super(), attr)
190
+
191
+ def __eq__(self, other):
192
+ return (
193
+ isinstance(self, type(other))
194
+ and self._op_shape == other._op_shape
195
+ and np.allclose(self.data, other.data, rtol=self.rtol, atol=self.atol)
196
+ )
197
+
198
+ def __bool__(self):
199
+ # Explicit override to the default behaviour for Python objects to
200
+ # prevent the new `__len__` from messing with it.
201
+ return True
202
+
203
+ def __len__(self):
204
+ _deprecation_warning(self, "superoperators")
205
+ return self._data.__len__()
206
+
207
+ def __iter__(self):
208
+ _deprecation_warning(self, "superoperators")
209
+ return self._data.__iter__()
210
+
211
+ def __contains__(self, value):
212
+ _deprecation_warning(self, "superoperators")
213
+ return self._data.__contains__(value)
214
+
215
+ def __reversed__(self):
216
+ _deprecation_warning(self, "superoperators")
217
+ return self._data.__reversed__()
218
+
219
+ def __getitem__(self, key):
220
+ _deprecation_warning(self, "superoperators")
221
+ return self._data.__getitem__(key)
222
+
223
+ def __setitem__(self, key, value):
224
+ _deprecation_warning(self, "superoperators")
225
+ return self._data.__setitem__(key, value)
226
+
227
+
228
+ class StabilizerState(qi.StabilizerState):
229
+ """Aer result backwards compatibility wrapper for qiskit StabilizerState."""
230
+
231
+ def __deprecation_warning(self):
232
+ warnings.warn(
233
+ "The return type of saved stabilizers has been changed from"
234
+ " a `dict` to a `qiskit.quantum_info.StabilizerState` as of qiskit-aer 0.10."
235
+ " Accessing dict attributes is deprecated and will result in an"
236
+ " error in a future release. Use the `.clifford.to_dict()` methods to access "
237
+ " the stored Clifford operator and convert to a dictionary.",
238
+ DeprecationWarning,
239
+ stacklevel=3,
240
+ )
241
+
242
+ def __getattr__(self, attr):
243
+ if _forward_attr(attr) and hasattr(dict, attr):
244
+ self.__deprecation_warning()
245
+ return getattr(self._data.to_dict(), attr)
246
+ return getattr(super(), attr)
247
+
248
+ def __getitem__(self, item):
249
+ if item in ["stabilizer", "destabilizer"]:
250
+ warnings.warn(
251
+ "The return type of saved stabilizers has been changed from"
252
+ " a `dict` to a `qiskit.quantum_info.StabilizerState` as of qiskit-aer 0.10."
253
+ " Accessing dict items is deprecated and will result in an"
254
+ " error in a future release. Use the `.clifford.to_dict()` methods to access "
255
+ " the stored Clifford operator and convert to a dictionary.",
256
+ DeprecationWarning,
257
+ stacklevel=2,
258
+ )
259
+ return self._data.to_dict()[item]
260
+ raise TypeError("'StabilizerState object is not subscriptable'")
261
+
262
+ def __bool__(self):
263
+ # Explicit override to the default behaviour for Python objects to
264
+ # prevent the new `__len__` from messing with it.
265
+ return True
266
+
267
+ def __len__(self):
268
+ self.__deprecation_warning()
269
+ return self._data.to_dict().__len__()
270
+
271
+ def __iter__(self):
272
+ self.__deprecation_warning()
273
+ return self._data.to_dict().__iter__()
274
+
275
+ def __contains__(self, value):
276
+ self.__deprecation_warning()
277
+ return self._data.to_dict().__contains__(value)
278
+
279
+ def __reversed__(self):
280
+ self.__deprecation_warning()
281
+ return self._data.to_dict().__reversed__()
282
+
283
+ def _add(self, other):
284
+ raise NotImplementedError(f"{type(self)} does not support addition")
285
+
286
+ def _multiply(self, other):
287
+ raise NotImplementedError(f"{type(self)} does not support scalar multiplication")
Binary file
@@ -0,0 +1,306 @@
1
+ # This code is part of Qiskit.
2
+ #
3
+ # (C) Copyright IBM 2018, 2019.
4
+ #
5
+ # This code is licensed under the Apache License, Version 2.0. You may
6
+ # obtain a copy of this license in the LICENSE.txt file in the root directory
7
+ # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8
+ #
9
+ # Any modifications or derivative works of this code must retain this
10
+ # copyright notice, and modified files need to carry a notice indicating
11
+ # that they have been altered from the originals.
12
+
13
+ # pylint: disable=invalid-name
14
+ """
15
+ Qiskit Aer simulator name mapping for Target object
16
+ """
17
+ from qiskit.circuit import ControlledGate, Parameter
18
+ from qiskit.circuit.reset import Reset
19
+ from qiskit.circuit.store import Store
20
+ from qiskit.circuit.library import (
21
+ U2Gate,
22
+ RGate,
23
+ CYGate,
24
+ CZGate,
25
+ CSXGate,
26
+ CU3Gate,
27
+ CSwapGate,
28
+ PauliGate,
29
+ DiagonalGate,
30
+ UnitaryGate,
31
+ MCPhaseGate,
32
+ MCXGate,
33
+ CRXGate,
34
+ CRYGate,
35
+ CRZGate,
36
+ MCU1Gate,
37
+ MCXGrayCode,
38
+ Initialize,
39
+ UCGate,
40
+ )
41
+ from qiskit.circuit.controlflow import (
42
+ IfElseOp,
43
+ WhileLoopOp,
44
+ ForLoopOp,
45
+ ContinueLoopOp,
46
+ BreakLoopOp,
47
+ SwitchCaseOp,
48
+ )
49
+ from qiskit.quantum_info.operators.channel.kraus import Kraus
50
+ from qiskit.quantum_info.operators.channel import SuperOp
51
+ from qiskit.quantum_info.operators.channel.quantum_channel import QuantumChannel
52
+
53
+ from ..library import (
54
+ SaveExpectationValue,
55
+ SaveAmplitudes,
56
+ SaveStatevectorDict,
57
+ SaveSuperOp,
58
+ SaveClifford,
59
+ SaveMatrixProductState,
60
+ SaveDensityMatrix,
61
+ SaveProbabilities,
62
+ SaveStatevector,
63
+ SetDensityMatrix,
64
+ SetUnitary,
65
+ SaveState,
66
+ SetMatrixProductState,
67
+ SaveUnitary,
68
+ SetSuperOp,
69
+ SaveExpectationValueVariance,
70
+ SaveStabilizer,
71
+ SetStatevector,
72
+ SetStabilizer,
73
+ SaveAmplitudesSquared,
74
+ SaveProbabilitiesDict,
75
+ )
76
+ from ..noise.errors import ReadoutError
77
+ from ..noise.noise_model import QuantumErrorLocation
78
+
79
+
80
+ class MCSXGate(ControlledGate):
81
+ """mcsx gate"""
82
+
83
+ def __init__(self, num_ctrl_qubits, ctrl_state=None):
84
+ super().__init__(
85
+ "mcsx",
86
+ 1 + num_ctrl_qubits,
87
+ [],
88
+ None,
89
+ num_ctrl_qubits,
90
+ ctrl_state=ctrl_state,
91
+ base_gate=CSXGate(),
92
+ )
93
+
94
+
95
+ class MCYGate(ControlledGate):
96
+ """mcy gate"""
97
+
98
+ def __init__(self, num_ctrl_qubits, ctrl_state=None):
99
+ super().__init__(
100
+ "mcy",
101
+ 1 + num_ctrl_qubits,
102
+ [],
103
+ None,
104
+ num_ctrl_qubits,
105
+ ctrl_state=ctrl_state,
106
+ base_gate=CYGate(),
107
+ )
108
+
109
+
110
+ class MCZGate(ControlledGate):
111
+ """mcz gate"""
112
+
113
+ def __init__(self, num_ctrl_qubits, ctrl_state=None):
114
+ super().__init__(
115
+ "mcz",
116
+ 1 + num_ctrl_qubits,
117
+ [],
118
+ None,
119
+ num_ctrl_qubits,
120
+ ctrl_state=ctrl_state,
121
+ base_gate=CZGate(),
122
+ )
123
+
124
+
125
+ class MCRXGate(ControlledGate):
126
+ """mcrx gate"""
127
+
128
+ def __init__(self, theta, num_ctrl_qubits, ctrl_state=None):
129
+ super().__init__(
130
+ "mcrx",
131
+ 1 + num_ctrl_qubits,
132
+ [theta],
133
+ None,
134
+ num_ctrl_qubits,
135
+ ctrl_state=ctrl_state,
136
+ base_gate=CRXGate(theta),
137
+ )
138
+
139
+
140
+ class MCRYGate(ControlledGate):
141
+ """mcry gate"""
142
+
143
+ def __init__(self, theta, num_ctrl_qubits, ctrl_state=None):
144
+ super().__init__(
145
+ "mcry",
146
+ 1 + num_ctrl_qubits,
147
+ [theta],
148
+ None,
149
+ num_ctrl_qubits,
150
+ ctrl_state=ctrl_state,
151
+ base_gate=CRYGate(theta),
152
+ )
153
+
154
+
155
+ class MCRZGate(ControlledGate):
156
+ """mcrz gate"""
157
+
158
+ def __init__(self, theta, num_ctrl_qubits, ctrl_state=None):
159
+ super().__init__(
160
+ "mcrz",
161
+ 1 + num_ctrl_qubits,
162
+ [theta],
163
+ None,
164
+ num_ctrl_qubits,
165
+ ctrl_state=ctrl_state,
166
+ base_gate=CRZGate(theta),
167
+ )
168
+
169
+
170
+ class MCRGate(ControlledGate):
171
+ """mcr gate"""
172
+
173
+ def __init__(self, theta, phi, num_ctrl_qubits, ctrl_state=None):
174
+ super().__init__(
175
+ "mcr",
176
+ 1 + num_ctrl_qubits,
177
+ [theta, phi],
178
+ None,
179
+ num_ctrl_qubits,
180
+ ctrl_state=ctrl_state,
181
+ base_gate=RGate(theta, phi),
182
+ )
183
+
184
+
185
+ class MCU2Gate(ControlledGate):
186
+ """mcu2 gate"""
187
+
188
+ def __init__(self, theta, lam, num_ctrl_qubits, ctrl_state=None):
189
+ super().__init__(
190
+ "mcu2",
191
+ 1 + num_ctrl_qubits,
192
+ [theta, lam],
193
+ None,
194
+ num_ctrl_qubits,
195
+ ctrl_state=ctrl_state,
196
+ base_gate=U2Gate(theta, lam),
197
+ )
198
+
199
+
200
+ class MCU3Gate(ControlledGate):
201
+ """mcu3 gate"""
202
+
203
+ def __init__(self, theta, lam, phi, num_ctrl_qubits, ctrl_state=None):
204
+ super().__init__(
205
+ "mcu3",
206
+ 1 + num_ctrl_qubits,
207
+ [theta, phi, lam],
208
+ None,
209
+ num_ctrl_qubits,
210
+ ctrl_state=ctrl_state,
211
+ base_gate=CU3Gate(theta, phi, lam),
212
+ )
213
+
214
+
215
+ class MCUGate(ControlledGate):
216
+ """mcu gate"""
217
+
218
+ def __init__(self, theta, lam, phi, num_ctrl_qubits, ctrl_state=None):
219
+ super().__init__(
220
+ "mcu",
221
+ 1 + num_ctrl_qubits,
222
+ [theta, phi, lam],
223
+ None,
224
+ num_ctrl_qubits,
225
+ ctrl_state=ctrl_state,
226
+ base_gate=CU3Gate(theta, phi, lam),
227
+ )
228
+
229
+
230
+ class MCSwapGate(ControlledGate):
231
+ """mcswap gate"""
232
+
233
+ def __init__(self, num_ctrl_qubits, ctrl_state=None):
234
+ super().__init__(
235
+ "mcswap",
236
+ 2 + num_ctrl_qubits,
237
+ [],
238
+ None,
239
+ num_ctrl_qubits,
240
+ ctrl_state=ctrl_state,
241
+ base_gate=CSwapGate(),
242
+ )
243
+
244
+
245
+ PHI = Parameter("phi")
246
+ LAM = Parameter("lam")
247
+ NAME_MAPPING = {
248
+ "cu2": U2Gate(PHI, LAM).control(),
249
+ "pauli": PauliGate,
250
+ "diagonal": DiagonalGate,
251
+ "unitary": UnitaryGate,
252
+ "mcsx": MCSXGate,
253
+ "mcp": MCPhaseGate,
254
+ "mcphase": MCPhaseGate,
255
+ "mcu": MCUGate,
256
+ "mcu1": MCU1Gate,
257
+ "mcu2": MCU2Gate,
258
+ "mcu3": MCU3Gate,
259
+ "mcx": MCXGate,
260
+ "mcy": MCYGate,
261
+ "mcz": MCZGate,
262
+ "mcr": MCRGate,
263
+ "mcrx": MCRXGate,
264
+ "mcry": MCRYGate,
265
+ "mcrz": MCRZGate,
266
+ "mcx_gray": MCXGrayCode,
267
+ "mcswap": MCSwapGate,
268
+ "multiplexer": UCGate,
269
+ "kraus": Kraus,
270
+ "superop": SuperOp,
271
+ "initialize": Initialize,
272
+ "quantum_channel": QuantumChannel,
273
+ "save_expval": SaveExpectationValue,
274
+ "save_amplitudes": SaveAmplitudes,
275
+ "roerror": ReadoutError,
276
+ "save_statevector_dict": SaveStatevectorDict,
277
+ "save_superop": SaveSuperOp,
278
+ "save_clifford": SaveClifford,
279
+ "save_matrix_product_state": SaveMatrixProductState,
280
+ "save_density_matrix": SaveDensityMatrix,
281
+ "save_probabilities": SaveProbabilities,
282
+ "if_else": IfElseOp,
283
+ "while_loop": WhileLoopOp,
284
+ "for_loop": ForLoopOp,
285
+ "switch_case": SwitchCaseOp,
286
+ "break_loop": BreakLoopOp,
287
+ "continue_loop": ContinueLoopOp,
288
+ "save_statevector": SaveStatevector,
289
+ "set_density_matrix": SetDensityMatrix,
290
+ "qerror_loc": QuantumErrorLocation,
291
+ "set_unitary": SetUnitary,
292
+ "save_state": SaveState,
293
+ "set_matrix_product_state": SetMatrixProductState,
294
+ "save_unitary": SaveUnitary,
295
+ "set_superop": SetSuperOp,
296
+ "save_expval_var": SaveExpectationValueVariance,
297
+ "save_stabilizer": SaveStabilizer,
298
+ "set_statevector": SetStatevector,
299
+ "set_stabilizer": SetStabilizer,
300
+ "save_amplitudes_sq": SaveAmplitudesSquared,
301
+ "save_probabilities_dict": SaveProbabilitiesDict,
302
+ "save_probs_ket": SaveProbabilitiesDict,
303
+ "save_probs": SaveProbabilities,
304
+ "reset": Reset(),
305
+ "store": Store,
306
+ }