-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a3202c
commit 0421e7f
Showing
1 changed file
with
24 additions
and
5 deletions.
There are no files selected for viewing
29 changes: 24 additions & 5 deletions
29
releasenotes/notes/add-max-block-width-arg-e3677a2d26575a73.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
--- | ||
features_transpiler: | ||
- | | ||
Add a new argument ``max_block_width`` to the class :class:`~BlockCollector`, | ||
and to the transpiler passes :class:`~CollectLinearFunctions` and :class:`~CollectCliffords` | ||
that are based on this class. | ||
This argument enforces block collection strategies to restrict the maximum number of qubits | ||
over which a block of nodes is defined. | ||
Added a new argument ``max_block_width`` to the class :class:`.BlockCollector` | ||
and to the transpiler passes :class:`.CollectLinearFunctions` and :class:`.CollectCliffords`. | ||
This argument allows to restrict the maximum number of qubits over which a block of nodes is | ||
defined. | ||
For example:: | ||
from qiskit.circuit import QuantumCircuit | ||
from qiskit.transpiler.passes import CollectLinearFunctions | ||
qc = QuantumCircuit(5) | ||
qc.h(0) | ||
qc.cx(0, 1) | ||
qc.cx(1, 2) | ||
qc.cx(2, 3) | ||
qc.cx(3, 4) | ||
# Collects all CX-gates into a single block | ||
qc1 = CollectLinearFunctions()(qc) | ||
qc1.draw(output='mpl') | ||
# Collects CX-gates into two blocks of width 3 | ||
qc2 = CollectLinearFunctions(max_block_width=3)(qc) | ||
qc2.draw(output='mpl') |