sf.ops.GraphEmbed

class GraphEmbed(A, mean_photon_per_mode=1.0, make_traceless=False, tol=1e-06)[source]

Bases: strawberryfields.ops.Decomposition

Embed a graph into an interferometer setup.

This operation uses the Takagi decomposition to decompose an adjacency matrix into a sequence of squeezers and beamsplitters and rotation gates.

Parameters
  • A (array) – an \(N\times N\) complex or real symmetric matrix

  • mean_photon_per_mode (float) – guarantees that the mean photon number in the pure Gaussian state representing the graph satisfies \(\frac{1}{N}\sum_{i=1}^N sinh(r_{i})^2 ==\) :code:mean_photon

  • make_traceless (boolean) – Removes the trace of the input matrix, by performing the transformation \(\tilde{A} = A-\mathrm{tr}(A) \I/n\). This may reduce the amount of squeezing needed to encode the graph but will lead to different photon number statistics for events with more than one photon in any mode.

  • tol (float) – the tolerance used when checking if the input matrix is symmetric: \(|A-A^T| <\) tol

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 = None

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.

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