sf.ops.MSgate¶
-
class
MSgate
(r, phi=0.0, r_anc=10.0, eta_anc=1.0, avg=True)[source]¶ Bases:
strawberryfields.ops.Channel
Phase space measurement-based squeezing gate.
This mode can either be implemented as the average transformation, corresponding to a Gaussian CPTP map, or as a single-shot instance of the measurement-based squeezing circuit.
Measurement-based squeezing consists of adding an ancillary squeezed mode, entangling it with the target mode at a beamsplitter, performing a homodyne measurement on the ancillary mode, and then applying a feedforward displacement to the target mode.
- Parameters
r (float) – target squeezing magnitude
phi (float) – target squeezing phase
r_anc (float) – squeezing magnitude of the ancillary mode
eta_anc (float) – detection efficiency of the ancillary mode
avg (bool) – whether to apply the average or single-shot map
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