Fix controlled gate decomposition test on certain machines#7112
Closed
daxfohl wants to merge 1 commit intoquantumlib:mainfrom
Closed
Fix controlled gate decomposition test on certain machines#7112daxfohl wants to merge 1 commit intoquantumlib:mainfrom
daxfohl wants to merge 1 commit intoquantumlib:mainfrom
Conversation
… MatrixGate decomposition.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7112 +/- ##
==========================================
- Coverage 98.15% 98.15% -0.01%
==========================================
Files 1089 1089
Lines 95251 95250 -1
==========================================
- Hits 93497 93495 -2
- Misses 1754 1755 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
cc @pavoljuhas |
Collaborator
Author
|
Replacing with 7118 |
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.
When decomposing
CCCCCXand such large multi-controlled gates, intermediateMatrixGatesget created (notably not controlledMatrixGates, which would be problematic; just top-levelMatrixGatesas part of the decomposition). These then get further decomposed to a different set of gates.On some systems, due to rounding error, they get decomposed to a different set of gates that usual, which are equivalent but have different global phase than the standard decomposition. Again, these are top-level
MatrixGates, not controlled ones, so its "okay" that their decompositions have different global phase. However, the test tested fornp.allclose, and this test would fail on such systems. This PR changes the test tocirq.equal_up_to_global_phase, which should fix the tests on those systems.xref #7071 (comment)
Also adding back some test parameters I'd removed earlier because they were failing on Windows, and I'd assumed it was due to general rounding error; it didn't occur to me that it could be a phase difference. Let's see if the change allows them to pass.