
11
sentation tracks the quantum state of an N -mode quantum
system using two Gaussian components: a 2N-dimensional
displacement vector
¯
r and a 2N × 2N-dimensional covari-
ance matrix V (a deeper technical overview is located
in Appendix A). After we have created a Gaussian state
(either via state = eng.run(backend="gaussian")
or by directly calling the state method of a Gaussian
backend), we can access
¯
r and V via state.means and
state.cov, respectively. Other useful Gaussian state
methods are displacement and squeezing, which re-
turn the Gaussian parameters associated to the underlying
state.
The scaling of the symplectic representation with the
number of modes is O(N
2
). On one hand, this is quite pow-
erful. It allows us to to efficiently simulate any computa-
tions which are fully Gaussian. On the other, the formalism
is not expressive enough to simulate more general quan-
tum computations. Only a small number of non-Gaussian
methods are available for this backend. These are auxiliary
methods where we extract some non-Gaussian information
from a Gaussian state, but do not update the state of the
circuit. One such method is fock_prob, which is imple-
mented using an optimized – yet still exponentially scaling –
algorithm. This method enables simulation of the Gaussian
boson sampling algorithm [10] using the Gaussian backend;
see Appendix C for a complete code example.
Fock Backend
This backend, also written in NumPy, uses a fundamen-
tally different description for qumodes than the Gaussian
representation. As discussed in the introductory sections,
the Fock representation encodes quantum computation in
a countably infinite-dimensional Hilbert space. This repre-
sentation is faithful, allowing a precise description of CV
systems, in particular non-Gaussian circuits. Yet simulating
infinite-dimensional systems leads to some computational
tradeoffs which are not present for qubit simulators. Most
importantly, we impose a cutoff dimension D for simula-
tions (chosen by the user), so the Fock backend only covers
a restricted set of number states {|0〉, ..., |D −1〉} for each
mode. The size of simulated quantum systems thus depends
on both the number of subsystems N and the cutoff, being
O(D
N
). We contrast this with qubit systems, where the base
is fixed, i.e., O(2
N
). While these scalings are both expo-
nential, in practice simulating qumode systems for D > 2 is
more computationally demanding than qubits. This is be-
cause the (truncated) qumode subsystems have a higher di-
mension and thus encode more information than their qubit
counterparts.
Physically, imposing a cutoff is a reasonable strategy since
higher photon-number states must have higher energy and,
in practice, quantum-optical systems will have bounded en-
ergy (e.g., limited by the power of a laser). On the other
hand, there are certainly states which can be easily pre-
pared in the lab, yet would not fit accurately on the sim-
ulator. Thus, some care must be taken to trade off between
the numerical cutoff value, the number of modes, and the
energy scale of the circuit. If the energy scale is sufficiently
low that all states fit within the specified cutoff, then sim-
ulations with the Fock and Gaussian backends will be in
numerical agreement.
Like the Gaussian backend, the Fock backend has a
state method which encapsulates the numerical state,
while also providing a number of methods and attributes
specific to the Fock representation (such as ket, trace,
and all_fock_probs.). Unlike the Gaussian representa-
tion, mixed state simulations take up more resources than
pure states. Pure states are represented in the Fock back-
end by an D
N
-dimensional complex vector and mixed states
by a D
2N
-dimensional density matrix. Because of this extra
overhead, by default the Fock backend will internally rep-
resent a quantum circuit as long as possible as a pure state,
switching to the mixed state representation only when it
becomes necessary. Most importantly, for N > 2 qumodes,
all state preparation Operations (Vacuum, Squeezed, Fock,
etc.) cause the representation to become mixed. This is be-
cause the mode where the state is prepared could be entan-
gled with other modes. To keep physically consistent, the
Fock backend will first trace out the relevant mode, neces-
sitating a mixed state representation. When possible, it is
recommended to apply gates to the (default) vacuum state in
order to efficiently prepare pure states. If desired, a mixed
state simulation can be enforced by passing the argument
pure=False when calling begin_circuit.
TensorFlow Backend
The other built-in backend for Strawberry Fields is coded
using TensorFlow. As a simulator, it uses the same internal
representation as the Fock backend (Fock basis, finite cut-
off, pure vs. mixed state representations, etc.) and has the
same methods. It can operate as a numerical simulator sim-
ilar to the other backends. Its main purpose, however, is to
leverage the many powerful tools provided by TensorFlow
to enable optimization and machine learning on quantum
circuits. Much of this functionality was presented in the
previous section, so we will not repeat it here.
Like the other simulators, users can query the TensorFlow
backend’s state method to access the internal representa-
tion of a circuit’s quantum state. This functions similarly
to the Fock backend’s state method, except that the state
returned can be an unevaluated Tensor object when the
keyword argument eval is set to False. This state Ten-
sor can be combined with any supported TensorFlow op-
erations (norm, self_adjoint_eig, inv, etc.) to enable
optimization and machine learning on various properties of
quantum circuits and quantum states.
Conclusions
We have introduced Strawberry Fields, a multi-faceted
software platform for continuous-variable quantum com-
puting. The main components of this library – a custom
quantum programming language (Blackbird), a compiler
engine, and a suite of quantum simulators targeting distinct