qiskit 1.3.0rc1__cp39-abi3-win32.whl → 1.3.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.
Files changed (33) hide show
  1. qiskit/VERSION.txt +1 -1
  2. qiskit/_accelerate.pyd +0 -0
  3. qiskit/circuit/add_control.py +110 -92
  4. qiskit/circuit/library/__init__.py +37 -10
  5. qiskit/circuit/library/arithmetic/adders/adder.py +30 -5
  6. qiskit/circuit/library/arithmetic/adders/cdkm_ripple_carry_adder.py +1 -1
  7. qiskit/circuit/library/arithmetic/adders/draper_qft_adder.py +1 -1
  8. qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py +1 -1
  9. qiskit/circuit/library/arithmetic/multipliers/multiplier.py +9 -0
  10. qiskit/primitives/utils.py +1 -1
  11. qiskit/providers/__init__.py +2 -2
  12. qiskit/qpy/__init__.py +5 -5
  13. qiskit/quantum_info/operators/channel/chi.py +9 -9
  14. qiskit/quantum_info/operators/channel/choi.py +9 -9
  15. qiskit/quantum_info/operators/channel/ptm.py +9 -9
  16. qiskit/quantum_info/operators/channel/quantum_channel.py +3 -3
  17. qiskit/quantum_info/operators/channel/stinespring.py +9 -9
  18. qiskit/quantum_info/operators/channel/superop.py +5 -9
  19. qiskit/quantum_info/states/densitymatrix.py +17 -15
  20. qiskit/quantum_info/states/stabilizerstate.py +7 -6
  21. qiskit/quantum_info/states/statevector.py +15 -7
  22. qiskit/transpiler/passes/basis/decompose.py +24 -4
  23. qiskit/transpiler/passes/optimization/consolidate_blocks.py +10 -3
  24. qiskit/transpiler/passes/optimization/inverse_cancellation.py +2 -0
  25. qiskit/transpiler/passes/synthesis/high_level_synthesis.py +8 -9
  26. qiskit/transpiler/passes/synthesis/hls_plugins.py +89 -21
  27. qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +4 -3
  28. {qiskit-1.3.0rc1.dist-info → qiskit-1.3.1.dist-info}/METADATA +18 -18
  29. {qiskit-1.3.0rc1.dist-info → qiskit-1.3.1.dist-info}/RECORD +33 -33
  30. {qiskit-1.3.0rc1.dist-info → qiskit-1.3.1.dist-info}/WHEEL +1 -1
  31. {qiskit-1.3.0rc1.dist-info → qiskit-1.3.1.dist-info}/entry_points.txt +1 -1
  32. {qiskit-1.3.0rc1.dist-info → qiskit-1.3.1.dist-info}/LICENSE.txt +0 -0
  33. {qiskit-1.3.0rc1.dist-info → qiskit-1.3.1.dist-info}/top_level.txt +0 -0
qiskit/VERSION.txt CHANGED
@@ -1 +1 @@
1
- 1.3.0rc1
1
+ 1.3.1
qiskit/_accelerate.pyd CHANGED
Binary file
@@ -13,6 +13,7 @@
13
13
  """Add control to operation if supported."""
14
14
  from __future__ import annotations
15
15
 
16
+ from math import pi
16
17
  from qiskit.circuit.exceptions import CircuitError
17
18
  from qiskit.circuit.library import UnitaryGate
18
19
  from qiskit.transpiler import PassManager
@@ -92,7 +93,6 @@ def control(
92
93
  Raises:
93
94
  CircuitError: gate contains non-gate in definition
94
95
  """
95
- from math import pi
96
96
 
97
97
  # pylint: disable=cyclic-import
98
98
  from qiskit.circuit import controlledgate
@@ -101,22 +101,23 @@ def control(
101
101
 
102
102
  q_control = QuantumRegister(num_ctrl_qubits, name="control")
103
103
  q_target = QuantumRegister(operation.num_qubits, name="target")
104
- q_ancillae = None # TODO: add
105
104
  controlled_circ = QuantumCircuit(q_control, q_target, name=f"c_{operation.name}")
106
105
  if isinstance(operation, controlledgate.ControlledGate):
107
106
  original_ctrl_state = operation.ctrl_state
107
+ operation = operation.to_mutable()
108
+ operation.ctrl_state = None
109
+
108
110
  global_phase = 0
109
- if operation.name == "x" or (
110
- isinstance(operation, controlledgate.ControlledGate) and operation.base_gate.name == "x"
111
- ):
112
- controlled_circ.mcx(q_control[:] + q_target[:-1], q_target[-1], q_ancillae)
113
- if operation.definition is not None and operation.definition.global_phase:
114
- global_phase += operation.definition.global_phase
111
+
112
+ basis = ["p", "u", "x", "z", "rx", "ry", "rz", "cx"]
113
+
114
+ if operation.name in basis:
115
+ apply_basic_controlled_gate(controlled_circ, operation, q_control, q_target[0])
115
116
  else:
116
- basis = ["p", "u", "x", "z", "rx", "ry", "rz", "cx"]
117
117
  if isinstance(operation, controlledgate.ControlledGate):
118
118
  operation = operation.to_mutable()
119
119
  operation.ctrl_state = None
120
+
120
121
  unrolled_gate = _unroll_gate(operation, basis_gates=basis)
121
122
  if unrolled_gate.definition.global_phase:
122
123
  global_phase += unrolled_gate.definition.global_phase
@@ -130,87 +131,17 @@ def control(
130
131
 
131
132
  for instruction in definition.data:
132
133
  gate, qargs = instruction.operation, instruction.qubits
133
- if gate.name == "x":
134
- controlled_circ.mcx(q_control, q_target[bit_indices[qargs[0]]], q_ancillae)
135
- elif gate.name == "rx":
136
- controlled_circ.mcrx(
137
- gate.definition.data[0].operation.params[0],
138
- q_control,
139
- q_target[bit_indices[qargs[0]]],
140
- use_basis_gates=False,
141
- )
142
- elif gate.name == "ry":
143
- controlled_circ.mcry(
144
- gate.definition.data[0].operation.params[0],
145
- q_control,
146
- q_target[bit_indices[qargs[0]]],
147
- q_ancillae,
148
- mode="noancilla",
149
- use_basis_gates=False,
150
- )
151
- elif gate.name == "rz":
152
- controlled_circ.mcrz(
153
- gate.definition.data[0].operation.params[0],
154
- q_control,
155
- q_target[bit_indices[qargs[0]]],
156
- use_basis_gates=False,
157
- )
158
- continue
159
- elif gate.name == "p":
160
- from qiskit.circuit.library import MCPhaseGate
161
134
 
162
- controlled_circ.append(
163
- MCPhaseGate(gate.params[0], num_ctrl_qubits),
164
- q_control[:] + [q_target[bit_indices[qargs[0]]]],
165
- )
166
- elif gate.name == "cx":
167
- controlled_circ.mcx(
168
- q_control[:] + [q_target[bit_indices[qargs[0]]]],
169
- q_target[bit_indices[qargs[1]]],
170
- q_ancillae,
171
- )
172
- elif gate.name == "u":
173
- theta, phi, lamb = gate.params
174
- if num_ctrl_qubits == 1:
175
- if theta == 0 and phi == 0:
176
- controlled_circ.cp(lamb, q_control[0], q_target[bit_indices[qargs[0]]])
177
- else:
178
- controlled_circ.cu(
179
- theta, phi, lamb, 0, q_control[0], q_target[bit_indices[qargs[0]]]
180
- )
181
- else:
182
- if phi == -pi / 2 and lamb == pi / 2:
183
- controlled_circ.mcrx(
184
- theta, q_control, q_target[bit_indices[qargs[0]]], use_basis_gates=True
185
- )
186
- elif phi == 0 and lamb == 0:
187
- controlled_circ.mcry(
188
- theta,
189
- q_control,
190
- q_target[bit_indices[qargs[0]]],
191
- q_ancillae,
192
- use_basis_gates=True,
193
- )
194
- elif theta == 0 and phi == 0:
195
- controlled_circ.mcp(lamb, q_control, q_target[bit_indices[qargs[0]]])
196
- else:
197
- controlled_circ.mcp(lamb, q_control, q_target[bit_indices[qargs[0]]])
198
- controlled_circ.mcry(
199
- theta,
200
- q_control,
201
- q_target[bit_indices[qargs[0]]],
202
- q_ancillae,
203
- use_basis_gates=True,
204
- )
205
- controlled_circ.mcp(phi, q_control, q_target[bit_indices[qargs[0]]])
206
- elif gate.name == "z":
207
- controlled_circ.h(q_target[bit_indices[qargs[0]]])
208
- controlled_circ.mcx(q_control, q_target[bit_indices[qargs[0]]], q_ancillae)
209
- controlled_circ.h(q_target[bit_indices[qargs[0]]])
135
+ if len(qargs) == 1:
136
+ target = q_target[bit_indices[qargs[0]]]
210
137
  else:
211
- raise CircuitError(f"gate contains non-controllable instructions: {gate.name}")
212
- if gate.definition is not None and gate.definition.global_phase:
138
+ target = [q_target[bit_indices[qarg]] for qarg in qargs]
139
+
140
+ apply_basic_controlled_gate(controlled_circ, gate, q_control, target)
141
+
142
+ if gate.definition is not None and gate.definition.global_phase and gate.name != "rz":
213
143
  global_phase += gate.definition.global_phase
144
+
214
145
  # apply controlled global phase
215
146
  if global_phase:
216
147
  if len(q_control) < 2:
@@ -228,6 +159,7 @@ def control(
228
159
  new_ctrl_state = ctrl_state
229
160
  base_name = operation.name
230
161
  base_gate = operation
162
+
231
163
  # In order to maintain some backward compatibility with gate names this
232
164
  # uses a naming convention where if the number of controls is <=2 the gate
233
165
  # is named like "cc<base_gate.name>", else it is named like
@@ -250,15 +182,101 @@ def control(
250
182
  return cgate
251
183
 
252
184
 
185
+ def apply_basic_controlled_gate(circuit, gate, controls, target):
186
+ """Apply a controlled version of ``gate`` to the circuit.
187
+
188
+ This implements multi-control operations for the following basis gates:
189
+
190
+ ["p", "u", "x", "z", "rx", "ry", "rz", "cx"]
191
+
192
+ """
193
+ num_ctrl_qubits = len(controls)
194
+
195
+ if gate.name == "x":
196
+ circuit.mcx(controls, target)
197
+
198
+ elif gate.name == "rx":
199
+ circuit.mcrx(
200
+ gate.definition.data[0].operation.params[0],
201
+ controls,
202
+ target,
203
+ use_basis_gates=False,
204
+ )
205
+ elif gate.name == "ry":
206
+ circuit.mcry(
207
+ gate.definition.data[0].operation.params[0],
208
+ controls,
209
+ target,
210
+ mode="noancilla",
211
+ use_basis_gates=False,
212
+ )
213
+ elif gate.name == "rz":
214
+ circuit.mcrz(
215
+ gate.definition.data[0].operation.params[0],
216
+ controls,
217
+ target,
218
+ use_basis_gates=False,
219
+ )
220
+ # continue
221
+ elif gate.name == "p":
222
+ from qiskit.circuit.library import MCPhaseGate
223
+
224
+ circuit.append(
225
+ MCPhaseGate(gate.params[0], num_ctrl_qubits),
226
+ controls[:] + [target],
227
+ )
228
+ elif gate.name == "cx":
229
+ circuit.mcx(
230
+ controls[:] + [target[0]], # CX has two targets
231
+ target[1],
232
+ )
233
+ elif gate.name == "u":
234
+ theta, phi, lamb = gate.params
235
+ if num_ctrl_qubits == 1:
236
+ if theta == 0 and phi == 0:
237
+ circuit.cp(lamb, controls[0], target)
238
+ else:
239
+ circuit.cu(theta, phi, lamb, 0, controls[0], target)
240
+ else:
241
+ if phi == -pi / 2 and lamb == pi / 2:
242
+ circuit.mcrx(theta, controls, target, use_basis_gates=True)
243
+ elif phi == 0 and lamb == 0:
244
+ circuit.mcry(
245
+ theta,
246
+ controls,
247
+ target,
248
+ use_basis_gates=True,
249
+ )
250
+ elif theta == 0 and phi == 0:
251
+ circuit.mcp(lamb, controls, target)
252
+ else:
253
+ circuit.mcp(lamb, controls, target)
254
+ circuit.mcry(
255
+ theta,
256
+ controls,
257
+ target,
258
+ use_basis_gates=True,
259
+ )
260
+ circuit.mcp(phi, controls, target)
261
+
262
+ elif gate.name == "z":
263
+ circuit.h(target)
264
+ circuit.mcx(controls, target)
265
+ circuit.h(target)
266
+
267
+ else:
268
+ raise CircuitError(f"Gate {gate} not in supported basis.")
269
+
270
+
253
271
  def _gate_to_circuit(operation):
254
272
  """Converts a gate instance to a QuantumCircuit"""
255
273
  if hasattr(operation, "definition") and operation.definition is not None:
256
274
  return operation.definition
257
- else:
258
- qr = QuantumRegister(operation.num_qubits)
259
- qc = QuantumCircuit(qr, name=operation.name)
260
- qc.append(operation, qr)
261
- return qc
275
+
276
+ qr = QuantumRegister(operation.num_qubits)
277
+ qc = QuantumCircuit(qr, name=operation.name)
278
+ qc.append(operation, qr)
279
+ return qc
262
280
 
263
281
 
264
282
  def _unroll_gate(operation, basis_gates):
@@ -36,7 +36,7 @@ For example, to append a multi-controlled CNOT:
36
36
  circuit.append(gate, [0, 1, 4, 2, 3])
37
37
  circuit.draw('mpl')
38
38
 
39
- The library is organized in several sections. The function
39
+ The library is organized in several sections. The function
40
40
  :func:`.get_standard_gate_name_mapping` allows you to see the available standard gates and operations.
41
41
 
42
42
  .. autofunction:: get_standard_gate_name_mapping
@@ -221,10 +221,10 @@ or of a set of qubit states.
221
221
  OrGate
222
222
  XOR
223
223
  BitwiseXorGate
224
+ random_bitwise_xor
224
225
  InnerProduct
225
226
  InnerProductGate
226
227
 
227
- .. autofunction:: random_bitwise_xor
228
228
 
229
229
  Basis Change Circuits
230
230
  =====================
@@ -280,6 +280,9 @@ Adders
280
280
  CDKMRippleCarryAdder
281
281
  VBERippleCarryAdder
282
282
  WeightedAdder
283
+ ModularAdderGate
284
+ HalfAdderGate
285
+ FullAdderGate
283
286
 
284
287
  Multipliers
285
288
  -----------
@@ -290,6 +293,7 @@ Multipliers
290
293
 
291
294
  HRSCumulativeMultiplier
292
295
  RGQFTMultiplier
296
+ MultiplierGate
293
297
 
294
298
  Comparators
295
299
  -----------
@@ -321,29 +325,40 @@ Other arithmetic functions
321
325
  Particular Quantum Circuits
322
326
  ===========================
323
327
 
328
+ The following gates and quantum circuits define specific
329
+ quantum circuits of interest:
330
+
324
331
  .. autosummary::
325
332
  :toctree: ../stubs/
326
333
  :template: autosummary/class_no_inherited_members.rst
327
334
 
328
335
  FourierChecking
329
- fourier_checking
330
336
  GraphState
331
337
  GraphStateGate
332
338
  HiddenLinearFunction
333
- hidden_linear_function
334
339
  IQP
335
- iqp
336
- random_iqp
337
340
  QuantumVolume
338
- quantum_volume
339
341
  PhaseEstimation
340
- phase_estimation
341
342
  GroverOperator
342
- grover_operator
343
343
  PhaseOracle
344
344
  PauliEvolutionGate
345
345
  HamiltonianGate
346
346
  UnitaryOverlap
347
+
348
+ For circuits that have a well-defined structure it is preferrable
349
+ to use the following functions to construct them:
350
+
351
+ .. autosummary::
352
+ :toctree: ../stubs/
353
+ :template: autosummary/class_no_inherited_members.rst
354
+
355
+ fourier_checking
356
+ hidden_linear_function
357
+ iqp
358
+ random_iqp
359
+ quantum_volume
360
+ phase_estimation
361
+ grover_operator
347
362
  unitary_overlap
348
363
 
349
364
 
@@ -362,6 +377,7 @@ a broad set of variational quantum algorithms:
362
377
  real_amplitudes
363
378
  pauli_two_design
364
379
  excitation_preserving
380
+ qaoa_ansatz
365
381
  hamiltonian_variational_ansatz
366
382
  evolved_operator_ansatz
367
383
 
@@ -386,7 +402,7 @@ They are heavily used in near-term algorithms in e.g. Chemistry, Physics or Opti
386
402
  Data encoding circuits
387
403
  ======================
388
404
 
389
- The following functions return a parameterized :class:`.QuantumCircuit` to use as data
405
+ The following functions return a parameterized :class:`.QuantumCircuit` to use as data
390
406
  encoding circuits in a series of variational quantum algorithms:
391
407
 
392
408
  .. autosummary::
@@ -407,6 +423,17 @@ data in quantum states and are used as feature maps for classification.
407
423
  PauliFeatureMap
408
424
  ZFeatureMap
409
425
  ZZFeatureMap
426
+
427
+
428
+ Data preparation circuits
429
+ =========================
430
+
431
+ The following operations are used for state preparation:
432
+
433
+ .. autosummary::
434
+ :toctree: ../stubs/
435
+ :template: autosummary/class_no_inherited_members.rst
436
+
410
437
  StatePreparation
411
438
  Initialize
412
439
 
@@ -21,7 +21,7 @@ from qiskit.utils.deprecation import deprecate_func
21
21
  class Adder(QuantumCircuit):
22
22
  r"""Compute the sum of two equally sized qubit registers.
23
23
 
24
- For two registers :math:`|a\rangle_n` and :math:|b\rangle_n` with :math:`n` qubits each, an
24
+ For two registers :math:`|a\rangle_n` and :math:`|b\rangle_n` with :math:`n` qubits each, an
25
25
  adder performs the following operation
26
26
 
27
27
  .. math::
@@ -74,7 +74,7 @@ class Adder(QuantumCircuit):
74
74
  class HalfAdderGate(Gate):
75
75
  r"""Compute the sum of two equally-sized qubit registers, including a carry-out bit.
76
76
 
77
- For two registers :math:`|a\rangle_n` and :math:|b\rangle_n` with :math:`n` qubits each, an
77
+ For two registers :math:`|a\rangle_n` and :math:`|b\rangle_n` with :math:`n` qubits each, an
78
78
  adder performs the following operation
79
79
 
80
80
  .. math::
@@ -116,11 +116,20 @@ class HalfAdderGate(Gate):
116
116
  """
117
117
  return self._num_state_qubits
118
118
 
119
+ def _define(self):
120
+ """Populates self.definition with some decomposition of this gate."""
121
+ from qiskit.synthesis.arithmetic import adder_qft_d00
122
+
123
+ # This particular decomposition does not use any ancilla qubits.
124
+ # Note that the transpiler may choose a different decomposition
125
+ # based on the number of ancilla qubits available.
126
+ self.definition = adder_qft_d00(self.num_state_qubits, kind="half")
127
+
119
128
 
120
129
  class ModularAdderGate(Gate):
121
130
  r"""Compute the sum modulo :math:`2^n` of two :math:`n`-sized qubit registers.
122
131
 
123
- For two registers :math:`|a\rangle_n` and :math:|b\rangle_n` with :math:`n` qubits each, an
132
+ For two registers :math:`|a\rangle_n` and :math:`|b\rangle_n` with :math:`n` qubits each, an
124
133
  adder performs the following operation
125
134
 
126
135
  .. math::
@@ -162,16 +171,25 @@ class ModularAdderGate(Gate):
162
171
  """
163
172
  return self._num_state_qubits
164
173
 
174
+ def _define(self):
175
+ """Populates self.definition with some decomposition of this gate."""
176
+ from qiskit.synthesis.arithmetic import adder_qft_d00
177
+
178
+ # This particular decomposition does not use any ancilla qubits.
179
+ # Note that the transpiler may choose a different decomposition
180
+ # based on the number of ancilla qubits available.
181
+ self.definition = adder_qft_d00(self.num_state_qubits, kind="fixed")
182
+
165
183
 
166
184
  class FullAdderGate(Gate):
167
185
  r"""Compute the sum of two :math:`n`-sized qubit registers, including carry-in and -out bits.
168
186
 
169
- For two registers :math:`|a\rangle_n` and :math:|b\rangle_n` with :math:`n` qubits each, an
187
+ For two registers :math:`|a\rangle_n` and :math:`|b\rangle_n` with :math:`n` qubits each, an
170
188
  adder performs the following operation
171
189
 
172
190
  .. math::
173
191
 
174
- |c_{\text{in}\rangle_1 |a\rangle_n |b\rangle_n
192
+ |c_{\text{in}}\rangle_1 |a\rangle_n |b\rangle_n
175
193
  \mapsto |a\rangle_n |c_{\text{in}} + a + b \rangle_{n + 1}.
176
194
 
177
195
  The quantum register :math:`|a\rangle_n` (and analogously :math:`|b\rangle_n`)
@@ -208,3 +226,10 @@ class FullAdderGate(Gate):
208
226
  The number of state qubits.
209
227
  """
210
228
  return self._num_state_qubits
229
+
230
+ def _define(self):
231
+ """Populates self.definition with a decomposition of this gate."""
232
+ from qiskit.synthesis.arithmetic import adder_ripple_c04
233
+
234
+ # In the case of a full adder, this method does not use any ancilla qubits
235
+ self.definition = adder_ripple_c04(self.num_state_qubits, kind="full")
@@ -84,7 +84,7 @@ class CDKMRippleCarryAdder(Adder):
84
84
  :class:`.ModularAdderGate`: A generic inplace adder, modulo :math:`2^n`. This
85
85
  is functionally equivalent to ``kind="fixed"``.
86
86
 
87
- :class:`.AdderGate`: A generic inplace adder. This
87
+ :class:`.HalfAdderGate`: A generic inplace adder. This
88
88
  is functionally equivalent to ``kind="half"``.
89
89
 
90
90
  :class:`.FullAdderGate`: A generic inplace adder, with a carry-in bit. This
@@ -54,7 +54,7 @@ class DraperQFTAdder(Adder):
54
54
  :class:`.ModularAdderGate`: A generic inplace adder, modulo :math:`2^n`. This
55
55
  is functionally equivalent to ``kind="fixed"``.
56
56
 
57
- :class:`.AdderGate`: A generic inplace adder. This
57
+ :class:`.HalfAdderGate`: A generic inplace adder. This
58
58
  is functionally equivalent to ``kind="half"``.
59
59
 
60
60
  **References:**
@@ -60,7 +60,7 @@ class VBERippleCarryAdder(Adder):
60
60
  :class:`.ModularAdderGate`: A generic inplace adder, modulo :math:`2^n`. This
61
61
  is functionally equivalent to ``kind="fixed"``.
62
62
 
63
- :class:`.AdderGate`: A generic inplace adder. This
63
+ :class:`.HalfAdderGate`: A generic inplace adder. This
64
64
  is functionally equivalent to ``kind="half"``.
65
65
 
66
66
  :class:`.FullAdderGate`: A generic inplace adder, with a carry-in bit. This
@@ -190,3 +190,12 @@ class MultiplierGate(Gate):
190
190
  The number of result qubits.
191
191
  """
192
192
  return self._num_result_qubits
193
+
194
+ def _define(self):
195
+ """Populates self.definition with some decomposition of this gate."""
196
+ from qiskit.synthesis.arithmetic import multiplier_qft_r17
197
+
198
+ # This particular decomposition does not use any ancilla qubits.
199
+ # Note that the transpiler may choose a different decomposition
200
+ # based on the number of ancilla qubits available.
201
+ self.definition = multiplier_qft_r17(self.num_state_qubits)
@@ -82,7 +82,7 @@ def init_observable(observable: BaseOperator | str) -> SparsePauliOp:
82
82
  since="1.2",
83
83
  additional_msg="Use ``QuantumCircuit.layout`` and ``SparsePauliOp.apply_layout`` "
84
84
  + "to adjust an operator for a layout. Otherwise, use ``mthree.utils.final_measurement_mapping``. "
85
- + "See https://qiskit-extensions.github.io/mthree/apidocs/utils.html for details.",
85
+ + "See <https://qiskit.github.io/qiskit-addon-mthree/apidocs/utils> for details.",
86
86
  )
87
87
  def final_measurement_mapping(circuit: QuantumCircuit) -> dict[int, int]:
88
88
  """Return the final measurement mapping for the circuit.
@@ -160,7 +160,7 @@ steps for writing a provider are:
160
160
  interacting with a running job.
161
161
 
162
162
  For a simple example of a provider, see the
163
- `qiskit-aqt-provider <https://github.com/Qiskit-Partners/qiskit-aqt-provider>`__
163
+ `qiskit-aqt-provider <https://github.com/qiskit-community/qiskit-aqt-provider>`__
164
164
 
165
165
  Provider
166
166
  --------
@@ -664,7 +664,7 @@ that abstract away the mechanics of getting the best result efficiently, to
664
664
  concentrate on higher level applications using these outputs.
665
665
 
666
666
  For example, if your backends were well suited to leverage
667
- `mthree <https://github.com/Qiskit-Partners/mthree/>`__ measurement
667
+ `mthree <https://github.com/Qiskit/qiskit-addon-mthree>`__ measurement
668
668
  mitigation to improve the quality of the results, you could implement a
669
669
  provider-specific :class:`~.Sampler` implementation that leverages the
670
670
  ``M3Mitigation`` class internally to run the circuits and return
qiskit/qpy/__init__.py CHANGED
@@ -447,10 +447,10 @@ characters:
447
447
  * - ``u``
448
448
  - substitution
449
449
 
450
- If the type value is ``f`` ,``c`` or ``i``, the corresponding ``lhs`` or `rhs``
450
+ If the type value is ``f``, ``c``, or ``i``, the corresponding ``lhs`` or ``rhs``
451
451
  field widths are 128 bits each. In the case of floats, the literal value is encoded as a double
452
452
  with 0 padding, while complex numbers are encoded as real part followed by imaginary part,
453
- taking up 64 bits each. For ``i`, the value is encoded as a 64 bit signed integer with 0 padding
453
+ taking up 64 bits each. For ``i``, the value is encoded as a 64 bit signed integer with 0 padding
454
454
  for the full 128 bit width. ``n`` is used to represent a ``None`` and typically isn't directly used
455
455
  as it indicates an argument that's not used. For ``p`` the data is the UUID for the
456
456
  :class:`.Parameter` which can be looked up in the symbol map described in the
@@ -546,7 +546,7 @@ Type code Meaning
546
546
  Changes to EXPR_VAR
547
547
  ~~~~~~~~~~~~~~~~~~~
548
548
 
549
- The EXPR_VAR variable has gained a new type code and payload, in addition to the pre-existing ones:
549
+ The ``EXPR_VAR`` variable has gained a new type code and payload, in addition to the pre-existing ones:
550
550
 
551
551
  =========================== ========= ============================================================
552
552
  Python class Type code Payload
@@ -693,9 +693,9 @@ Each of these are described in the following table:
693
693
  ====================== ========= ======================================================= ========
694
694
  Qiskit class Type code Payload Children
695
695
  ====================== ========= ======================================================= ========
696
- :class:`~.expr.Var` ``x`` One EXPR_VAR. 0
696
+ :class:`~.expr.Var` ``x`` One ``EXPR_VAR``. 0
697
697
 
698
- :class:`~.expr.Value` ``v`` One EXPR_VALUE. 0
698
+ :class:`~.expr.Value` ``v`` One ``EXPR_VALUE``. 0
699
699
 
700
700
  :class:`~.expr.Cast` ``c`` One ``_Bool`` that corresponds to the value of 1
701
701
  ``implicit``.
@@ -18,6 +18,8 @@ Chi-matrix representation of a Quantum Channel.
18
18
  from __future__ import annotations
19
19
  import copy as _copy
20
20
  import math
21
+ from typing import TYPE_CHECKING
22
+
21
23
  import numpy as np
22
24
 
23
25
  from qiskit import _numpy_compat
@@ -31,6 +33,9 @@ from qiskit.quantum_info.operators.channel.transformations import _to_chi
31
33
  from qiskit.quantum_info.operators.mixins import generate_apidocs
32
34
  from qiskit.quantum_info.operators.base_operator import BaseOperator
33
35
 
36
+ if TYPE_CHECKING:
37
+ from qiskit import circuit
38
+
34
39
 
35
40
  class Chi(QuantumChannel):
36
41
  r"""Pauli basis Chi-matrix representation of a quantum channel.
@@ -59,21 +64,16 @@ class Chi(QuantumChannel):
59
64
 
60
65
  def __init__(
61
66
  self,
62
- data: QuantumCircuit | Instruction | BaseOperator | np.ndarray,
67
+ data: QuantumCircuit | circuit.instruction.Instruction | BaseOperator | np.ndarray,
63
68
  input_dims: int | tuple | None = None,
64
69
  output_dims: int | tuple | None = None,
65
70
  ):
66
71
  """Initialize a quantum channel Chi-matrix operator.
67
72
 
68
73
  Args:
69
- data (QuantumCircuit or
70
- Instruction or
71
- BaseOperator or
72
- matrix): data to initialize superoperator.
73
- input_dims (tuple): the input subsystem dimensions.
74
- [Default: None]
75
- output_dims (tuple): the output subsystem dimensions.
76
- [Default: None]
74
+ data: data to initialize superoperator.
75
+ input_dims: the input subsystem dimensions.
76
+ output_dims: the output subsystem dimensions.
77
77
 
78
78
  Raises:
79
79
  QiskitError: if input data is not an N-qubit channel or
@@ -18,6 +18,8 @@ Choi-matrix representation of a Quantum Channel.
18
18
  from __future__ import annotations
19
19
  import copy as _copy
20
20
  import math
21
+ from typing import TYPE_CHECKING
22
+
21
23
  import numpy as np
22
24
 
23
25
  from qiskit import _numpy_compat
@@ -32,6 +34,9 @@ from qiskit.quantum_info.operators.channel.transformations import _bipartite_ten
32
34
  from qiskit.quantum_info.operators.mixins import generate_apidocs
33
35
  from qiskit.quantum_info.operators.base_operator import BaseOperator
34
36
 
37
+ if TYPE_CHECKING:
38
+ from qiskit import circuit
39
+
35
40
 
36
41
  class Choi(QuantumChannel):
37
42
  r"""Choi-matrix representation of a Quantum Channel.
@@ -64,21 +69,16 @@ class Choi(QuantumChannel):
64
69
 
65
70
  def __init__(
66
71
  self,
67
- data: QuantumCircuit | Instruction | BaseOperator | np.ndarray,
72
+ data: QuantumCircuit | circuit.instruction.Instruction | BaseOperator | np.ndarray,
68
73
  input_dims: int | tuple | None = None,
69
74
  output_dims: int | tuple | None = None,
70
75
  ):
71
76
  """Initialize a quantum channel Choi matrix operator.
72
77
 
73
78
  Args:
74
- data (QuantumCircuit or
75
- Instruction or
76
- BaseOperator or
77
- matrix): data to initialize superoperator.
78
- input_dims (tuple): the input subsystem dimensions.
79
- [Default: None]
80
- output_dims (tuple): the output subsystem dimensions.
81
- [Default: None]
79
+ data: data to initialize superoperator.
80
+ input_dims: the input subsystem dimensions.
81
+ output_dims: the output subsystem dimensions.
82
82
 
83
83
  Raises:
84
84
  QiskitError: if input data cannot be initialized as a