sf.ops.Rgate¶
-
class
Rgate
(theta)[source]¶ Bases:
strawberryfields.ops.Gate
Rotation gate.
\[R(\theta) = e^{i \theta a^\dagger a}\]- Parameters
theta (float) – rotation angle \(\theta\).
Details and Conventions
Note
We use the convention that a positive value of \(\phi\) corresponds to an anticlockwise rotation in the phase space.
Definition
We write the phase space rotation operator as
\[R(\phi) = \exp\left(i \phi \ad \a\right)= \exp\left(i \frac{\phi}{2} \left(\frac{\x^2+ \p^2}{\hbar}-\I\right)\right), \quad R^\dagger(\phi) \a R(\phi) = \a e^{i \phi}\]It rotates the position and momentum quadratures to each other:
\[\begin{split}R^\dagger(\phi)\x R(\phi) = \x \cos \phi -\p \sin \phi,\\ R^\dagger(\phi)\p R(\phi) = \p \cos \phi +\x \sin \phi.\end{split}\]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
= 1¶
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