Increase cutoff MeasureFock() gaussian backend

Is it possible to increase the cutoff dimension for gaussian backend when measuring fock states. I didn´t find any solution to this.

Hey @Hendrik!

Currently you can’t set the cutoff by, say, MeasureFock(cutoff=10). The default value under the hood is cutoff=5. There’s a simple PR for this that I just made: Add `cutoff` keyword argument to `measure_fock` in gaussian backend by isaacdevlugt · Pull Request #741 · XanaduAI/strawberryfields · GitHub. Would that suffice for your needs?

1 Like

Does this solution already work?

Hey @Hendrik!

I should have prefaced my original response with the fact that StrawberryFields is in maintenance mode — new features won’t be added unless they’re deemed necessary. Sorry for not mentioning this!

The PR I linked above isn’t high on the priority list for our team, but it really should get some attention because the issue you’re bringing up is a bit of a bug — cutoff_dim can be passed into the gaussian backend (e.g., eng = sf.Engine("gaussian", backend_options={"cutoff_dim": 6}) ), but cutoff_dim isn’t actually being utilized under the hood :thinking:.

For the time being, you can still access this added feature by building StrawberryFields from source on that branch. I would first create a new virtual python environment where you can have this “custom” SF version (includes the new feature). Once you do that, you can install via:

python -m pip install git+https://github.com/XanaduAI/strawberryfields.git@measure-fock-gaussian-backend-cutoff

Let me know if this works!

1 Like