-
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.
Add option
max_block_width
to CollectLinearFunctions
and ``Co…
…llectClifford`` passes (#13661) * new option max_block_width for CollectCliffords and CollectLinearFunctions passes * release notes * improving release notes * refactoring tests as per review comments * renaming max_width to max_block_width in comment
- Loading branch information
1 parent
75436a4
commit b9e9b41
Showing
8 changed files
with
176 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
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
27 changes: 27 additions & 0 deletions
27
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
features_transpiler: | ||
- | | ||
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') |
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
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
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