sf.ops.Vacuum¶
-
class
Vacuum
[source]¶ Bases:
strawberryfields.ops.Preparation
Prepare a mode in the vacuum state.
Can be accessed via the shortcut variable
Vac
.Note
By default, newly created modes in Strawberry Fields default to the vacuum state.
Details and Conventions
Definition
The vacuum state \(\ket{0}\) is a Gaussian state defined by
\[\ket{0} = \frac{1}{\sqrt[4]{\pi \hbar}} \int dx~e^{-x^2/(2 \hbar)}\ket{x} ~~\text{where}~~ \a\ket{0}=0\]Tip
Available in Strawberry Fields as a NumPy array by
strawberryfields.utils.vacuum_state()
In the Fock basis, it is represented by Fock state \(\ket{0}\), and in the Gaussian formulation, by \(\bar{\mathbf{r}}=(0,0)\) and \(\mathbf{V}= \frac{\hbar}{2} I\).
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
= 1¶
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
-