templates¶
This submodule implements so called templates that are being used to find all variants of possible operators to a given canonical mass-dimension, while keeping any indices - spacetime or otherwise - as wildcards. The presence of wildcards then allows to classify different kinds of operators like total derivatives, Algebra-valued traces etc. in a relatively compact form. The meta-information of how many traces are present, whether the class of operators contains insertions of EOMs and so on can then be used to order the templates according to the user’s problem or even veto particular classes of operators. Any symmetry argument can (and must) be postponed to the point where the wildcards are replaced with all the variants possible.
Caution
Discarding any templates may likely invalidate the completeness of the basis derived in the end. However, shuffling the templates to ones liking is safe.
Tip
In case the user has very specific needs (or already knows exactly what
operator classes to expect) the templates can also be provided manually
to opBasis.parseAnsatz or opBasis.overcompleteBasis.
- class TemplateRep(rep: str, md: int | Fraction, tder: bool, **kwargs: dict[str, int])¶
Bases:
dictRepresents building blocks used to create the overall templates potentially consisting of bilinears, algebra traces, and other traces. Allows to track details like the presence of EOM insertions, custom blocks, etc.
- Parameters:
- _buildCombinations(active: list[TemplateRep], excl: list[TemplateRep], mdTarget: int | Fraction, minExcl: int)¶
Finds all combinations of templates for traces, bilinears, and derivatives thereof, that have the desired mass-dimension mdTarget.
- Parameters:
active (list[TemplateRep]) – Collection of templates to be used exclusively until
minExcl==0.excl (list[TemplateRep]) – Collection of templates to be included once
minExcl==0.mdTarget (int|Fraction) – The desired mass-dimension of the full template.
minExcl (int) – The minimal number of bilinears or algebra traces. Needed to avoid redundancy between total derivatives and derivatives acting only on sub-parts of the template.
- Returns:
All possible templates with mass-dimension mdTarget.
- Return type:
Iterator[TemplateRep]
- _getCustomBlockTemplates(cblocks: list[type], mdTarget: int | Fraction)¶
Generator returning all possible combinations of variants of
Blockin cblocks that have the appropriate mass-dimension.
- _prepareAlgebraBlockTemplates(nb: int, mdTarget: int | Fraction)¶
Distributes covariant derivatives among all the nb blocks remaining.
- Parameters:
- Returns:
Collection of all possible ways to distribute covariant derivatives among the nb blocks.
- Return type:
- _prepareCustomMassTemplates(cblocks: list[type], mdTarget: int | Fraction)¶
Builds a trace by combining different (custom) implementations of
Mthat amount to the desired mass-dimension.
- getAlgebraTraceTemplates(mdTarget: int | Fraction) list[TemplateRep]¶
Returns all templates for algebra traces of mass-dimension mdTarget (except for the identity). Those can be obtained from their lower dimensional variants simply by adding an appropriate number of derivatives. Cyclicity of the
Traceis already taken into account to reduce the overall number of templates.
- getBilinearTemplates(flavours: tuple[str, str], cblocks: list[type], mdTarget: int | Fraction) list[TemplateRep]¶
Produce all templates of bilinears that have mass-dimension mdTarget.
- Parameters:
- Returns:
Collection of all the templates with the desired mass-dimension.
- Return type:
- Raises:
AssertionError – If cblocks contains unexpected types.
- getCustomMassTemplates(cblocks: list[type], mdTarget: int | Fraction)¶
Given a collection of “mass-like” implementations of
Block, i.e., subclasses ofMwith@massDim(n)atn>0, all templates for single traces with appropriate mass-dimension mdTarget are being derived.
- getTemplates(mdTarget: int | Fraction, flavours: list[tuple[str, str]] = None, cblocks: list[type] = None, algTrace: bool = True, customFilter: Callable[[TemplateRep], bool] = None)¶
Produces all templates with a given mass-dimension mdTarget including products of traces, bilinears etc.
- Parameters:
mdTarget (int|Fraction) – Desired mass-dimension.
flavours (list[tuple[str,str]], optional) – Collection of flavours to be used in templates for a
Bilinear. Defaults toNoneif omitted, implying to not create such templates.cblocks (list[type], optional) – Collection of (custom) blocks to be used as masses, Dirac gamma matrices etc. Defaults to
None.algTrace (bool, optional) – Indicates whether templates involving algebra traces are allowed. Defaults to
True.customFilter (Callable[[TemplateRep],bool]) –
Additional filter to drop any undesired templates, e.g., keep only even powers of the twisted-mass parameter in templates for
Trace.Caution
Discarding any templates in general invalidates the completeness of the basis derived in the end.
- Returns:
Collection of all the allowed templates.
- Return type:
- Raises:
AssertionError – If mdTarget is negative.
ValueError – If mdTarget is too large and would allow for 6-quark operators.