You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the approximate quantum compiler (AQC) is used to synthesis a unitary which has a determinant −1 (e.g., an "odd parity" permutation matrix), a warning message is displayed:
[...]synthesis\aqc\aqc.py:83: RuntimeWarning: invalid value encountered in power
su_matrix = target_matrix / np.power(target_det, (1 / matrix_dim))
then it continues its work and generates a circuit. The unitary of the generated circuit, however, is not an approximation to the original one.
Thanks @EgrettaThula for finding this bug, would you like to make a PR to implement your suggestion? You would just have to make the change you suggest, and add a test case.
#9331)
* Fix: AQC returns a wrong circuit when the unitary has a determinant −1 (#9327)
* Added release notes
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Environment
What is happening?
When the approximate quantum compiler (AQC) is used to synthesis a unitary which has a determinant −1 (e.g., an "odd parity" permutation matrix), a warning message is displayed:
then it continues its work and generates a circuit. The unitary of the generated circuit, however, is not an approximation to the original one.
How can we reproduce the issue?
What should happen?
The code must take this case into account
Any suggestions?
The root cause of this wrong behavior is this line of code:
As per numpy.power documentation:
The issue can be simply fixed by replacing this line with:
The text was updated successfully, but these errors were encountered: