symop.polynomial.kernels.devices.phase_shifter

Polynomial kernels for path phase shifter devices.

This module implements backend kernels for applying a constant phase rotation to all modes on a selected path in polynomial ket and density states.

The semantic planning stage is expected to provide the target path and phase angle in action.params.

Notes

The kernel performs the representation-specific phase rewrite for each mode on the selected path. No additional label-edit phase is required for the physical phase-shifter action.

Functions

phase_shifter_poly_density(*, state, action, ctx)

Apply a path phase shifter to a polynomial density state.

phase_shifter_poly_ket(*, state, action, ctx)

Apply a path phase shifter to a polynomial ket state.

class _PhaseShifterKernelParams(path: Path, phi: float) None

Bases: object

Parsed kernel parameters for one phase-shifter application.

Parameters:
  • path (Path)

  • phi (float)

path

Target path on which the phase shift is applied.

phi

Phase angle in radians.

path: Path
phi: float
_parse_phase_shifter_params(action: DeviceAction) _PhaseShifterKernelParams

Extract and validate kernel parameters from a device action.

Parameters:

action (DeviceAction) – Semantic device action produced during planning.

Returns:

Parsed phase-shifter parameters.

Return type:

_PhaseShifterKernelParams

Raises:
  • TypeError – If action.params does not have the expected mapping shape or if parameter values have invalid types.

  • KeyError – If a required key is missing.

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

Apply a path phase shifter to a polynomial density state.

Parameters:
  • state (DensityPolyState) – Input polynomial density state.

  • action (DeviceAction) – Semantic device action containing phase-shifter parameters.

  • ctx (ApplyContext) – Unused for direct phase-shifter application. Included for API consistency with other kernels.

Returns:

Output density state after applying the phase shift to all modes on the selected path.

Return type:

DensityPolyState

Notes

The phase shift is applied mode-by-mode to all modes whose labels lie on the selected path. Modes on other paths are left unchanged.

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

Apply a path phase shifter to a polynomial ket state.

Parameters:
  • state (KetPolyState) – Input polynomial ket state.

  • action (DeviceAction) – Semantic device action containing phase-shifter parameters.

  • ctx (ApplyContext) – Unused for direct phase-shifter application. Included for API consistency with other kernels.

Returns:

Output ket state after applying the phase shift to all modes on the selected path.

Return type:

KetPolyState

Notes

The phase shift is applied mode-by-mode to all modes whose labels lie on the selected path. Modes on other paths are left unchanged.