ops¶
This submodule contains the top-level Python representations for a LinearComb
of terms that form an operator compatible with the desired transformation
behaviour.
- class Bilinear(blocks: list[Block], covl: list[Dl | D0l], covr: list[D | D0], flavours: tuple[str, str], derivatives: list[d] | None = None, factor: int | Fraction | Complex = 1)¶
Bases:
object
Bilinear of two flavours with an intermediate piece consisting of covariant derivatives (and fermion EOMs) acting to the left and right as well as any other implementation of Block in the middle.
CAVEAT: Intended for internal use and checks against __class__.
- Parameters:
blocks (list[Block]) – Collection of Blocks not acting directly on the two flavours.
covl (list[Dl|D0l]) – Covariant derivatives (and fermion EOMs) acting to the left.
covr (list[D|D0]) – Covariant derivatives (and fermion EOMs) acting to the right.
flavours (tuple[str,str]) – Flavour content of the Bilinear.
derivatives (list[d]|None, optional) – List of total derivatives acting on the Bilinear, defaults to None.
factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.
- charge()¶
- chiralSpurion()¶
- simplify()¶
Track down overall factors from the different blocks and absorb them into an overall prefactor. Ensure unique ordering among different instances of Block and combine Multiplicative ones.
- swapFlavours()¶
Exchange left and right flavour of Bilinear.
Should be used to implement non-trivial flavour dependence for Bilinear under charge conjugation, e.g.,
u.Gamma[gx].s -> - s.Gamma[gx].u => J[u,s] -> - J[s,u]
under charge. Enforcing such a transformation requires additional work since it is NOT a symmetry of the current. This becomes important for higher dimensional variants, e.g.,
(m[u]-m[s])/2 d.u.s := d.u.dM.s -> - d.s.dM.u =: -(m[s]-m[u])/2 d.s.u
Using here the conventional symmetrisiation will then ensure that dM survives iff u <-> s are swapped after the charge conjugation.
- Returns:
A copy of the current Bilinear with flavours exchanged.
- Return type:
- class LinearComb(terms: list[_Commutative], factor: int | Fraction | Complex = 1)¶
Bases:
object
Main object dealing with linear combinations of monomials of the fields, masses, Gamma structures, (covariant) derivatives etc. It allows proper book-keeping and tracking of identical terms up to prefactors to turn them into the appropriate simplified linear combination.
CAVEAT: Intended for internal use and type hints.
- Parameters:
terms (list[_Commutative]) – Collection of terms in the linear combination.
factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.
- __mul__(fac)¶
Implements the multiplication of
LinearComb
with an overall factor or another isntance ofLinearComb
. In the latter case all combinatorics are taken care of and overall derivatives present in any of the terms are written explicitly via the product rule. A call toLinearComb.simplify
may be required to combine terms differing at most by their prefactors.- Parameters:
fac (int|Fraction|Complex|LinearComb) – Second factor to multiply with.
- Returns:
Result of the multiplication. The initial
LinearComb
remains unchanged and independent of the returned value.- Return type:
- __str__()¶
Assigns a unique string to the current instance of LinearComb.
CAVEAT: Make sure to always go through LinearComb.__str__ and not the sub-elements!
- Returns:
Unique string representation.
- Return type:
- property bilinears¶
Iterator over all Bilinear in current expression.
Allows the user direct access to all instances of
Bilinear
present in the current instance of LinearComb, i.e., agnostic to which term each Bilinear belongs to.
- charge()¶
- chiralSpurion()¶
- simplify()¶
Combine identical terms differing at most in their prefactors. And impose a unique ordering.
- class Trace(cyclic: list[Block], derivatives: list[d] | None = None, factor: int | Fraction | Complex = 1)¶
Bases:
object
Cyclic permuting grouping of instances of Block.
Contains a collection of instances of _AlgebraBlock (or when used internally also _dA) or (custom) non-algebra Block. Non commutativity is assumed but cyclic permutations are taken into account during simplify to give the Trace a unique string representation.
CAVEAT: Intended for internal use and checks against __class__.
- Parameters:
- charge()¶
- chiralSpurion()¶
- simplify()¶
- class _Commutative(prod: list[Bilinear | Trace], derivatives: list[d] | None = None, factor: int | Fraction | Complex = 1)¶
Bases:
object
Collection of Trace and Bilinear that commute among one another.
Allows to have various traces and bilinears simultaneously and deals with the commutativity of those pieces. Enforces a unique ordering among those pieces.
CAVEAT: Intended for internal use and type hints.
- Parameters:
- property bilinears¶
Iterator over all
Bilinear
in current term.Allows the user direct access to all instances of
Bilinear
present in the current instance of _Commutative, i.e., within the current term.
- charge()¶
- chiralSpurion()¶
- simplify()¶
Sort commuting Bilinears and Trace by their unique sring representation and absorb overall factors.
- _productRule(op: LinearComb) bool ¶
Searches for an overall derivative in
_Commutative
to rewrite it via the product rule as an appropriateLinearComb
.- Parameters:
op (LinearComb) – Expression (potentially) containing overall derivatives in some terms. Will be modified!
- Returns:
Indicates whether an overall deriative was encountered and replaced.
- Return type: