XanaduAI / MrMustard

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

AUTOSHAPE for fock states #490

Open JacobHast opened 2 months ago

JacobHast commented 2 months ago

Before posting a bug report

Expected behavior

I expect the application of Gaussian operations on state in the Fock representation to apply suitable cutoffs based on the AUTOSHAPE settings

Actual behavior

If I apply any Gaussian operation on a Fock state, the cutoff is expanded to the value given by AUTOSHAPE_MAX, regardless of the value of AUTOSHAPE_PROBABILITY

Reproduces how often

100 %

System information

Mr Mustard: a differentiable bridge between phase space and Fock space.
Copyright 2021 Xanadu Quantum Technologies Inc.

Python version:            3.10.14
Platform info:             Windows-10-10.0.19045-SP0
Installation path:         
c:\Users\jacob\miniconda3\envs\mrmustard_dev\lib\site-packages\mrmustard
Mr Mustard version:        0.7.3
Numpy version:             1.23.5
Numba version:             0.59.1
Scipy version:             1.14.1
The Walrus version:        0.21.0
TensorFlow version:        2.17.0

Source code

from mrmustard import settings
import mrmustard.lab_dev as mm

settings.AUTOSHAPE_PROBABILITY = 0.9
settings.AUTOSHAPE_MAX = 10

state = mm.Ket.from_fock([0], [0, 1])

state >> mm.Dgate([0])

Tracebacks

No response

Additional information

No response