symop.devices.dispatch¶
Kernel dispatch for device actions.
Provides utilities to resolve and execute representation-specific device kernels based on the current state, device kind, and desired input/output state kinds.
The dispatch mechanism uses a kernel registry to select the appropriate implementation and applies it to the input state using the semantic action produced during device planning.
Functions
|
Resolve and execute the representation-specific kernel for a device action. |
|
Resolve and execute a detection kernel. |
|
Resolve and execute the representation-specific measurement kernel. |
|
Resolve and execute an observation kernel. |
|
Resolve and execute a postselection kernel. |
- dispatch_apply(*, registry: KernelRegistry, device: Device, state: State, action: DeviceAction, ctx: ApplyContext, out_kind: Literal['ket', 'density'] | None = None) State¶
Resolve and execute the representation-specific kernel for a device action.
- Parameters:
registry (
KernelRegistry) – Kernel registry used to resolve the representation-specific executor.device (
Device) – Semantic device that produced the action.state (
State) – Input state.action (
DeviceAction) – Semantic action produced by device planning.ctx (
ApplyContext) – Shared apply context used during planning and execution.out_kind (
Optional[Literal['ket','density']]) – Desired output state kind. If omitted, the input state kind is used.
- Returns:
Result of applying the resolved kernel to the input state.
- Return type:
StateProtocol
- dispatch_detect(*, registry: MeasurementKernelRegistry, device: MeasurementDevice, state: State, action: DetectAction, ctx: ApplyContext) DetectionResult¶
Resolve and execute a detection kernel.
- Parameters:
registry (MeasurementKernelRegistry)
device (MeasurementDevice)
state (State)
action (DetectAction)
ctx (ApplyContext)
- Return type:
DetectionResult
- dispatch_measurement(*, registry: MeasurementKernelRegistry, device: MeasurementDevice, state: State, action: MeasurementAction, ctx: ApplyContext) MeasurementResult¶
Resolve and execute the representation-specific measurement kernel.
- Parameters:
registry (
MeasurementKernelRegistry) – Measurement kernel registry used to resolve the representation-specific executor.device (
MeasurementDevice) – Semantic measurement device that produced the action.state (
State) – Input state.action (
MeasurementAction) – Semantic measurement action produced by device planning.ctx (
ApplyContext) – Shared context used during planning and execution.
- Returns:
Result of applying the resolved measurement kernel to the input state.
- Return type:
MeasurementResultProtocol
- dispatch_observe(*, registry: MeasurementKernelRegistry, device: MeasurementDevice, state: State, action: ObserveAction, ctx: ApplyContext) ObservationResult¶
Resolve and execute an observation kernel.
- Parameters:
registry (MeasurementKernelRegistry)
device (MeasurementDevice)
state (State)
action (ObserveAction)
ctx (ApplyContext)
- Return type:
ObservationResult
- dispatch_postselect(*, registry: MeasurementKernelRegistry, device: MeasurementDevice, state: State, action: PostselectAction, ctx: ApplyContext) PostselectionResult¶
Resolve and execute a postselection kernel.
- Parameters:
registry (MeasurementKernelRegistry)
device (MeasurementDevice)
state (State)
action (PostselectAction)
ctx (ApplyContext)
- Return type:
PostselectionResult