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
Details and Conventions
Definition
For every symplectic matrix \(S\in\mathbb{R}^{2N\times 2N}\), there exists orthogonal symplectic matrices \(O_1\) and \(O_2\), and diagonal matrix \(Z\), such that
\[S = O_1 Z O_2\]where \(Z=\text{diag}(e^{-r_1},\dots,e^{-r_N},e^{r_1},\dots,e^{r_N})\) represents a set of one mode squeezing operations with parameters \((r_1,\dots,r_N)\).
Gaussian symplectic transforms can be grouped into two main types; passive transformations (those which preserve photon number) and active transformations (those which do not). Compared to active transformation, passive transformations have an additional constraint - they must preserve the trace of the covariance matrix, \(\text{Tr}(SVS^T)=\text{Tr}(V)\); this only occurs when the symplectic matrix \(S\) is also orthogonal (\(SS^T=\I\)).
The Bloch-Messiah decomposition therefore allows any active symplectic transformation to be decomposed into two passive Gaussian transformations \(O_1\) and \(O_2\), sandwiching a set of one-mode squeezers, an active transformation.
Acting on the vacuum
In the case where the symplectic matrix \(S\) is applied to a vacuum state \(V=\frac{\hbar}{2}\I\), the action of \(O_2\) cancels out due to its orthogonality:
\[SVS^T = (O_1 Z O_2)\left(\frac{\hbar}{2}\I\right)(O_1 Z O_2)^T = \frac{\hbar}{2} O_1 Z O_2 O_2^T Z O_1^T = \frac{\hbar}{2}O_1 Z^2 O_1^T\]As such, a symplectic transformation acting on the vacuum is sufficiently characterised by single mode squeezers followed by a passive Gaussian transformation (\(S = O_1 Z\)).
Attributes
Extra dependencies due to parameters that depend on measurements.
-
measurement_deps
¶ Extra dependencies due to parameters that depend on measurements.
- Returns
dependencies
- Return type
set[RegRef]
-
ns
= None¶
Methods
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
.
-
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