Unknown behavior

35 views
Skip to first unread message

rochisha.a...@gmail.com

unread,
Mar 12, 2024, 4:23:38 AMMar 12
to QuTiP: Quantum Toolbox in Python
While testing qutip-jax, I noticed, while running the below line in qutip-v5 I get fidelity = 2, which is strange as fidelity is between 0 and 1. Is some new definition of fidelity is being used for this case? Or is this not supported?

Thanks,
Rochisha

qutip.metrics.fidelity(qutip.qeye(2), qutip.qeye(2))

Simon Cross

unread,
Mar 12, 2024, 1:23:22 PMMar 12
to qu...@googlegroups.com
`qutip.qeye(...)` is not a valid density matrix -- it is not normalized and has a trace of 2 instead of 1. Use `.unit()` to normalize it, e.g.:
```
>>> x = qutip.qeye(2).unit()
>>> qutip.metrics.fidelity(x, x)
1.0
```
Reply all
Reply to author
Forward
0 new messages