-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 2q fractional gates to the
ConsolidateBlocks
transpiler pass (#…
…13884) * add TwoQubitControlledUDecomposer to init file * add kak parametrized gates * add a test for parametrized gates * add num_basis_gates_inner function to TwoQubitControlledUDecomoser class * add TwoQubitControlledUDecomposer to consolidate_blocks function * add TwoQubitControlledUDecomposer to ConsolidateBlocks pass * add FromPyObject to enum * replace _inner_decomposition by _inner_decomposer * update rust code * add self.gate_name to 2-qubit decmposer classes * extend test_collect_rzz test * add release notes * update test_no_kak_gates_in_present_pm * remove commented line * add allow clippy * do not pop
- Loading branch information
1 parent
091228c
commit ec33b5f
Showing
7 changed files
with
110 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,5 @@ | |
TwoQubitBasisDecomposer, | ||
two_qubit_cnot_decompose, | ||
TwoQubitWeylDecomposition, | ||
TwoQubitControlledUDecomposer, | ||
) |
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
25 changes: 25 additions & 0 deletions
25
releasenotes/notes/add-2q-fractional-gates-to-consolidate-blocks-pass-65fadda8ba17c831.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,25 @@ | ||
--- | ||
features_transpiler: | ||
- | | ||
Added support for two-qubit fractional basis gates, such as :class:`.RZZGate`, to the | ||
:class:`.ConsolidateBlocks` transpiler pass. The decomposition itself is done using the | ||
:class:`.TwoQubitControlledUDecomposer`. | ||
For example:: | ||
from qiskit import QuantumCircuit | ||
from qiskit.transpiler import generate_preset_pass_manager | ||
from qiskit.transpiler.passes import ConsolidateBlocks | ||
qc = QuantumCircuit(2) | ||
qc.rzz(0.1, 0, 1) | ||
qc.rzz(0.2, 0, 1) | ||
consolidate_pass = ConsolidateBlocks(basis_gates=["rz", "rzz", "sx", "x", "rx"]) | ||
block = consolidate_pass(qc) # consolidate the circuit into a single unitary block | ||
block.draw(output='mpl') | ||
pm = generate_preset_pass_manager( | ||
optimization_level=2, basis_gates=["rz", "rzz", "sx", "x", "rx"] | ||
) | ||
tqc = pm.run(qc) # synthesizing the circuit into basis gates | ||
tqc.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