qutip / QuantumToolbox.jl

Quantum Toolbox in Julia
https://qutip.org/QuantumToolbox.jl/dev
BSD 3-Clause "New" or "Revised" License
36 stars 15 forks source link

Fix hermitian check for `expect` #215

Closed ytdHuang closed 1 week ago

ytdHuang commented 1 week ago

Description

For the current method, if one calls

O   # Operator
rho # Operator
expect(O, rho)

It will automatically take the real value after tr when depend on whether O is hermitian or not. But the condition of taking the real value should depend on whether O * rho is hermitian or not.

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 1.77%. Comparing base (e76d77d) to head (c32c71e).

Files with missing lines Patch % Lines
src/qobj/functions.jl 0.00% 2 Missing :warning:

:exclamation: There is a different number of reports uploaded between BASE (e76d77d) and HEAD (c32c71e). Click for more details.

HEAD has 8 uploads less than BASE | Flag | BASE (e76d77d) | HEAD (c32c71e) | |------|------|------| ||9|1|
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #215 +/- ## ========================================== - Coverage 93.27% 1.77% -91.51% ========================================== Files 29 29 Lines 2172 2085 -87 ========================================== - Hits 2026 37 -1989 - Misses 146 2048 +1902 ```

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