- Notifications
You must be signed in to change notification settings - Fork1.2k
Fix kraus channels for fallbacks to super-operators#7537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
- There were a few issues with the new strategy to fall backto super-operator calculations using apply_channels.- First, the super_operator_to_kraus function is generally notprecise or numerically stable enough to support an atol of 1e-10so loosened this to 1e-6 and also allowed the ability to specifythis as a parameter.- Next, some operators define decomposition, so cirq.kraus shouldtry to decompose and get a unitary before falling back tousing apply_channel.
mhucka left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM with requests for some minor docstring adjustments.
Uh oh!
There was an error while loading.Please reload this page.
| default: Determines the fallback behavior when `val` doesn't have | ||
| a channel. If `default` is not set, a TypeError is raised. If | ||
| default is set to a value, that value is returned. | ||
| atol: If calculating kraus channels from channels, use this tolerance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Typo: kraus → Kraus
| deftest_kraus_channel_with_has_unitary(): | ||
| """CZSWAP is a gate with no unitary but has a unitary.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think there is something wrong with this docstring ;-)
codecovbot commentedJul 25, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #7537 +/- ##==========================================- Coverage 97.53% 97.53% -0.01%========================================== Files 1095 1095 Lines 99006 99014 +8 ==========================================+ Hits 96570 96576 +6- Misses 2436 2438 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mhucka left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
6d10979Uh oh!
There was an error while loading.Please reload this page.
- There were a few issues with the new strategy to fall back tosuper-operator calculations using apply_channels.- First, the super_operator_to_kraus function is generally not preciseor numerically stable enough to support an atol of 1e-10 so loosenedthis to 1e-6 and also allowed the ability to specify this as aparameter.- Next, some operators define decomposition, so cirq.kraus should try todecompose and get a unitary before falling back to using apply_channel.Fixes:#7536
Uh oh!
There was an error while loading.Please reload this page.
Fixes:#7536