Repository navigation
Fix Kraus coefficients in pauli_channel - #659
Open
chenyangsu wants to merge 1 commit into
Open
chenyangsu wants to merge 1 commit into
chenyangsu wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #659 +/- ##
==========================================
+ Coverage 90.05% 90.10% +0.05%
==========================================
Files 49 49
Lines 8524 8529 +5
==========================================
+ Hits 7676 7685 +9
+ Misses 848 844 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
matulni
approved these changes
Dec 3, 2026
matulni
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me! Project's policy is to have two maintainer approval before merging, so let's wait for a second approval.
Thanks for the bug-fix!!
This branch has not been deployed
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.
Context (if applicable):
pauli_channel(0.1, 0.1, 0.1)raisesValueError: The specified channel is not normalized.because it passesnp.sqrt(1 - p_i)forOps.Iand divides each Pauli probability by3.0. Atpauli_channel(0.25, 0.25, 0.25), normalization passes with squared coefficients[0.75, 0.0833, 0.0833, 0.0833]rather than[0.25, 0.25, 0.25, 0.25].Description of the change:
Could we use
np.sqrt(p_i)forOps.Iandnp.sqrt(px),np.sqrt(py),np.sqrt(pz)forX,Y,Z, withcheck_probabilityon each input? Happy to skipcheck_probabilityif you prefer.Related issue:
None.
Testing:
pytest tests/test_kraus.py-> 9 passed (newtest_pauli_channelfails on master), plus 130 density matrix tests,ruff,mypy, andpyright.