# Gaussian States in the Fock basis¶

*Section author: Nicolás Quesada <nicolas@xanadu.ai>*

In this section we show how the matrix elements of so-called Gaussian states in the Fock basis are related to the hafnians and loop hafnians introduced in the previous sections.

Note

The results presented in this page use the conventions introduced in the notation page and the reader is strongly encouraged to get familiar with them.

## Wigner functions and Gaussian states¶

The quantum state \(\varrho\) of an \(\ell\)-mode system can be uniquely characterized by its Wigner function [30]

where \(\vec \alpha = (\alpha_0,\ldots, \alpha_{\ell-1},\alpha_0^*,\ldots, \alpha_{\ell-1}^*)\) and similarly \(\vec \xi = (\xi_0,\ldots, \xi_{\ell-1},\xi_0^*,\ldots, \xi_{\ell-1}^*)\) are bivectors of complex amplitudes where the second half of the vector is the complex conjugate of the first half. The displacement operator is defined as \(\hat D(\xi):=\exp(\vec{\xi}^T \bm{\Omega} \hat \zeta)\), where \(\bm{\Omega}= \left[ \begin{smallmatrix} 0 & \mathbb{I} \\ -\mathbb{I} & 0 \end{smallmatrix} \right]\) is the symplectic form and \(\hat\zeta_j\) is an operator vector of the mode creation and annihilation operators. Recall, \(\ell\) being the number of modes, we have \(\hat\zeta_j=\hat a_j\) and \(\hat \zeta_{\ell+j}=\hat a_j^\dagger\) for \(j=1,\cdots,\ell\). These bosonic creation and annihilation operators satisfy the canonical commutation relations \([\hat a_i, \hat a_j]\) = 0 and \([\hat a_i, \hat a_j^\dagger] = \delta_{ij}\).

A quantum state is called Gaussian if its Wigner function is Gaussian [31]. Any multimode Gaussian state \(\varrho\) is completely parametrized by its first and second moments, namely the vector of means \(\vec{\beta}\) with components

and the Wigner-covariance matrix \(\bm{\sigma}\) with entries

where \(\{x,y\} := xy +yx\) denotes the anti-commutator.

The variables \((\alpha_0,\ldots,\alpha_{\ell-1})\) are said to be complex normal distributed with mean \((\beta_0,\ldots,\beta_{\ell-1}) \in \mathbb{C}^{\ell}\) and covariance matrix \({\bm{\sigma}}\) [32] which furthermore needs to satisfy the uncertainty relation [33]

where \(\bm{Z} = \left( \begin{smallmatrix} \mathbb{I} & 0\\ 0& -\mathbb{I} \end{smallmatrix} \right)\). The covariance matrix \(\bm{\sigma}\) is customarily parametrized in the following block form [32]

where \(\bm{\Gamma}\) is hermitian and positive definite, while \(\bm{C}\) is symmetric.

## Gaussian states in the quadrature basis¶

Historically, Gaussian states are parametrized not in terms of the covariance matrix \(\bm{\sigma}\) of the complex amplitudes \(\alpha_j\), but rather in terms of its quadrature components, the canonical positions \(q_j\) and canonical momenta \(p_j\),

where \(\hbar\) is a positive constant. There are at least three conventions for the value of this constant, \(\hbar \in \{1/2,1,2 \}\).

It is convenient to write the following vector \(\bm{r} = (q_0,\ldots,q_{\ell-1},p_0,\ldots,p_{\ell-1})\) whose mean is related to the vector of means \(\vec \beta\) as

Similarly the complex normal covariance matrix \(\bm{\sigma}\) of the variables \((\alpha_0,\ldots,\alpha_{\ell-1})\) is related to the normal covariance matrix \(\bm{V}\) of the variables \(\bm{r} = (q_0,\ldots,q_{\ell-1},p_0,\ldots,p_{\ell-1})\) as

Tip

To convert between the complex covariance matrix \(\bm{\sigma}\) and the quadrature covariance matrix \(\bm{V}\) use the functions `thewalrus.quantum.Qmat()`

and `thewalrus.quantum.Covmat()`

An important property of Gaussian states is that reduced (or marginal) states of a global Gaussian state are also Gaussian. This implies that the reduced covariance matrix of a subsystem of a Gaussian state together with a reduced vector of means fully characterize a reduced Gaussian state. The reduced covariance matrix for modes \(S = i_1,\ldots,i_n\) is obtained from the covariance matrix of the global state \(\bm{\sigma}\) or \(\bm{V}\) by keeping the columns and rows \(i_1,\ldots,i_n\) and \(i_1+\ell,\ldots,i_n+\ell\) of the original covariance matrix \(\bm{\sigma}\). Similarly one obtains the vector of means by keeping only entries \(i_1,\ldots,i_n\) and \(i_1+\ell,\ldots,i_n+\ell\) of the original vector of means \(\vec \beta\) or \(\bm{\bar{r}}\). Using the notation previously introduced, one can succinctly write the covariance matrix of modes \(S=i_1,\ldots,i_m\) as \(\bm{\sigma}_{(S)}\) or \(\bm{V}_{(S)}\) , and similarly the vector of means as \(\vec{\beta}_{(S)}\) or \(\bm{\bar{r}}_{(S)}\).

Tip

To obtain the reduced covariance matrix and vector of means for a certain subset of the modes use `thewalrus.quantum.reduced_gaussian()`

.

Note that for \(\bm{V}\) to be a valid **quantum** covariance matrix it needs to be symmetric and satisfy the uncertainty relation

Tip

To verify if a given quadrature covariance matrix is a valid quantum covariance matrix use the function `thewalrus.quantum.is_valid_cov()`

A Gaussian state is pure \(\varrho = \ket{\psi} \bra{\psi}\) if and only if \(\text{det}\left( \tfrac{2}{\hbar} \bm{V} \right) = 1\).

Tip

To verify if a given quadrature covariance matrix is a valid quantum covariance matrix and corresponds to a pure state use the function `thewalrus.quantum.is_pure_cov()`

Finally, there is a special subset of Gaussian states called **classical** whose covariance matrix satisfies

This terminology is explained in the next section when sampling is discussed.

Tip

To verify if a given quadrature covariance matrix is a valid quantum covariance matrix and corresponds to a classical state use the function `thewalrus.quantum.is_classical_cov()`

## Gaussian states in the Fock basis¶

In this section we use a generalization [34, 35] of the results of Hamilton et al. [36] by providing an explicit expression for Fock basis matrix elements \(\langle \bm{m} | \rho | \bm{n} \rangle\), \(\bm{n} = (n_0,\ldots, n_{\ell-1}), \bm{m} = (m_0,\ldots, m_{\ell-1})\), of an \(\ell\)-mode Gaussian state \(\rho\) with covariance matrix \(\bm{\sigma}\) and displacement vector \(\vec \beta\).
Note that these matrix elements can also be calculated using multidimensional Hermite polynomials as shown by Dodonov et al. [29]. Depending on how many of these elements are required one can prefer to calculate loop hafnians or multidimensional Hermite polynomials. In particular if one only needs a few matrix elements it is more advantageous to use the formulas derived below. On the other hand if one requires **all** the matrix elements up to a certain Fock occupation cutoff it is more efficient to use the methods of Dodonov et al., which are also implemented in this library.

We first define the following useful quantities:

We refer to \(\bm{\Sigma}\) as the **Husimi** covariance matrix.

As shown in detail in Appendix A of Ref. [35], the Fock matrix elements of a Gaussian state \(\rho\) are given by the expression

where \(\text{lhaf}\) is the loop hafnian and \(\text{vid}\) is the vector in diagonal notation introduced in the notation section.

Note that one can also obtain the probability of detecting a certain photon number pattern \(\bm{n} = (n_0,\ldots,n_{\ell-1})\) by calculating

Tip

To obtain the matrix element of gaussian state with quadrature covariance matrix \(\bm{V}\) and vector of means \(\bm{r}\) use the function `thewalrus.quantum.density_matrix_element()`

.

Tip

To obtain the Fock space density matrix of gaussian state with quadrature covariance matrix \(\bm{V}\) and vector of means \(\bm{r}\) use the function `thewalrus.quantum.density_matrix()`

.

In the case where the Gaussian state \(\varrho = |\psi \rangle \langle \psi|\) is pure then the matrix element

factorizes into a product of two amplitudes. In Ref. [34] it was shown that the Fock **amplitude** of a gaussian state is also given by a loop hafnian. Then, for pure states the matrix \(\bm{\bar{A}} = \bm{\bar{B}} \oplus \bm{\bar{B}}^*\).

Tip

To obtain the overlap of a *pure* gaussian state with quadrature covariance matrix \(\bm{V}\) and vector of means \(\bm{r}\) and a given Fock state \(\langle \bm{n}|\) use the function `thewalrus.quantum.pure_state_amplitude()`

.

Tip

To obtain the Fock space state vector (ket) of a pure gaussian state with quadrature covariance matrix \(\bm{V}\) and vector of means \(\bm{r}\) use the function `thewalrus.quantum.state_vector()`

.

## Gaussian states and threshold detection¶

In the last section we sketched how to obtain the probability that a certain photon-number outcome is obtained when a Gaussian state is measured with photon-number detectors. In this section we show how to obtain the analogous probability for the case of threshold detectors. These binary outcome detectors can only distinguish between the the vacuum state and occupied states, and thus for a single mode they are described by the POVM elements

where \(\ket{0_i}\) is the vacuum state of mode \(i\) and \(1_i\) is the identity in the Hilbert space of mode \(i\).

For an \(\ell\) mode Gaussian state with zero mean, the outcome of threshold detection in all of its modes is described by a bitstring vector \(\bm{n} = (n_0,\ldots,n_{\ell-1})\) and the probability of the event is given by Born’s rule according to

where \(\text{tor}\) is the Torontonian. For \(2 \ell \times 2 \ell\) matrix \(\bm{O}\) the Torontonian is defined as

The torontonian can be thought of as a generating function for hafnians (cf. the trace algorithm formula in algorithms section). The torontonian algorithm can be specified recursively to improve its performance [37].

The loop Torontonian is defined as

where \(\text{ltor}\) is the loop Torontonian, and \(\gamma=(\Sigma^{-1}\alpha)^*\) where \(\alpha\) is a \(2 \ell \times 2 \ell\) vector :cite: bulmer2022threshold.

Tip

The torontonian and loop torontonian are implemented as `thewalrus.tor()`

and `thewalrus.ltor()`

respectively.

## Contents

## Downloads