symop.devices.models.phase_shifters.phase_shifter¶
Path phase shifter device.
This module defines PhaseShifter, a single-path device that applies
a constant phase rotation to all modes on a selected path.
The planning stage records the target path and phase parameter for backend execution. No operator-level transformation is performed during planning.
Notes
The backend kernel is expected to realize the phase transformation at the operator level, typically corresponding to the unitary
which induces the mapping
Planning is purely semantic and does not modify amplitudes or apply label edits.
Classes
|
Ideal path phase shifter. |
- class PhaseShifter(phi: float) None¶
Bases:
DeviceBaseIdeal path phase shifter.
A phase shifter applies a constant phase rotation to all modes on a selected path. The transformation is represented at the operator level and affects the phase of creation and annihilation operators associated with the path.
- Parameters:
phi (
float) – Phase angle (in radians) applied to the selected path.
Notes
The phase is applied uniformly across all modes on the path.
Planning does not inspect the state or enumerate modes.
The actual operator-level rewrite is performed by the backend kernel.
- _abc_impl = <_abc._abc_data object>¶
- apply(state: State, *, ports: Mapping[str, Path], selection: object | None = None, runtime: DeviceRuntime | None = None, ctx: ApplyContext | None = None, out_kind: Literal['ket', 'density'] | None = None) State¶
Apply the device to a state through a runtime.
- Parameters:
state (
State) – Input quantum state.ports (
Mapping[str,Path]) – Mapping from device port names to path labels. Must contain the key"path".selection (
object|None) – Optional device-specific selection object. Not used by this device.runtime (
DeviceRuntime|None) – Optional runtime instance. If not provided, the default runtime is used.ctx (
ApplyContext|None) – Optional apply context forwarded to the runtime.out_kind (
Optional[Literal['ket','density']]) – Optional requested output state kind.
- Returns:
Output state after applying the phase shifter.
- Return type:
StateProtocol
Notes
This method delegates execution to the device runtime. The actual phase transformation is performed by a representation-specific kernel.
- property kind: DeviceKind¶
Return the device kind identifier.
- plan(*, state: State, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) DeviceAction¶
Plan a phase shift on a selected path.
- Parameters:
state (
State) – Input state. Not inspected by this device.ports (
Mapping[str,Path]) – Mapping from device-port names to path labels. Must contain the key"path".selection (
object|None) – Optional selection object forwarded by the runtime. Not used.ctx (
ApplyContext|None) – Optional apply context forwarded by the runtime. Not used.
- Returns:
Planned action containing:
params["path"]: target path labelparams["phi"]: phase angleedits: always empty
- Return type:
Notes
Planning is purely semantic and does not modify the state or labels. The backend kernel is responsible for applying the phase rotation to all modes associated with the selected path.