# sf.ops.GaussianTransform¶

class GaussianTransform(S, vacuum=False, tol=1e-10)[source]

Bases: strawberryfields.ops.Decomposition

Apply a Gaussian symplectic transformation to the specified qumodes.

This operation uses the Bloch-Messiah decomposition to decompose a symplectic matrix $$S$$:

$S = O_1 R O_2$

where $$O_1$$ and $$O_2$$ are two orthogonal symplectic matrices (and thus passive Gaussian transformations), and $$R$$ is a squeezing transformation in the phase space ($$R=\text{diag}(e^{-z},e^z)$$).

The symplectic matrix describing the Gaussian transformation on $$N$$ modes must satisfy

$\begin{split}S\Omega S^T = \Omega, ~~\Omega = \begin{bmatrix}0&I\\-I&0\end{bmatrix}\end{split}$

where $$I$$ is the $$N\times N$$ identity matrix, and $$0$$ is the zero matrix.

The two orthogonal symplectic unitaries describing the interferometers are then further decomposed via the Interferometer operator and the Rectangular decomposition:

$U_i = X_i + iY_i$

where

$\begin{split}O_i = \begin{bmatrix}X&-Y\\Y&X\end{bmatrix}\end{split}$
Parameters
• S (array[float]) – a $$2N\times 2N$$ symplectic matrix describing the Gaussian transformation.

• vacuum (bool) – set to True if acting on a vacuum state. In this case, $$O_2 V O_2^T = I$$, and the unitary associated with orthogonal symplectic $$O_2$$ will be ignored.

• tol (float) – the tolerance used when checking if the matrix is symplectic: $$|S^T\Omega S-\Omega| \leq$$ tol

 measurement_deps Extra dependencies due to parameters that depend on measurements. ns
measurement_deps

Extra dependencies due to parameters that depend on measurements.

Returns

dependencies

Return type

set[RegRef]

ns = None
 apply(reg, backend, **kwargs) Ask a local 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 local backend to execute the operation on the current register state right away.

Takes care of parameter evaluations and any pending formal transformations (like dagger) and then calls Operation._apply().

Parameters
• reg (Sequence[RegRef]) – subsystem(s) the operation is acting on

• backend (BaseBackend) – backend to execute the operation

Returns

the result of self._apply

Return type

Any

decompose(reg, **kwargs)

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

See strawberryfields.backends.base.

Parameters

reg (Sequence[RegRef]) – subsystems the operation is acting on

Returns

decomposition as a list of operations acting on specific subsystems

Return type

list[Command]

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