Operator algebra

The operator layer represents finite linear combinations of operator words,

\[\mathcal{O} = \sum_i c_i W_i,\]

where each \(W_i\) is an ordered ladder-operator word.

The central object is symop.ccr.op.poly.OpPoly.

Main ideas

Unlike the ket and density layers, operator multiplication here is based on word concatenation. No CCR rewriting is applied automatically during operator polynomial multiplication. If identical words arise, they can be merged by normalization.

Basic constructors

import symop.viz as viz

from symop.core.operators import ModeOp
from symop.ccr.algebra.op.poly import OpPoly
from symop.modes.envelopes import GaussianEnvelope
from symop.modes.labels import ModeLabel, Path, Polarization

env = GaussianEnvelope(omega0=1.0, sigma=1.0, tau=0.0)

mode = ModeOp(
    label=ModeLabel(
        envelope=env,
        path=Path("A"),
        polarization=Polarization.H(),
        ),
    user_label="a",
)
a = OpPoly.a(mode)
adag = OpPoly.adag(mode)
n = OpPoly.n(mode)

viz.display(a)
viz.display(adag)
viz.display(n)
2026-04-24T11:37:03.771258 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/

Quadratures

q = OpPoly.q(mode)
p = OpPoly.p(mode)

viz.display(q)
viz.display(p)
2026-04-24T11:37:03.823644 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/

Actions via @

Operator polynomials can act symbolically on ket and density polynomials.

from symop.ccr.algebra.ket.poly import KetPoly

psi = KetPoly.from_ops(coeff=1.0)
result = a @ psi
viz.display(result)
2026-04-24T11:37:03.870310 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/