CompiledPhotonicCircuit

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

Bases: object

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[tuple[int, ...], dtype[complex128]]

Full unitary matrix.

add(spec: Component) None

Adds elements to the spec.

add_herald(input_mode: int, output_mode: int, in_photon: int, out_photon: int) 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:
  • input_mode (int) – The input mode to use for the herald.

  • output_mode (int) – The output mode to use for the herald.

  • in_photon (int) – The number of photons to use on the heralding input.

  • out_photon (int) – The number of photons to use on the heralding output.

property heralds: HeraldData

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.