Closed enielse closed 2 months ago
@enielse, this PR initially had pygsti's master branch as the target. This made it look like your changes were much farther reaching than they actually are, and that caused GitHub to unnecessarily add a bunch of people as required PR reviewers. You should probably close this PR and open a new PR that targets develop (rather than master) from the beginning.
Ah, thanks Riley -- I must have missed that. I'll close this and reopen another.
Fixes a bug in
DenseOperator.kraus_operators
when Choi matrix has degenerate spectrum.Switches a
numpy.linalg.eig
call tonumpy.linalg.eigh
to ensure that the matrix of eigenvectors is unitary. This is not always the case foreig
(in particular for matrices with degenerate spectra), and is assumed by the code inkraus_operators
. Theeig
routine has had a history of not always giving a correct diagonalization, and so this PR also adds an assertion to ensure this is the case.Also adds a unit test that verifies Kraus decomposition works as expected for a depolarizing channel (one example of a channel with a degenerate Choi matrix spectrum).