symop.ccr.algebra.op.poly¶
Operator polynomials.
This module defines OpPoly, a finite linear combination of operator
words (OpTerm).
where each \(W_k\) is an ordered product of ladder operators.
Classes
|
Finite linear combination of |
- class OpPoly(terms: tuple[OpTerm, ...] = ()) None¶
Bases:
objectFinite linear combination of
OpTermobjects.Notes
Multiplication does not automatically merge like terms; call
combine_like_terms()to normalize.- static a(mode: ModeOp) OpPoly¶
Return the annihilation operator for
mode.- Parameters:
mode (ModeOp)
- Return type:
- static adag(mode: ModeOp) OpPoly¶
Return the creation operator for
mode.- Parameters:
mode (ModeOp)
- Return type:
- combine_like_terms(*, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) OpPoly¶
Combine operator terms with identical signatures.
Terms are bucketed either by their exact signatures or, when
approx=True, by approximate signatures obtained viaOpTermProto.approx_signature().When approximate matching is enabled, the parameters
decimalsandignore_global_phaseare forwarded to the underlying signature computation of the ladder operators.- Parameters:
approx (
bool) – IfTrue, use approximate signatures for bucketing. Otherwise, exact signatures are used.decimals (
int) – Number of decimal places used when rounding floating-point quantities in approximate signatures.ignore_global_phase (
bool) – IfTrue, component signatures may ignore global phase factors when constructing approximate signatures.
- Returns:
A new polynomial with coefficients of identical words summed and zero-sum buckets removed.
- Return type:
Notes
This operation performs purely signature-based merging. It does not reorder words or apply commutation relations.
See also
- static from_words(words: Iterable[Iterable[LadderOp]], coeffs: Iterable[complex] | None = None) OpPoly¶
Construct an operator polynomial from words and coefficients.
- static n(mode: ModeOp) OpPoly¶
Return the number operator \(a^\dagger a\) for
mode.- Parameters:
mode (ModeOp)
- Return type:
- normalize(*, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) OpPoly¶
Return a normalized operator polynomial.
This is a convenience alias for
combine_like_terms(). It produces a polynomial in which identical operator words have been merged and zero-coefficient terms removed.- Parameters:
- Returns:
Normalized operator polynomial.
- Return type:
- static p(mode: ModeOp) OpPoly¶
Return the quadrature \(p = (i a^\dagger - i a)/\sqrt{2}\).
- Parameters:
mode (ModeOp)
- Return type:
- static q(mode: ModeOp) OpPoly¶
Return the quadrature \(q = (a + a^\dagger)/\sqrt{2}\).
- Parameters:
mode (ModeOp)
- Return type: