Operations

Strawberry Fields supports a wide variety of photonic quantum operations — including gates, state preparations and measurements. These operations are used to construct quantum programs, as in the following example:

with prog.context as q:
    Fock(2)       | q[0]
    Fock(3)       | q[1]
    BSgate()      | (q[0], q[1])
    MeasureFock() | q[0]

This program uses Fock state preparation (Fock), beamsplitters (BSgate), and a photon number resolving detector (MeasureFock).

Below is a list of all quantum operations supported by Strawberry Fields.

Note

In the Strawberry Fields we use the convention \(\hbar=2\) by default, however this can be changed using the global variable sf.hbar.

See Conventions and formulas for more details.

Single-mode gates

Dgate(r[, phi])

Phase space displacement gate.

Xgate(x)

Position displacement gate.

Zgate(p)

Momentum displacement gate.

Sgate(r[, phi])

Phase space squeezing gate.

Rgate(theta)

Rotation gate.

Pgate(s)

Quadratic phase gate.

Vgate(gamma)

Cubic phase gate.

Fouriergate()

Fourier gate.

Two-mode gates

BSgate([theta, phi])

Beamsplitter gate.

MZgate(phi_in, phi_ex)

Mach-Zehnder interferometer.

S2gate(r[, phi])

Two-mode squeezing gate.

CXgate([s])

Controlled addition or sum gate in the position basis.

CZgate([s])

Controlled phase gate in the position basis.

CKgate(kappa)

Cross-Kerr gate.

State preparation

Vacuum()

Prepare a mode in the vacuum state.

Coherent([r, phi])

Prepare a mode in a coherent state.

Squeezed([r, p])

Prepare a mode in a squeezed vacuum state.

DisplacedSqueezed([r_d, phi_d, r_s, phi_s])

Prepare a mode in a displaced squeezed state.

Thermal([n])

Prepare a mode in a thermal state.

Fock([n])

Prepare a mode in a Fock basis state.

Catstate([alpha, p])

Prepare a mode in a cat state.

Ket(state)

Prepare mode(s) using the given ket vector(s) in the Fock basis.

DensityMatrix(state)

Prepare mode(s) using the given density matrix in the Fock basis.

Gaussian(V[, r, decomp, tol])

Prepare the specified modes in a Gaussian state.

Measurements

MeasureFock([select, dark_counts])

Photon counting measurement: measures a set of modes in the Fock basis.

MeasureThreshold([select])

Measures a set of modes with thresholded Fock-state measurements, i.e., measuring whether a mode contain zero or nonzero photons.

MeasureHomodyne(phi[, select])

Performs a homodyne measurement, measures one quadrature of a mode.

MeasureHeterodyne([select])

Performs a heterodyne measurement on a mode.

MeasureX

Performs a homodyne measurement, measures one quadrature of a mode.

MeasureP

Performs a homodyne measurement, measures one quadrature of a mode.

MeasureHD

Performs a heterodyne measurement on a mode.

See also

See the measurements and post-selection tutorial for more details on applying measurements, post-selection, and classical processing.

Channels

LossChannel(T)

Perform a loss channel operation on the specified mode.

ThermalLossChannel(T, nbar)

Perform a thermal loss channel operation on the specified mode.

Decompositions

Interferometer(U[, mesh, drop_identity, tol])

Apply a linear interferometer to the specified qumodes.

GraphEmbed(A[, mean_photon_per_mode, …])

Embed a graph into an interferometer setup.

BipartiteGraphEmbed(A[, …])

Embed a bipartite graph into an interferometer setup.

GaussianTransform(S[, vacuum, tol])

Apply a Gaussian symplectic transformation to the specified qumodes.

Gaussian(V[, r, decomp, tol])

Prepare the specified modes in a Gaussian state.