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:
objectBilinear 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.
Danger
Modifies the current instance of
Bilinear.- Returns:
The current Bilinear with flavours exchanged.
- Return type:
- class LinearComb(terms: list[_Commutative], factor: int | Fraction | Complex = 1)¶
Bases:
objectMain 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.
- static ZERO()¶
Should be used to define a literal zero, e.g., when planning to sum up various instances of
LinearComb.- Returns:
Representation of zero in terms of
LinearComb.- Return type:
- __imul__(fac)¶
Implements the in-place multiplication of
LinearCombwith an overall factor or another instance 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.simplifymay be required to combine terms differing at most by their prefactors.- Parameters:
fac (int|Fraction|Complex|LinearComb) – Second factor to multiply with.
- Raises:
NotImplementedError – Indicating that the RHS fac is of an unsupported type.
- __mul__(fac)¶
Implements the multiplication of
LinearCombwith an overall factor or another instance 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.simplifymay 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
LinearCombremains unchanged and independent of the returned value.- Return type:
- __str__()¶
Assigns a unique string to the current instance of
LinearComb.Important
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
Bilinearpresent 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:
objectCyclic 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:
objectCollection 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
Bilinearin current term.Allows the user direct access to all instances of
Bilinearpresent 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
_Commutativeto rewrite it via the product rule as an appropriateLinearComb.Danger
Intended for internal use. Make sure to act with simplify otherwise any non-trivial factors still residing in (covariant) derivatives etc. will get lost.
- 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: