# sf.ops.MeasureHomodyne¶

class MeasureHomodyne(phi, select=None)[source]

Bases: strawberryfields.ops.Measurement

Performs a homodyne measurement, measures one quadrature of a mode.

• Position basis measurement: $$\phi = 0$$ (also accessible via the shortcut variable MeasureX).

• Momentum basis measurement: $$\phi = \pi/2$$. (also accessible via the shortcut variable MeasureP)

The measured mode is reset to the vacuum state.

Parameters
• phi (float) – measurement angle $$\phi$$

• select (None, float) – (Optional) desired values of measurement result. Allows the post-selection of specific measurement results instead of randomly sampling.

Definition

Homodyne measurement is a Gaussian projective measurement given by projecting the state onto the states

$\ket{x_\phi}\bra{x_\phi},$

defined as eigenstates of the Hermitian operator

$\hat{x}_\phi = \cos(\phi) \hat{x} + \sin(\phi)\hat{p}.$

In the Gaussian backend, this is done by projecting onto finitely squeezed states approximating the $$x$$ and $$p$$ eigenstates. Due to the finite squeezing approximation, this results in a measurement variance of $$\sigma_H^2$$, where $$\sigma_H=2\times 10^{-4}$$.

In the Fock backends, this is done by using Hermite polynomials to calculate the $$\x_\phi$$ probability distribution over a specific range and number of bins, before taking a random sample.

 measurement_deps Extra dependencies due to parameters that depend on measurements. ns
measurement_deps

Extra dependencies due to parameters that depend on measurements.

Returns

dependencies

Return type

set[RegRef]

ns = 1
 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.

Parameters

reg (Sequence[RegRef]) – subsystems the operation is acting on

Returns

decomposition as a list of operations acting on specific subsystems

Return type

list[Command]

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