qiboteam / qibo

A full-stack framework for quantum computing.
https://qibo.science
Apache License 2.0
294 stars 60 forks source link

Fix value of the spectrum returned in the `quantum_info.entropies.von_neumann_entropy` #1360

Closed alhajri closed 5 months ago

alhajri commented 5 months ago

The Von Neumann entropy function when return_spectrum=True returns -log(eigenvalues). However, if the state is pure, return_spectrum=True returned 1.0 which is the value of the eigenvalue, not the -log. The function is now changed to return 0.0 to be more consistent with the behavior of the function in the pure case.

Checklist:

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.84%. Comparing base (5676a8a) to head (6a13965).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1360 +/- ## ======================================= Coverage 99.84% 99.84% ======================================= Files 74 74 Lines 10759 10759 ======================================= Hits 10742 10742 Misses 17 17 ``` | [Flag](https://app.codecov.io/gh/qiboteam/qibo/pull/1360/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qiboteam) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/qiboteam/qibo/pull/1360/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qiboteam) | `99.84% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qiboteam#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.