symop.ccr.algebra.ket.from_ops¶
Construct ket terms directly from creators and annihilators.
This module provides a small constructor that builds a normally ordered monomial from explicitly provided creation and annihilation operators and wraps it into a single ket term.
Mathematically, the constructor represents
where the monomial is assumed to already be in normal order (all creators to
the left of all annihilators). No commutation or contraction is performed
here; for symbolic normal ordering of arbitrary words, use
symop.ccr.ket.from_word.ket_from_word().
The output is passed through symop.ccr.ket.combine.combine_like_terms_ket()
so callers get a canonical, de-duplicated tuple of terms (even though this
constructor usually produces a single term).
Functions
|
Construct a (normally ordered) ket term from creators and annihilators. |
- ket_from_ops(*, creators: Iterable[LadderOp] = (), annihilators: Iterable[LadderOp] = (), coeff: complex = 1.0, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) tuple[KetTerm, ...]¶
Construct a (normally ordered) ket term from creators and annihilators.
This helper builds a single monomial from the provided operator lists:
\[M = \hat a_{i_1}^\dagger \cdots \hat a_{i_m}^\dagger \hat a_{j_1} \cdots \hat a_{j_n},\]and returns the corresponding ket term \(c\,M\) as a tuple.
No commutation is performed. The function assumes that the operator sequence provided is already in normal order (creators first, then annihilators). For rewriting arbitrary words into normal order, use
symop.ccr.ket.from_word.ket_from_word().- Parameters:
creators (
Iterable[LadderOp]) – Iterable of creation operators (each must satisfyop.is_creation). The iterable is materialized and the order is preserved.annihilators (
Iterable[LadderOp]) – Iterable of annihilation operators (each must satisfyop.is_annihilation). The iterable is materialized and the order is preserved.coeff (
complex) – Scalar coefficient multiplying the resulting monomial.approx (
bool) – Forwarded tocombine_like_terms_ket(). IfTrue, like terms are merged using approximate signatures.decimals (
int) – Forwarded to approximate signature selection whenapprox=True.ignore_global_phase (
bool) – Forwarded to approximate signature selection whenapprox=True.
- Returns:
Canonicalized tuple of ket terms (typically of length 1).
- Return type:
- Raises:
ValueError – If any operator in
creatorsis not a creation operator, or any operator inannihilatorsis not an annihilation operator.