Decompose multi-controlled single-qubit gates during transpilation - #1859
Open
luffy-orf wants to merge 1 commit into
Open
Decompose multi-controlled single-qubit gates during transpilation#1859luffy-orf wants to merge 1 commit into
luffy-orf wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1859 +/- ##
==========================================
- Coverage 99.50% 99.05% -0.46%
==========================================
Files 78 79 +1
Lines 13886 14128 +242
==========================================
+ Hits 13817 13994 +177
- Misses 69 134 +65
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes #1843: multi-controlled single-qubit gates (e.g.
RY,RX,H,U3) were not fully transpiled when produced as intermediate gates during decomposition of larger gates like controlledGIVENS.Before:
circuit.decompose()could leave multi-controlled rotation gates in the circuit.After: gates with two or more controls on a single qubit are synthesized into elementary gates (
CNOT,H,RX,RY,RZ,SX, etc.) using techniques from Vale et al. (2023).What changed
Gate.decompose()- second passAfter the existing flow (decompose base gate → re-apply controls via control mask), a new pass expands any remaining multi-controlled single-qubit gates (≥2 controls) into elementary gates. Singly-controlled gates (
CH, internals of controlledRBS, etc.) are unchanged.New module:
src/qibo/transpiler/multi_controlled_su2.pyIndependent implementation (not copied from qclib), aligned with the maintainer design discussed in the issue:
_decompose_multi_controlled_su2_real_decompose_multi_controlled_su2_decompose_multi_controlled_u2H, det ≠ 1)Core building blocks include multi-controlled
Xvia dirty-ancilla vchain (Iten et al.) and linear-depth multi-controlled SU(2) synthesis (Vale et al.).Gate._base_decompose()Routes directly to the new synthesis when a gate already has ≥2 controls.
decompositions.pyRe-exports the protected synthesis helpers for use elsewhere in the transpiler stack.
Example (issue reproduction)
Checklist: