symop.polynomial.channels.primitives.linear_mode_unitary

Linear mode-map rewrites for CCR polynomial representations.

This module defines passive linear transformations on a finite ordered set of modes and provides helpers for applying such transformations to symbolic CCR polynomial objects.

The linear map acts in the Heisenberg picture by rewriting ladder operators according to a unitary mode mixing matrix. The same substitution machinery is then reused to transform ket, density, and operator polynomials.

Notes

The ordered tuple modes defines the basis in which the matrix representation is interpreted. Column k of the matrix gives the image of input mode k expressed in the ordered output basis.

Functions

apply_to_densitypoly(rho, *, lmap)

Apply a passive linear mode map to a density polynomial.

apply_to_ketpoly(poly, *, lmap)

Apply a passive linear mode map to a ket polynomial.

apply_to_oppoly(op, *, lmap)

Apply a passive linear mode map to an operator polynomial.

make_right_substitution(lmap)

Construct the bra-side substitution induced by a linear mode map.

make_substitution(lmap)

Construct the ladder-operator substitution induced by a linear mode map.

Classes

LinearModeMap(modes, U[, check_unitary, atol])

Represent a passive linear transformation on an ordered mode basis.

class LinearModeMap(modes: tuple[ModeOp, ...], U: ndarray, check_unitary: bool = False, atol: float = 1e-10) None

Bases: object

Represent a passive linear transformation on an ordered mode basis.

The ordered tuple modes defines both the input and output basis used to interpret the matrix U. The convention is that column k of U gives the image of input mode k in the ordered output basis.

In the Heisenberg picture, the ladder operators transform as

\[a_k^\dagger \;\mapsto\; \sum_j U_{j k}\, a_j^\dagger,\]

and

\[a_k \;\mapsto\; \sum_j \overline{U_{j k}}\, a_j.\]
Parameters:
  • modes (tuple[ModeOp, ...]) – Ordered mode basis used for the matrix representation.

  • U (ndarray) – Square matrix representing the passive linear transformation in the ordered basis given by modes.

  • check_unitary (bool) – If True, validate that U is unitary within the tolerance specified by atol.

  • atol (float) – Absolute tolerance used for optional unitary validation.

Notes

This class stores only the linear transformation data and does not itself apply the rewrite. Use make_substitution or one of the apply_to_* helpers to act on symbolic polynomial objects.

U: ndarray
atol: float = 1e-10
check_unitary: bool = False
modes: tuple[ModeOp, ...]
_apply_ketpoly_to_vacuum(poly: KetPoly) KetPoly

Project a rewritten ket polynomial onto the vacuum reference sector.

After operator substitution and normal ordering, terms containing annihilation operators acting on the vacuum are discarded. Only creator-only monomials and the identity term are retained.

Parameters:

poly (KetPoly) – Input ket polynomial after symbolic rewriting.

Returns:

Ket polynomial containing only vacuum-compatible terms.

Return type:

KetPoly

apply_to_densitypoly(rho: DensityPoly, *, lmap: LinearModeMap) DensityPoly

Apply a passive linear mode map to a density polynomial.

The density polynomial is rewritten by substituting ladder operators on both the left and right monomials according to the Heisenberg action of lmap.

Parameters:
  • rho (DensityPoly) – Input density polynomial.

  • lmap (LinearModeMap) – Passive linear mode transformation to apply.

Returns:

Rewritten density polynomial after the linear mode transformation.

Return type:

DensityPolyProtocol

Notes

This function applies the same substitution map to both sides of the density polynomial, with annihilation operators transformed using the conjugated matrix elements as required by the Heisenberg convention.

apply_to_ketpoly(poly: KetPoly, *, lmap: LinearModeMap) KetPoly

Apply a passive linear mode map to a ket polynomial.

The transformation is implemented by rewriting all ladder operators in the polynomial according to the Heisenberg action of lmap and then discarding terms incompatible with the vacuum reference state.

Parameters:
  • poly (KetPoly) – Input ket polynomial.

  • lmap (LinearModeMap) – Passive linear mode transformation to apply.

Returns:

Rewritten ket polynomial after vacuum-compatible projection.

Return type:

KetPoly

Notes

The final projection step keeps only creator-only monomials and the identity term, corresponding to the usual vacuum-based ket polynomial semantics.

apply_to_oppoly(op: OpPoly, *, lmap: LinearModeMap) OpPoly

Apply a passive linear mode map to an operator polynomial.

Each ladder operator in the operator polynomial is rewritten according to the Heisenberg action of lmap.

Parameters:
  • op (OpPoly) – Input operator polynomial.

  • lmap (LinearModeMap) – Passive linear mode transformation to apply.

Returns:

Rewritten operator polynomial after the linear mode transformation.

Return type:

OpPolyProtocol

make_right_substitution(lmap: LinearModeMap) Callable[[LadderOp], list[tuple[complex, LadderOp]]]

Construct the bra-side substitution induced by a linear mode map.

This is the substitution used on the right monomial of a density term, corresponding to the adjoint-side action needed for

rho -> U rho U^dagger.

For creation operators, the coefficients are conjugated relative to the ket-side map. For annihilation operators, the unconjugated coefficients are used.

Parameters:

lmap (LinearModeMap)

Return type:

Callable[[LadderOp], list[tuple[complex, LadderOp]]]

make_substitution(lmap: LinearModeMap) Callable[[LadderOp], list[tuple[complex, LadderOp]]]

Construct the ladder-operator substitution induced by a linear mode map.

The returned substitution function rewrites ladder operators according to the Heisenberg action of lmap. If an operator acts on a mode not present in lmap.modes, it is left unchanged.

For creation operators, the substitution is

\[a_k^\dagger \;\mapsto\; \sum_j U_{j k}\, a_j^\dagger.\]

For annihilation operators, the substitution is

\[a_k \;\mapsto\; \sum_j \overline{U_{j k}}\, a_j.\]
Parameters:

lmap (LinearModeMap) – Linear mode transformation specification.

Returns:

Substitution function mapping a ladder operator to a list of (coefficient, operator) pairs.

Return type:

callable

Notes

The substitution acts only on operators whose mode signatures are present in lmap.modes. Other operators pass through unchanged.