sf.backends

Warning

Unless you are a Strawberry Fields developer, you likely do not need to use these classes directly.

See the general Engine class for details on loading a particular backend for quantum program execution.

This package contains the modules that make up the Strawberry Fields backends. This includes photonic simulators, shared numerical operations, and states objects returned by statevector simulators.

Local statevector simulators

Below are all available local statevector backends currently provided by Strawberry Fields. These simulators all run locally, provide access to the state after simulation, and the state is preserved between engine runs.

FockBackend()

Implements a simulation of quantum optical circuits in a truncated Fock basis using NumPy, returning a BaseFock state object.

GaussianBackend()

The GaussianBackend implements a simulation of quantum optical circuits in NumPy using the Gaussian formalism, returning a GaussianState state object.

TFBackend([graph])

Implements a simulation of quantum optical circuits in a truncated Fock basis using TensorFlow, returning a FockStateTF state object.

BaseFockState(state_data, num_modes, pure, …)

Class for the representation of quantum states in the Fock basis.

GaussianState(state_data, num_modes, qmat, Amat)

Class for the representation of quantum states using Gaussian representation.

FockStateTF(state_data, num_modes, pure, …)

Class for the representation of quantum states in the Fock basis using the TFBackend.

Backend API

A list of the abstract base classes that define the statevector backend API

BaseState(num_modes[, mode_names])

Abstract base class for the representation of quantum states.

BaseGaussianState(state_data, num_modes[, …])

Class for the representation of quantum states using the Gaussian formalism.

BaseBackend()

Abstract base class for backends.

BaseFock()

Abstract base class for backends capable of Fock state manipulation.

BaseGaussian()

Abstract base class for backends that are only capable of Gaussian state manipulation.

Utility modules

The following utility modules are provided for backend development.

shared_ops

Common shared operations that can be used by backends