# sf.ops.Sgate¶

class Sgate(r, phi=0.0)[source]

Bases: strawberryfields.ops.Gate

Phase space squeezing gate.

$S(z) = \exp\left(\frac{1}{2}(z^* a^2 -z {a^\dagger}^2)\right)$

where $$z = r e^{i\phi}$$.

Parameters
• r (float) – squeezing amount

• phi (float) – squeezing phase angle $$\phi$$

Definition

$\begin{split}& S(z) = \exp\left(\frac{1}{2}\left(z^* \a^2-z {\ad}^{2} \right) \right) = \exp\left(\frac{r}{2}\left(e^{-i\phi}\a^2 -e^{i\phi}{\ad}^{2} \right) \right)\\ & S^\dagger(z) \a S(z) = \a \cosh(r) -\ad e^{i \phi} \sinh r\\ & S^\dagger(z) \ad S(z) = \ad \cosh(r) -\a e^{-i \phi} \sinh(r)\end{split}$

where $$z=r e^{i \phi}$$ with $$r \geq 0$$ and $$\phi \in [0,2 \pi)$$.

The squeeze gate affects the position and momentum operators as

$S^\dagger(z) \x_{\phi} S(z) = e^{-r}\x_{\phi}, ~~~ S^\dagger(z) \p_{\phi} S(z) = e^{r}\p_{\phi}$

The Fock basis decomposition of displacement and squeezing operations was analysed by Krall , and the following quantity was calculated,

$\begin{split}f_{n,m}(r,\phi,\beta)&=\bra{n}\exp\left(\frac{r}{2}\left(e^{i \phi} \a^2 -e^{-i \phi} \ad \right) \right) D(\beta) \ket{m} = \bra{n}S(z^*) D(\beta) \ket{m}\\ &=\sqrt{\frac{n!}{\mu m!}} e^{\frac{\beta ^2 \nu ^*}{2\mu }-\frac{\left| \beta \right| ^2}{2}} \sum_{i=0}^{\min(m,n)}\frac{\binom{m}{i} \left(\frac{1}{\mu \nu }\right)^{i/2}2^{\frac{i-m}{2} +\frac{i}{2}-\frac{n}{2}} \left(\frac{\nu }{\mu }\right)^{n/2} \left(-\frac{\nu ^*}{\mu }\right)^{\frac{m-i}{2}} H_{n-i}\left(\frac{\beta }{\sqrt{2} \sqrt{\mu \nu }}\right) H_{m-i}\left(-\frac{\alpha ^*}{\sqrt{2}\sqrt{-\mu \nu ^*}}\right)}{(n-i)!}\end{split}$

where $$\nu=e^{- i\phi} \sinh(r), \mu=\cosh(r), \alpha=\beta \mu - \beta^* \nu$$.

Two important special cases of the last formula are obtained when $$r \to 0$$ and when $$\beta \to 0$$:

• For $$r \to 0$$ we can take $$\nu \to 1, \mu \to r, \alpha \to \beta$$ and use the fact that for large $$x \gg 1$$ the leading order term of the Hermite polynomials is $$H_n(x) = 2^n x^n +O(x^{n-2})$$ to obtain

$f_{n,m}(0,\phi,\beta) = \bra{n}D(\beta) \ket{m}=\sqrt{\frac{n!}{ m!}} e^{-\frac{\left| \beta \right| ^2}{2}} \sum_{i=0}^{\min(m,n)} \frac{(-1)^{m-i}}{(n-i)!} \binom{m}{i} \beta^{n-i} (\beta^*)^{m-i}$
• On the other hand if we let $$\beta\to 0$$ we use the fact that

$\begin{split}H_n(0) =\begin{cases}0, & \mbox{if }n\mbox{ is odd} \\ (-1)^{\tfrac{n}{2}} 2^{\tfrac{n}{2}} (n-1)!! , & \mbox{if }n\mbox{ is even} \end{cases}\end{split}$

to deduce that $$f_{n,m}(r,\phi,0)$$ is zero if $$n$$ is even and $$m$$ is odd or vice versa.

When writing the Bloch-Messiah reduction  of a Gaussian state in the Fock basis one often needs the following matrix element

$\bra{k} D(\alpha) R(\theta) S(r) \ket{l} = e^{i \theta l } \bra{k} D(\alpha) S(r e^{2i \theta}) \ket{l} = e^{i \theta l} f^*_{l,k}(-r,-2\theta,-\alpha)$
 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 = 1
 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 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