CompiledPhotonicCircuit

class lightworks.sdk.circuit.photonic_compiler.CompiledPhotonicCircuit(n_modes: int)

Builds up the unitary representation of a particular circuit, combining provided components from a circuit spec.

Parameters:

n_modes (int) – The number of modes in a circuit. This should not include any required loss modes.

property U_full: ndarray[Any, dtype[complex128]]

Full unitary matrix.

add(spec: Component) None

Adds elements to the spec.

add_herald(n_photons: int, input_mode: int, output_mode: int | None = None) None

Add a herald across a selected input/output of the circuit. If only one mode is specified then this will be used for both the input and output.

Parameters:
  • n_photons (int) – The number of photons to use for the heralding.

  • input_mode (int) – The input mode to use for the herald.

  • output_mode (int | None, optional) – The output mode for the herald, if this is not specified it will be set to the value of the input mode.

property heralds: dict[str, dict[int, int]]

Returns details of heralds on the input and output.

property input_modes: int

The number of input modes that should be specified, accounting for the heralds used in the circuit.

property loss_modes: int

The current number of loss modes in the circuit.

property n_modes: int

The number of modes in the circuit.

property total_modes: int

The total number of modes, including real and loss modes.