# sf.ops.BSgate¶

class BSgate(theta=pi/4, phi=0.)[source]

Bases: strawberryfields.ops.Gate

Beamsplitter gate.

$B(\theta,\phi) = \exp\left(\theta (e^{i \phi} a_1 a_2^\dagger -e^{-i \phi} a_1^\dagger a_2) \right)$
Parameters
• theta (float) – Transmittivity angle $$\theta$$. The transmission amplitude of the beamsplitter is $$t = \cos(\theta)$$. The value $$\theta=\pi/4$$ gives the 50-50 beamsplitter (default).

• phi (float) – Phase angle $$\phi$$. The reflection amplitude of the beamsplitter is $$r = e^{i\phi}\sin(\theta)$$. The value $$\phi = \pi/2$$ gives the symmetric beamsplitter.

Definition

For the annihilation and creation operators of two modes, denoted $$\a_1$$ and $$\a_2$$, the beamsplitter is defined by

$B(\theta,\phi) = \exp\left(\theta (e^{i \phi}\a_1 \ad_2 - e^{-i \phi} \ad_1 \a_2) \right)$

Action on the creation and annihilation operators

They will transform the operators according to

$\begin{split}B^\dagger(\theta,\phi) \a_1 B(\theta,\phi) &= \a_1\cos \theta -\a_2 e^{-i \phi} \sin \theta = t \a_1 -r^* \a_2,\\ B^\dagger(\theta,\phi) \a_2 B(\theta,\phi) &= \a_2\cos \theta + \a_1 e^{i \phi} \sin \theta= t \a_2 +r \a_1.\end{split}$

where $$t = \cos \theta$$ and $$r = e^{i\phi} \sin \theta$$ are the transmittivity and reflectivity amplitudes of the beamsplitter respectively.

Therefore, the beamsplitter transforms two input coherent states to two output coherent states $$B(\theta, \phi) \ket{\alpha,\beta} = \ket{\alpha',\beta'}$$, where

$\begin{split}\alpha' &= \alpha\cos \theta-\beta e^{-i\phi}\sin\theta = t\alpha - r^*\beta\\ \beta' &= \beta\cos \theta+\alpha e^{i\phi}\sin\theta = t\beta + r\alpha\\\end{split}$

By substituting in the definition of the creation and annihilation operators in terms of the position and momentum operators, it is possible to derive an expression for how the beamsplitter transforms the quadrature operators:

$\begin{split}&\begin{cases} B^\dagger(\theta,\phi) \x_1 B(\theta,\phi) = \x_1 \cos(\theta)-\sin(\theta) [\x_2\cos(\phi)+\p_2\sin(\phi)]\\ B^\dagger(\theta,\phi) \p_1 B(\theta,\phi) = \p_1 \cos(\theta)-\sin(\theta) [\p_2\cos(\phi)-\x_2\sin(\phi)]\\ \end{cases}\\[12pt] &\begin{cases} B^\dagger(\theta,\phi) \x_2 B(\theta,\phi) = \x_2 \cos(\theta)+\sin(\theta) [\x_1\cos(\phi)-\p_1\sin(\phi)]\\ B^\dagger(\theta,\phi) \p_2 B(\theta,\phi) = \p_2 \cos(\theta)+\sin(\theta) [\p_1\cos(\phi)+\x_1\sin(\phi)] \end{cases}\end{split}$

Action on the position and momentum eigenstates

A 50% or 50-50 beamsplitter has $$\theta=\pi/4$$ and $$\phi=0$$ or $$\phi=\pi$$; consequently $$|t|^2 = |r|^2 = \frac{1}{2}$$, and it acts as follows:

$\begin{split}& B(\pi/4,0)\xket{x_1}\xket{x_2} = \xket{\frac{1}{\sqrt{2}}(x_1-x_2)}\xket{\frac{1}{\sqrt{2}}(x_1+x_2)}\\ & B(\pi/4,0)\ket{p_1}_p\ket{p_2}_p = \xket{\frac{1}{\sqrt{2}}(p_1-p_2)}\xket{\frac{1}{\sqrt{2}}(p_1+p_2)}\end{split}$

and

$\begin{split}& B(\pi/4,\pi)\xket{x_1}\xket{x_2} = \xket{\frac{1}{\sqrt{2}}(x_1+x_2)}\xket{\frac{1}{\sqrt{2}}(x_2-x_1)}\\ & B(\pi/4,\pi)\ket{p_1}_p\ket{p_2}_p = \xket{\frac{1}{\sqrt{2}}(p_1+p_2)}\xket{\frac{1}{\sqrt{2}}(p_2-p_1)}\end{split}$

Alternatively, symmetric beamsplitter (one that does not distinguish between $$\a_1$$ and $$\a_2$$) is obtained by setting $$\phi=\pi/2$$.

 H Returns a copy of the gate with the self.dagger flag flipped. measurement_deps Extra dependencies due to parameters that depend on measurements. ns
H

Returns a copy of the gate with the self.dagger flag flipped.

H stands for hermitian conjugate.

Returns

formal inverse of this gate

Return type

Gate

measurement_deps

Extra dependencies due to parameters that depend on measurements.

Returns

dependencies

Return type

set[RegRef]

ns = 2
 apply(reg, backend, **kwargs) Ask a backend to execute the operation on the current register state right away. decompose(reg, **kwargs) Decompose the operation into elementary operations supported by the backend API. merge(other) Merge the operation with another (acting on the exact same set of subsystems).
apply(reg, backend, **kwargs)

Ask a backend to execute the operation on the current register state right away.

Like Operation.apply(), but takes into account the special nature of p[0] and applies self.dagger.

Returns

Gates do not return anything, return value is None

Return type

None

decompose(reg, **kwargs)

Decompose the operation into elementary operations supported by the backend API.

Like Operation.decompose(), but applies self.dagger.

merge(other)

Merge the operation with another (acting on the exact same set of subsystems).

Note

For subclass overrides: merge may return a newly created object, or self, or other, but it must never modify self or other because the same Operation objects may be also used elsewhere.

Parameters

other (Operation) – operation to merge this one with

Returns

other * self. The return value None represents the identity gate (doing nothing).

Return type

Operation, None

Raises

MergeFailure – if the two operations cannot be merged