sf.ops.MeasureFock¶
-
class
MeasureFock
(select=None, dark_counts=None)[source]¶ Bases:
strawberryfields.ops.Measurement
Photon counting measurement: measures a set of modes in the Fock basis.
Also accessible via the shortcut variable
Measure
.After measurement, the modes are reset to the vacuum state.
Warning
Photon counting is available in the Gaussian backend, but the state of the circuit is not updated after measurement (since it would be non-Gaussian).
Details and Conventions
Definition
Photon counting is a non-Gaussian projective measurement given by
\[\ket{n_i}\bra{n_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
= None¶
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 also stores the measurement result in the RegRefs.- Keyword Arguments
shots (int) – Number of independent evaluations to perform. Only applies to Measurements.
-
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
-