quil-lang / quilc

The optimizing Quil compiler.
Apache License 2.0
452 stars 73 forks source link

check for diagonal matrices in find-diag-in-e-basis #857

Closed Spin1Half closed 1 year ago

Spin1Half commented 1 year ago

It seems that LAPACK becomes unstable on ARM when attempting to find the eigenvectors and eigenvalues of a diagonal matrix. This instability is triggered in find-diagonalizer-in-e-basis. The operation becomes trivial when run on a diagonal matrix, so we check for this and return the identity to avoid making a potentially unstable LAPACK call.

Fixes #842.

notmgsk commented 1 year ago

:tada: