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: dict

Represents 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:
  • rep (str) – The actual string-representation of the template.

  • md (int|Fraction) – Mass-dimension of the template.

  • tder (bool) – Indicates whether the overall template is a total derivative.

  • kwargs (dict[str,int]) – Other details of the template like the number of different EOM insertions.

_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 Block in cblocks that have the appropriate mass-dimension.

Parameters:
  • cblocks (list[type]) – Collection of custom implementations of Block (and masses) that to be used.

  • mdTarget (int|Fraction) – Desired mass-dimension.

Returns:

Iterator over all the allowed combinations.

Return type:

Iterator[list[type]]

_prepareAlgebraBlockTemplates(nb: int, mdTarget: int | Fraction)

Distributes covariant derivatives among all the nb blocks remaining.

Parameters:
  • nb (int) – Number of blocks (remaining).

  • mdTarget (int|Fraction) – Non-negative integer specifying the desired mass-dimension of all the covariant derivatives to be distributed.

Returns:

Collection of all possible ways to distribute covariant derivatives among the nb blocks.

Return type:

Iterator[list[int]]

_prepareCustomMassTemplates(cblocks: list[type], mdTarget: int | Fraction)

Builds a trace by combining different (custom) implementations of M that amount to the desired mass-dimension.

Parameters:
  • cblocks (list[type]) – All the (custom) implementations of M that are to be used.

  • mdTarget (int|Fraction) – Desired mass-dimension.

Returns:

Number each specific (custom) M is supposed to be used.

Return type:

Iterator[list[int]]

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 Trace is already taken into account to reduce the overall number of templates.

Parameters:

mdTarget (int|Fraction) – Non-negative integer specifying the desired mass dimension.

Returns:

All the templates for algebra traces relevant at this mass-dimension.

Return type:

list[str]

getBilinearTemplates(flavours: tuple[str, str], cblocks: list[type], mdTarget: int | Fraction) list[TemplateRep]

Produce all templates of bilinears that have mass-dimension mdTarget.

Parameters:
  • flavours (tuple[str,str]) – Flavour content of the bilinear.

  • cblocks (list[type]) – Implementations of Block to be used that are not derivatives, insertions of EOMs or field-strength tensors nor abstract variants like _AlgebraBlock.

  • mdTarget (int|Fraction) – Mass-dimension of the bilinear.

Returns:

Collection of all the templates with the desired mass-dimension.

Return type:

list[TemplateRep]

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 of M with @massDim(n) at n>0, all templates for single traces with appropriate mass-dimension mdTarget are being derived.

Parameters:
  • cblocks (list[type]) – Mass-like implementations of Block.

  • mdTarget (int|Fraction) – The desired mass-dimension.

Returns:

All templates matching the requested mass-dimension.

Return type:

list[TemplateRep]

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 to None if 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:

list[TemplateRep]

Raises:
  • AssertionError – If mdTarget is negative.

  • ValueError – If mdTarget is too large and would allow for 6-quark operators.