# Equation Used for Fidelity in The Walrus Lib

**URL:** <https://discuss.pennylane.ai/t/equation-used-for-fidelity-in-the-walrus-lib/8406>\
**Category:** Photonic Software\
**Created:** [April 14, 2025, 3:58pm UTC](https://discuss.pennylane.ai/t/equation-used-for-fidelity-in-the-walrus-lib/8406 "2025-04-14T15:58:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_Moreira](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/gabriel_moreira/32/3709_2.png) [@Gabriel\_Moreira](https://discuss.pennylane.ai/u/Gabriel_Moreira)\
**Post date:** [April 14, 2025, 3:58pm UTC](https://discuss.pennylane.ai/t/equation-used-for-fidelity-in-the-walrus-lib/8406/1 "2025-04-14T15:58:36Z")

</div>

Hello! While studying the fidelity between Gaussian states, I found this method fidelity() from The Walrus, which I would like to use:

> **[Quantum algorithms — The Walrus 0.22.0-dev documentation](https://the-walrus.readthedocs.io/en/latest/code/quantum.html#thewalrus.quantum.fidelity)**

According to the documentation, this function implements the square of equation (96) from the paper “Gaussian states and operations – a quick reference” by Jonatan Bohr Brask (arXiv:2102.05748v2). However, after reading the paper, it seems that the correct reference should be equation (112), not (96). Anyone knows if this is right?

 ![Screenshot_20250412_180103_Drive](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/e/ec788a402c281041e1b382b59873cd274be0e9fa.jpeg)

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [April 14, 2025, 8:30pm UTC](https://discuss.pennylane.ai/t/equation-used-for-fidelity-in-the-walrus-lib/8406/2 "2025-04-14T20:30:55Z")

</div>

Hi @Gabriel_Moreira, welcome to the Forum!

Indeed it looks like the reference updated from a v1 to a v2, and the equation number was updated in the v2.

Would you like to open a Pull Request to fix this in the [repo for The Walrus](https://github.com/XanaduAI/thewalrus/pulls)? I can open one if you prefer not to.

And thanks for making us aware of this!

---

<div class="post-metadata">

**Author:** ![Gabriel\_Moreira](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/gabriel_moreira/32/3709_2.png) [@Gabriel\_Moreira](https://discuss.pennylane.ai/u/Gabriel_Moreira)\
**Post date:** [April 14, 2025, 10:00pm UTC](https://discuss.pennylane.ai/t/equation-used-for-fidelity-in-the-walrus-lib/8406/3 "2025-04-14T22:00:13Z")

</div>

Thanks for the answer. I’ll open a pull request for this.
