sf.ops.S2gate¶
-
class
S2gate
(r, phi=0.0)[source]¶ Bases:
strawberryfields.ops.Gate
Two-mode squeezing gate.
\[S_2(z) = \exp\left(z a_1^\dagger a_2^\dagger - z^* a_1 a_2 \right) = \exp\left(r (e^{i\phi} a_1^\dagger a_2^\dagger - e^{-i\phi} a_1 a_2 ) \right)\]where \(z = r e^{i\phi}\).
- Parameters
r (float) – squeezing amount
phi (float) – squeezing phase angle \(\phi\)
Details and Conventions
Definition
\[S_2(z) = \exp\left(z \a^\dagger_1\a^\dagger_2 -z^* \a_1 \a_2 \right) = \exp\left(r (e^{i\phi} \a^\dagger_1\a^\dagger_2 -e^{-i\phi} \a_1 \a_2 \right)\]where \(z=r e^{i \phi}\) with \(r \geq 0\) and \(\phi \in [0,2 \pi)\).
It can be decomposed into two opposite local squeezers sandwiched between two 50% beamsplitters [29]:
\[S_2(z) = B^\dagger(\pi/4,0) \: \left[ S(z) \otimes S(-z)\right] \: B(\pi/4,0)\]Two-mode squeezing will transform the operators according to
\[\begin{split}S_2(z)^\dagger \a_1 S_2(z) &= \a_1 \cosh(r)+\ad_2 e^{i \phi} \sinh(r),\\ S_2(z)^\dagger \a_2 S_2(z) &= \a_2 \cosh(r)+\ad_1 e^{i \phi} \sinh(r),\\\end{split}\]where \(z=r e^{i \phi}\) with \(r \geq 0\) and \(\phi \in [0,2 \pi)\).
Attributes
Returns a copy of the gate with the self.dagger flag flipped.
Extra dependencies due to parameters that depend on measurements.
-
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¶
Methods
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