I really like the speed of the Bosonic backend. I noticed that MeasureFock() hasn’t been implemented yet in the stable version. See below from strawberryfields.backends.bosonicbackend.backend — Strawberry Fields 0.23.0 documentation
def measure_fock(self, modes, shots=1, select=None, **kwargs):
raise NotImplementedError(“Bosonic backend does not yet support Fock measurements.”)
Is there a planned release date for that yet?
It’s great to hear that you like the Bosonic backend! Unfortunately we don’t have any current plans for implementing this. If you really need this you could create your own fork of Strawberry Fields and add yourself the functionality that you need.
Thanks for the prompt reply. In fact, I am considering creating a fork and trying to add it myself, though that is sort of a last resort since I’m not so familiar with the innerworkings of SF yet. I found the github discussion on how the MeasureThreshold() function was added for the bosonic backend. Do you know of any advice for how to extend that to MeasureFock()? It seemed like Nicolas Quesada had some ideas of how to do it, just like he gave suggestions for how to do MeasureThreshold(), but just didn’t have time to do it.
It appears from [PRX Quantum 2, 040315 (2021) - Fast Simulation of Bosonic Qubits via Gaussian Functions in Phase Space] that Eqn. 61 provides the approximate Bosonic representation of a Fock state and Sec. III C provides a method for using that representation as part of a non-Gaussian transformation. So by correctly implementing those two equations into Strawberry Fields appears to be a general but approximate implementation of MeasureFock(). There are probably some particulars and details that I haven’t noticed yet that need careful attention to do it correctly so it works for general inputs. Any advice?
For now, we are not planning on implementing new features in Strawberry Fields, but rather just fix bugs. If you want to make a fork and implement the new feature for your personal use, you could use the code for measure_threshold as a template. But rather than using the linear combination of Gaussians for a threshold measurement, you should use the one for a fock state.
Hope this helps!