XanaduAI / MrMustard

A differentiable bridge between phase space and Fock space
https://mrmustard.readthedocs.io/
Apache License 2.0
78 stars 25 forks source link

Discrepency between wigner_discretized and the actual Wigner function. #483

Open arsalan-motamedi opened 3 weeks ago

arsalan-motamedi commented 3 weeks ago

Before posting a bug report

Expected behavior

Sending a phi squeezed state, we get a phi+pi squeezed one with wigner_discretized. As an example: `settings.HBAR=2 state = DisplacedSqueezed([0], r=0.5, phi=0.0, x=1.0, y=0.0)

state2 = DisplacedSqueezed([0], r=0.5, phi=np.pi, x=0.0, y=1.0) dm = math.sum(state2.tofock(100).dm().representation.array, axes=[0]) xvec = np.linspace(-5, 5, 100) pvec = np.linspace(-5, 5, 100) wigner, , _ = wigner_discretized(dm, xvec, pvec)

Wigner = (state >> CFT([0]) >> BtoPS([0], s=0)).representation.ansatz X, Y = np.meshgrid(xvec, pvec) Z = np.array([X - 1j Y, X + 1j Y]).transpose((1, 2, 0))`

Actual behavior

Explained above.

Reproduces how often

NA

System information

NA

Source code

No response

Tracebacks

No response

Additional information

No response