Skip to content

Commit 07529f1

Browse files
committed
Merge branch 'remove-opflow' of https://github.com/ElePT/qiskit-terra into remove-opflow
2 parents 6b23a32 + 17f16dd commit 07529f1

30 files changed

+778
-62
lines changed

Cargo.lock

+38-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/accelerate/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ numpy = "0.19.0"
2020
rand = "0.8"
2121
rand_pcg = "0.3"
2222
rand_distr = "0.4.3"
23-
ahash = "0.8.3"
23+
ahash = "0.8.6"
2424
num-complex = "0.4"
2525
num-bigint = "0.4"
2626
rustworkx-core = "0.13"

docs/legacy_release_notes.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ Transpiler Features
520520

521521
- A new method :meth:`~qiskit.dagcircuit.DAGCircuit.find_bit` has
522522
been added to the :class:`~qiskit.dagcircuit.DAGCircuit` class,
523-
which returns the bit locations of the given :class:`.Qubit` or
523+
which returns the bit locations of the given :class:`~.circuit.Qubit` or
524524
:class:`.Clbit` as a tuple of the positional index of the bit within
525525
the circuit and a list of tuples which locate the bit in the circuit's
526526
registers.
@@ -1597,7 +1597,7 @@ Bug Fixes
15971597
.. releasenotes/notes/fix-bit-copy-4b2f7349683f616a.yaml @ b'163d1bd7835d58eaf8842c594b3696fb99c8442f'
15981598

15991599
- Fixed an issue with copying circuits with new-style :class:`.Clbit`\ s and
1600-
:class:`.Qubit`\ s (bits without registers) where references to these bits
1600+
:class:`~.circuit.Qubit`\ s (bits without registers) where references to these bits
16011601
from the containing circuit could be broken, causing issues with
16021602
serialization and circuit visualization.
16031603
Fixed `#10409 <https://github.com/Qiskit/qiskit-terra/issues/10409>`__
@@ -4326,8 +4326,8 @@ Bug Fixes
43264326

43274327
.. releasenotes/notes/fix-deprecated-bit-qpy-roundtrip-9a23a795aa677c71.yaml @ b'3dbbb32e762850db265c7bb40787a36351aad917'
43284328

4329-
- The deprecated :class:`.Qubit` and :class:`.Clbit` properties :attr:`~.Qubit.register` and
4330-
:attr:`~.Qubit.index` will now be correctly round-tripped by QPY (:mod:`qiskit.qpy`) in all
4329+
- The deprecated :class:`~.circuit.Qubit` and :class:`.Clbit` properties :attr:`~.circuit.Qubit.register` and
4330+
:attr:`~.circuit.Qubit.index` will now be correctly round-tripped by QPY (:mod:`qiskit.qpy`) in all
43314331
valid usages of :class:`.QuantumRegister` and :class:`.ClassicalRegister`. In earlier releases
43324332
in the Terra 0.23 series, this information would be lost. In versions before 0.23.0, this
43334333
information was partially reconstructed but could be incorrect or produce invalid circuits for
@@ -7031,7 +7031,7 @@ Bug Fixes
70317031

70327032
- QPY deserialisation will no longer add extra :class:`.Clbit` instances to the
70337033
circuit if there are both loose :class:`.Clbit`\ s in the circuit and more
7034-
:class:`.Qubit`\ s than :class:`.Clbit`\ s.
7034+
:class:`~.circuit.Qubit`\ s than :class:`.Clbit`\ s.
70357035

70367036
.. releasenotes/notes/fix-qpy-loose-bits-5283dc4ad3823ce3.yaml @ b'e0befd769fc54e9f50cdc4b355983b9d1eda6f31'
70377037

@@ -9062,7 +9062,7 @@ Bug Fixes
90629062
.. releasenotes/notes/0.22/denselayout-loose-bits-3e66011432bc6232.yaml @ b'618770367f7a5a3a22fd43ea9fcfb7f17393eb6a'
90639063

90649064
- Fixed an issue in the :class:`~.DenseLayout` transpiler pass where any
9065-
loose :class:`~.Qubit` objects (i.e. not part of a :class:`~.QuantumRegister`)
9065+
loose :class:`~.circuit.Qubit` objects (i.e. not part of a :class:`~.QuantumRegister`)
90669066
that were part of a :class:`~.QuantumCircuit` would not be included in the
90679067
output :class:`~.Layout` that was generated by the pass.
90689068

@@ -9071,7 +9071,7 @@ Bug Fixes
90719071
- The :meth:`.Operator.from_circuit` constructor method has been updated
90729072
so that it can handle the layout output from :func:`~.transpile` and
90739073
correctly reverse the qubit permutation caused by layout in all cases.
9074-
Previously, if your transpiled circuit used loose :class:`~.Qubit` objects,
9074+
Previously, if your transpiled circuit used loose :class:`~.circuit.Qubit` objects,
90759075
multiple :class:`~.QuantumRegister` objects, or a single
90769076
:class:`~.QuantumRegister` with a name other than ``"q"`` the constructor
90779077
would have failed to create an :class:`~.Operator` from the circuit.
@@ -10274,7 +10274,7 @@ Upgrade Notes
1027410274

1027510275
- The data type of each element in :attr:`.QuantumCircuit.data` has changed.
1027610276
It used to be a simple 3-tuple of an :class:`~.circuit.Instruction`, a list
10277-
of :class:`.Qubit`\ s, and a list of :class:`.Clbit`\ s, whereas it is now
10277+
of :class:`~.circuit.Qubit`\ s, and a list of :class:`.Clbit`\ s, whereas it is now
1027810278
an instance of :class:`.CircuitInstruction`.
1027910279

1028010280
The attributes of this new class are :attr:`~.CircuitInstruction.operation`,
@@ -10651,7 +10651,7 @@ Bug Fixes
1065110651
.. releasenotes/notes/0.21/fix-reverse_bits-with-registerless-bits-6d17597b99640fb0.yaml @ b'0f377f7a2cdbd7eaa46e8e2b5de974c8c22b9612'
1065210652

1065310653
- Fixed :meth:`.QuantumCircuit.reverse_bits` with circuits containing registerless
10654-
:class:`.Qubit` and :class:`.Clbit`. For example, the following will now work::
10654+
:class:`~.circuit.Qubit` and :class:`.Clbit`. For example, the following will now work::
1065510655

1065610656
from qiskit.circuit import QuantumCircuit, Qubit, Clbit
1065710657

@@ -10954,7 +10954,7 @@ Bug Fixes
1095410954
- Fixed an issue with the visualization function :func:`~.dag_drawer` and
1095510955
method :meth:`.DAGCircuit.draw` where previously the drawer would fail
1095610956
when attempting to generate a visualization for a :class:`~.DAGCircuit`
10957-
object that contained a :class:`~.Qubit` or :class:`~.Clbit` which wasn't
10957+
object that contained a :class:`~.circuit.Qubit` or :class:`~.Clbit` which wasn't
1095810958
part of a :class:`~QuantumRegister` or :class:`~ClassicalRegister`.
1095910959
Fixed `#7915 <https://github.com/Qiskit/qiskit-terra/issues/7915>`__.
1096010960

@@ -12350,7 +12350,7 @@ Upgrade Notes
1235012350

1235112351
.. releasenotes/notes/0.20/bit-slots-17d6649872da0440.yaml @ b'a2d13f55aad6c670f71a4613516b8891e02ece63'
1235212352

12353-
- The classes :class:`.Qubit`, :class:`.Clbit` and :class:`.AncillaQubit` now
12353+
- The classes :class:`~.circuit.Qubit`, :class:`.Clbit` and :class:`.AncillaQubit` now
1235412354
have the ``__slots__`` attribute. This is to reduce their memory usage. As a
1235512355
side effect, they can no longer have arbitrary data attached as attributes
1235612356
to them. This is very unlikely to have any effect on downstream code other
@@ -13180,7 +13180,7 @@ Bug Fixes
1318013180
- Fixed QPY serialization of :class:`.QuantumCircuit` containing subsets of
1318113181
bits from a :class:`.QuantumRegister` or :class:`.ClassicalRegister`.
1318213182
Previously if you tried to serialize a circuit like this it would
13183-
incorrectly treat these bits as standalone :class:`.Qubit` or
13183+
incorrectly treat these bits as standalone :class:`~.circuit.Qubit` or
1318413184
:class:`.Clbit` without having a register set. For example, if you try to
1318513185
serialize a circuit like::
1318613186

qiskit/circuit/bit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Bit:
2424
2525
.. note::
2626
This class should not be instantiated directly. This is just a superclass
27-
for :class:`~.Clbit` and :class:`~.Qubit`.
27+
for :class:`~.Clbit` and :class:`~.circuit.Qubit`.
2828
2929
"""
3030

qiskit/circuit/library/generalized_gates/mcmt.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from collections.abc import Callable
1818

1919
from qiskit import circuit
20-
from qiskit.circuit import ControlledGate, Gate, Qubit, QuantumRegister, QuantumCircuit
20+
from qiskit.circuit import ControlledGate, Gate, QuantumRegister, QuantumCircuit
2121
from qiskit.exceptions import QiskitError
2222

2323
# pylint: disable=cyclic-import
@@ -51,7 +51,7 @@ class MCMT(QuantumCircuit):
5151

5252
def __init__(
5353
self,
54-
gate: Gate | Callable[[QuantumCircuit, Qubit, Qubit], circuit.Instruction],
54+
gate: Gate | Callable[[QuantumCircuit, circuit.Qubit, circuit.Qubit], circuit.Instruction],
5555
num_ctrl_qubits: int,
5656
num_target_qubits: int,
5757
) -> None:
@@ -214,8 +214,8 @@ def num_ancilla_qubits(self):
214214

215215
def _ccx_v_chain_rule(
216216
self,
217-
control_qubits: QuantumRegister | list[Qubit],
218-
ancilla_qubits: QuantumRegister | list[Qubit],
217+
control_qubits: QuantumRegister | list[circuit.Qubit],
218+
ancilla_qubits: QuantumRegister | list[circuit.Qubit],
219219
reverse: bool = False,
220220
) -> None:
221221
"""Get the rule for the CCX V-chain.

qiskit/circuit/quantumcircuit.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ def data(self, data_input: Iterable):
381381
elements must either be instances of :class:`.CircuitInstruction` (preferred), or a
382382
3-tuple of ``(instruction, qargs, cargs)`` (legacy). In the legacy format,
383383
``instruction`` must be an :class:`~.circuit.Instruction`, while ``qargs`` and
384-
``cargs`` must be iterables of :class:`.Qubit` or :class:`.Clbit` specifiers
385-
(similar to the allowed forms in calls to :meth:`append`).
384+
``cargs`` must be iterables of :class:`~.circuit.Qubit` or :class:`.Clbit`
385+
specifiers (similar to the allowed forms in calls to :meth:`append`).
386386
"""
387387
# If data_input is QuantumCircuitData(self), clearing self._data
388388
# below will also empty data_input, so make a shallow copy first.
@@ -1230,7 +1230,7 @@ def append(
12301230
Args:
12311231
instruction: :class:`~.circuit.Instruction` instance to append, or a
12321232
:class:`.CircuitInstruction` with all its context.
1233-
qargs: specifiers of the :class:`.Qubit`\\ s to attach instruction to.
1233+
qargs: specifiers of the :class:`~.circuit.Qubit`\\ s to attach instruction to.
12341234
cargs: specifiers of the :class:`.Clbit`\\ s to attach instruction to.
12351235
12361236
Returns:

qiskit/converters/circuit_to_dag.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def circuit_to_dag(circuit, copy_operations=True, *, qubit_order=None, clbit_ord
2828
:class:`~.DAGCircuit` will be shared instances and modifications to
2929
operations in the :class:`~.DAGCircuit` will be reflected in the
3030
:class:`~.QuantumCircuit` (and vice versa).
31-
qubit_order (Iterable[Qubit] or None): the order that the qubits should be indexed in the
32-
output DAG. Defaults to the same order as in the circuit.
31+
qubit_order (Iterable[~qiskit.circuit.Qubit] or None): the order that the qubits should be
32+
indexed in the output DAG. Defaults to the same order as in the circuit.
3333
clbit_order (Iterable[Clbit] or None): the order that the clbits should be indexed in the
3434
output DAG. Defaults to the same order as in the circuit.
3535

qiskit/dagcircuit/dagcircuit.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,10 @@ def remove_qubits(self, *qubits):
424424
also be removed.
425425
426426
Args:
427-
qubits (List[Qubit]): The bits to remove.
427+
qubits (List[~qiskit.circuit.Qubit]): The bits to remove.
428428
429429
Raises:
430-
DAGCircuitError: a qubit is not a :obj:`.Qubit`, is not in the circuit,
430+
DAGCircuitError: a qubit is not a :obj:`~.circuit.Qubit`, is not in the circuit,
431431
or is not idle.
432432
"""
433433
if any(not isinstance(qubit, Qubit) for qubit in qubits):
@@ -643,11 +643,11 @@ def apply_operation_back(self, op, qargs=(), cargs=(), *, check=True):
643643
644644
Args:
645645
op (qiskit.circuit.Operation): the operation associated with the DAG node
646-
qargs (tuple[Qubit]): qubits that op will be applied to
646+
qargs (tuple[~qiskit.circuit.Qubit]): qubits that op will be applied to
647647
cargs (tuple[Clbit]): cbits that op will be applied to
648648
check (bool): If ``True`` (default), this function will enforce that the
649649
:class:`.DAGCircuit` data-structure invariants are maintained (all ``qargs`` are
650-
:class:`.Qubit`\\ s, all are in the DAG, etc). If ``False``, the caller *must*
650+
:class:`~.circuit.Qubit`\\ s, all are in the DAG, etc). If ``False``, the caller *must*
651651
uphold these invariants itself, but the cost of several checks will be skipped.
652652
This is most useful when building a new DAG from a source of known-good nodes.
653653
Returns:
@@ -697,11 +697,11 @@ def apply_operation_front(self, op, qargs=(), cargs=(), *, check=True):
697697
698698
Args:
699699
op (qiskit.circuit.Operation): the operation associated with the DAG node
700-
qargs (tuple[Qubit]): qubits that op will be applied to
700+
qargs (tuple[~qiskit.circuit.Qubit]): qubits that op will be applied to
701701
cargs (tuple[Clbit]): cbits that op will be applied to
702702
check (bool): If ``True`` (default), this function will enforce that the
703703
:class:`.DAGCircuit` data-structure invariants are maintained (all ``qargs`` are
704-
:class:`.Qubit`\\ s, all are in the DAG, etc). If ``False``, the caller *must*
704+
:class:`~.circuit.Qubit`\\ s, all are in the DAG, etc). If ``False``, the caller *must*
705705
uphold these invariants itself, but the cost of several checks will be skipped.
706706
This is most useful when building a new DAG from a source of known-good nodes.
707707
Returns:
@@ -755,7 +755,7 @@ def compose(self, other, qubits=None, clbits=None, front=False, inplace=True):
755755
756756
Args:
757757
other (DAGCircuit): circuit to compose with self
758-
qubits (list[Qubit|int]): qubits of self to compose onto.
758+
qubits (list[~qiskit.circuit.Qubit|int]): qubits of self to compose onto.
759759
clbits (list[Clbit|int]): clbits of self to compose onto.
760760
front (bool): If True, front composition will be performed (not implemented yet)
761761
inplace (bool): If True, modify the object. Otherwise return composed circuit.
@@ -2042,10 +2042,10 @@ def quantum_causal_cone(self, qubit):
20422042
classical bit wires are ignored for the purposes of building the causal cone.
20432043
20442044
Args:
2045-
qubit (Qubit): The output qubit for which we want to find the causal cone.
2045+
qubit (~qiskit.circuit.Qubit): The output qubit for which we want to find the causal cone.
20462046
20472047
Returns:
2048-
Set[Qubit]: The set of qubits whose interactions affect ``qubit``.
2048+
Set[~qiskit.circuit.Qubit]: The set of qubits whose interactions affect ``qubit``.
20492049
"""
20502050
# Retrieve the output node from the qubit
20512051
output_node = self.output_map.get(qubit, None)

qiskit/dagcircuit/dagdependency.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def _create_op_node(self, operation, qargs, cargs):
377377
378378
Args:
379379
operation (qiskit.circuit.Operation): operation
380-
qargs (list[Qubit]): list of qubits on which the operation acts
380+
qargs (list[~qiskit.circuit.Qubit]): list of qubits on which the operation acts
381381
cargs (list[Clbit]): list of classical wires to attach to
382382
383383
Returns:
@@ -421,7 +421,7 @@ def add_op_node(self, operation, qargs, cargs):
421421
422422
Args:
423423
operation (qiskit.circuit.Operation): operation as a quantum gate
424-
qargs (list[Qubit]): list of qubits on which the operation acts
424+
qargs (list[~qiskit.circuit.Qubit]): list of qubits on which the operation acts
425425
cargs (list[Clbit]): list of classical wires to attach to
426426
"""
427427
new_node = self._create_op_node(operation, qargs, cargs)
@@ -561,7 +561,7 @@ def replace_block_with_op(self, node_block, op, wire_pos_map, cycle_check=True):
561561
node block to be replaced
562562
op (qiskit.circuit.Operation): The operation to replace the
563563
block with
564-
wire_pos_map (Dict[Qubit, int]): The dictionary mapping the qarg to
564+
wire_pos_map (Dict[~qiskit.circuit.Qubit, int]): The dictionary mapping the qarg to
565565
the position. This is necessary to reconstruct the qarg order
566566
over multiple gates in the combined single op node.
567567
cycle_check (bool): When set to True this method will check that

qiskit/pulse/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
.. automodule:: qiskit.pulse.schedule
4141
.. automodule:: qiskit.pulse.transforms
4242
.. automodule:: qiskit.pulse.builder
43+
.. automodule:: qiskit.pulse.model
44+
4345
4446
.. currentmodule:: qiskit.pulse
4547
@@ -168,3 +170,14 @@
168170
)
169171
from qiskit.pulse.library.samplers.decorators import functional_pulse
170172
from qiskit.pulse.schedule import Schedule, ScheduleBlock
173+
174+
from qiskit.pulse.model import (
175+
LogicalElement,
176+
Qubit,
177+
Coupler,
178+
Frame,
179+
GenericFrame,
180+
QubitFrame,
181+
MeasurementFrame,
182+
MixedFrame,
183+
)

0 commit comments

Comments
 (0)