symop.ccr.common¶
Common CCR utilities.
Shared helpers, signatures, and key definitions used across CCR-related modules.
- sig_density(t: DensityTerm, *, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) tuple[object, ...]¶
Return an exact or approximate signature for a density term.
- Parameters:
t (
DensityTerm) – A density-term-like object that provides the attributesignatureand the methodapprox_signature(decimals=..., ignore_global_phase=...).approx (
bool) – IfTrue, returnt.approx_signature(...). IfFalse, returnt.signature.decimals (
int) – Number of decimals to round to (forwarded toapprox_signature).ignore_global_phase (
bool) – IfTrue, treat global phase parameters as zero for grouping (forwarded toapprox_signature).
- Returns:
A hashable signature tuple suitable for use as a dictionary key.
- Return type:
SignatureProto
- sig_ket(t: KetTerm, *, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) tuple[object, ...]¶
Return an exact or approximate signature for a ket term.
- Parameters:
t (
KetTerm) – A ket-term-like object that provides the attributesignatureand the methodapprox_signature(decimals=..., ignore_global_phase=...).approx (
bool) – IfTrue, returnt.approx_signature(...). IfFalse, returnt.signature.decimals (
int) – Number of decimals to round to (forwarded toapprox_signature).ignore_global_phase (
bool) – IfTrue, treat global phase parameters as zero for grouping (forwarded toapprox_signature).
- Returns:
A hashable signature tuple suitable for use as a dictionary key.
- Return type:
SignatureProto
- sig_lop(op: HasSignature, *, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) tuple[object, ...]¶
Return an exact or approximate key for a ladder operator.
- Parameters:
op (
HasSignature) – A ladder-operator-like object withsignatureandapprox_signature(decimals=..., ignore_global_phase=...).approx (
bool) – IfTrue, returnop.approx_signature(...). IfFalse, returnop.signature.decimals (
int) – Number of decimals to round to (forwarded toapprox_signature).ignore_global_phase (
bool) – IfTrue, treat global phase parameters as zero for grouping (forwarded toapprox_signature).
- Returns:
Hashable ladder-operator key.
- Return type:
SignatureProto
Notes
This function exists mostly for readability. It is equivalent to
sig_obj()but communicates intent at call sites.
- sig_mono(m: Monomial, *, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) tuple[object, ...]¶
Return an exact or approximate signature for a monomial.
- Parameters:
m (
Monomial) – A monomial-like object that provides the attributesignatureand the methodapprox_signature(decimals=..., ignore_global_phase=...).approx (
bool) – IfTrue, returnm.approx_signature(...). IfFalse, returnm.signature.decimals (
int) – Number of decimals to round to (forwarded toapprox_signature).ignore_global_phase (
bool) – IfTrue, treat global phase parameters as zero for grouping (forwarded toapprox_signature).
- Returns:
A hashable signature tuple suitable for use as a dictionary key.
- Return type:
SignatureProto
- sig_obj(obj: HasSignature, *, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) tuple[object, ...]¶
Return an exact or approximate key for a signature-bearing object.
- Parameters:
obj (
HasSignature) – Any object that providessignatureandapprox_signature(decimals=..., ignore_global_phase=...).approx (
bool) – IfTrue, returnobj.approx_signature(...). IfFalse, returnobj.signature.decimals (
int) – Number of decimals to round to (forwarded toapprox_signature).ignore_global_phase (
bool) – IfTrue, treat global phase parameters as zero for grouping (forwarded toapprox_signature).
- Returns:
A hashable signature tuple suitable for use as a dictionary key.
- Return type:
SignatureProto
- sig_word(ops: Iterable[HasSignature], *, approx: bool = False, decimals: int = 12, ignore_global_phase: bool = False) tuple[tuple[object, ...], ...]¶
Return a key for an operator word (ordered product of ladder operators).
- Parameters:
ops (
Iterable[HasSignature]) – Iterable of ladder operators defining a word. The iterable is materialized into a tuple to make the key stable and hashable.approx (
bool) – IfTrue, each operator key is taken fromapprox_signature(...). IfFalse, each operator key is taken fromsignature.decimals (
int) – Number of decimals to round to (forwarded to eachapprox_signature).ignore_global_phase (
bool) – IfTrue, treat global phase parameters as zero for grouping (forwarded to eachapprox_signature).
- Returns:
Hashable key representing the ordered operator word.
- Return type:
tuple[SignatureProto, …]
Modules
Key helpers for CCR algebra canonicalization. |
|
Signature helpers for CCR algebra canonicalization. |