How are the infinite dimensional operators such as (Displacement, Rotation, X and P operators) and states (coherent state, displaced squeezed states) represented in a finite dimensional truncated Fock Backend?

I require the exact matrix elements of X and P in a truncated Fock space (for a single qumode) in order to make theoretical predictions to test simulations run in the Fock backend.

Hey @Omar_Ibna_Nazim!

A lot of heavy calculations are diverted to another software package we have called `thewalrus`

: GitHub - XanaduAI/thewalrus: A library for the calculation of hafnians, Hermite polynomials and Gaussian boson sampling.. The displacement operator is one of them. In the fock representation, it’s calculated using a recurrence relation: https://github.com/XanaduAI/thewalrus/blob/master/thewalrus/fock_gradients.py#L48.

`Xgate`

also gets decomposed into a displacement operation (see here: https://github.com/XanaduAI/strawberryfields/blob/master/strawberryfields/ops.py#L1540)

`Pgate`

gets decomposed into an `Sgate`

and an `Rgate`

(see here: https://github.com/XanaduAI/strawberryfields/blob/master/strawberryfields/ops.py#L1728)

As far as getting matrix elements go, let me get back to you!

1 Like

For getting the matrix representation of operators in the Fock basis, most of that is off-loaded to the `thewalrus`

:

https://the-walrus.readthedocs.io/en/latest/code/fock_gradients.html

I recommend installing `thewalrus`

and exploring! Let me know if this helps

1 Like