XanaduAI / thewalrus

A library for the calculation of hafnians, Hermite polynomials and Gaussian boson sampling.
https://the-walrus.readthedocs.io
Apache License 2.0
99 stars 54 forks source link

Glynn method has an weird prefactor #376

Open hsgyc opened 6 months ago

hsgyc commented 6 months ago

In Hafnian evaluation function, including _calc_hafnian and _calc_loop_hafnian, there is a weird factor multiplication.

if glynn and kept_edges[0] == 0:
            prefac *= 0.5

However, when glynn method is invoked, keps_deges has value in {-1, 1} and will never be zero. So this code block makes no sense.

nquesada commented 6 months ago

Could you make a PR removing that line, to see if the tests pass?