symop.polynomial.kernels.devices.number_state_source

Polynomial ket kernel for a simple photon source device.

This module implements a density-polynomial kernel that emits a specified number of excitations into designated output modes.

The semantic planning stage is expected to provide:

action.params["source_modes"]

Iterable of output modes to populate.

action.params["excxitations_by_mode"]

Mappind from mode signature to a nonnegative integer exccitation count.

Notes

This implementation constructs a pure number-state source and returns it as a polynomial ket state.

Functions

number_state_source_poly_density(*, state, ...)

Emit a multimode pure number state and return it as a density state.

number_state_source_poly_ket(*, state, ...)

Generate a polynomial ket representing a multimode number state.

class _NumberStateSourceParams(source_modes: tuple[ModeOp, ...], excitations_by_mode: Mapping[tuple[object, ...], int]) None

Bases: object

Parsed parameters for the number-state source kernel.

Parameters:
source_modes

Tuple of output modes into which excitations are emitted.

excitations_by_mode

Mapping from mode signature to a nonnegative integer specifying the number of excitations in that mode.

excitations_by_mode: Mapping[tuple[object, ...], int]
source_modes: tuple[ModeOp, ...]
_creator_word_for_number_state(*, source_modes: tuple[ModeOp, ...], excitations_by_mode: Mapping[tuple[object, ...], int]) tuple[LadderOp, ...]

Construct a creation-operator word for a number state.

Parameters:
  • source_modes (tuple[ModeOp, ...]) – Modes to populate with excitations.

  • excitations_by_mode (Mapping[tuple[object, ...], int]) – Mapping from mode signature to excitation count.

Returns:

Ordered tuple of creation operators representing the number state.

Return type:

tuple[LadderOpProtocol, …]

Raises:

ValueError – If a mode does not provide a valid creation operator.

Notes

Each mode contributes n creation operators according to its excitation count, resulting in a normally ordered product.

_number_state_normalization_coeff(*, source_modes: tuple[ModeOp, ...], excitations_by_mode: Mapping[tuple[object, ...], int]) float

Return the normalization coefficient for a multimode number state.

Parameters:
Return type:

float

_parse_number_state_source_params(action: DeviceAction) _NumberStateSourceParams

Parse and validate parameters for the number-state source.

Parameters:

action (DeviceAction) – Device action containing semantic parameters.

Returns:

Validated and normalized parameter container.

Return type:

_NumberStateSourceParams

Raises:
  • TypeError – If required parameters are missing or have incorrect types.

  • ValueError – If excitation counts are negative.

Notes

Expected entries in action.params:

  • "source_modes": iterable of modes

  • "excitations_by_mode": mapping from signatures to counts

number_state_source_poly_density(*, state: DensityPolyState, action: DeviceAction, ctx: ApplyContext) DensityPolyState

Emit a multimode pure number state and return it as a density state.

Parameters:
  • state (DensityPolyState) – Input density state. Currently ignored by this source kernel.

  • action (DeviceAction) – Semantic device action containing source-mode and excitation data.

  • ctx (ApplyContext) – Apply context forwarded to the ket kernel.

Returns:

Pure density state of the emitted number-state source.

Return type:

DensityPolyState

number_state_source_poly_ket(*, state: KetPolyState, action: DeviceAction, ctx: ApplyContext) KetPolyState

Generate a polynomial ket representing a multimode number state.

Parameters:
  • state (KetPolyState) – Input ket state. Currently ignored by this source kernel.

  • action (DeviceAction) – Device action containing source-mode and excitation data.

  • ctx (ApplyContext) – Apply context (unused in this implementation).

Returns:

Polynomial ket state constructed from creation operators acting on the vacuum.

Return type:

KetPolyState

Notes

  • The output state is independent of the input state.

  • The number state is constructed via repeated application of creation operators on the vacuum.