symop.polynomial.kernels.devices.beamsplitter¶
Polynomial kernels for beamsplitter-style two-mode devices.
This module implements backend kernels for applying one or more two-mode beamsplitter transformations to polynomial ket and density states.
Each beamsplitter acts on an ordered pair of modes identified by their
mode signatures. The semantic planning stage is expected to provide the
target pairs, output paths, and unitary parameters in action.params.
Notes
The kernel performs the full representation-specific beamsplitter rewrite, including construction of output-path modes. No additional label-edit phase is required for the physical beamsplitter action.
Functions
|
Apply one or more beamsplitters to a polynomial density state. |
|
Apply one or more beamsplitters to a polynomial ket state. |
- class _BeamSplitterKernelParams(pairs: tuple[_BeamSplitterSpec, ...]) None¶
Bases:
objectParsed kernel parameters for one or more beamsplitter applications.
- Parameters:
pairs (tuple[_BeamSplitterSpec, ...])
- pairs¶
Tuple of parsed beamsplitter application specifications.
- pairs: tuple[_BeamSplitterSpec, ...]¶
- class _BeamSplitterSpec(mode0_sig: Any, mode1_sig: Any, theta: float, phi_t: float = 0.0, phi_r: float = 0.0, check_unitary: bool = False, atol: float = 1e-10, in0: Any | None = None, in1: Any | None = None, out0: Any | None = None, out1: Any | None = None) None¶
Bases:
objectParsed specification for one beamsplitter application.
- Parameters:
- mode0_sig¶
Signature of the first input mode, or
Noneif the first input arm is vacuum and must be synthesized.
- mode1_sig¶
Signature of the second input mode, or
Noneif the second input arm is vacuum and must be synthesized.
- theta¶
Mixing angle.
- phi_t¶
Transmission phase.
- phi_r¶
Reflection phase.
- check_unitary¶
Whether to validate the resulting 2x2 unitary.
- atol¶
Tolerance for optional unitary validation.
- in0, in1
Input paths used when a vacuum partner mode must be synthesized.
- out0, out1
Output paths used by the beamsplitter rewrite.
- _make_vacuum_partner_mode(*, existing_mode: ModeOp, input_path: Path) Any¶
Create a matching partner mode on a missing beamsplitter input path.
The new mode matches the existing mode in all semantic degrees of freedom except for the path label, which is replaced by
input_path.- Parameters:
existing_mode (ModeOp)
input_path (Path)
- Return type:
- _parse_beamsplitter_params(action: DeviceAction) _BeamSplitterKernelParams¶
Extract and validate kernel parameters from a device action.
- Parameters:
action (
DeviceAction) – Semantic device action produced during planning.- Returns:
Parsed beamsplitter parameters.
- Return type:
- Raises:
TypeError – If
action.paramsdoes not have the expected mapping shape.
- _parse_single_pair(obj: object) _BeamSplitterSpec¶
Parse one beamsplitter pair specification.
- Parameters:
obj (
object) – Mapping-like specification for one beamsplitter action.- Returns:
Parsed beamsplitter specification.
- Return type:
- Raises:
- _require_output_paths(spec: _BeamSplitterSpec) tuple[Path, Path]¶
Return validated output paths for one beamsplitter specification.
- Parameters:
spec (
_BeamSplitterSpec) – Parsed beamsplitter specification.- Returns:
Pair
(out0, out1)of validated output paths.- Return type:
- Raises:
ValueError – If either output path is missing.
- beamsplitter_poly_density(*, state: DensityPolyState, action: DeviceAction, ctx: ApplyContext) DensityPolyState¶
Apply one or more beamsplitters to a polynomial density state.
- Parameters:
state (
DensityPolyState) – Input polynomial density state.action (
DeviceAction) – Semantic device action containing beamsplitter parameters.ctx (
ApplyContext) – Unused for direct beamsplitter application. Included for API consistency with other kernels.
- Returns:
Output density state after all requested beamsplitter operations.
- Return type:
Notes
This kernel performs the full backend-specific beamsplitter rewrite, including construction of output-path modes.
- beamsplitter_poly_ket(*, state: KetPolyState, action: DeviceAction, ctx: ApplyContext) KetPolyState¶
Apply one or more beamsplitters to a polynomial ket state.
- Parameters:
state (
KetPolyState) – Input polynomial ket state.action (
DeviceAction) – Semantic device action containing beamsplitter parameters.ctx (
ApplyContext) – Unused for direct beamsplitter application. Included for API consistency with other kernels.
- Returns:
Output ket state after all requested beamsplitter operations.
- Return type:
Notes
This kernel performs the full backend-specific beamsplitter rewrite, including construction of output-path modes.