blocks

This submodule provides the basic implementaion of Block and its subclasses. Insertions of (subclasses of) Block are used to implement covariant derivatives, field-strength tensors, etc. including their default transformation properties.

Custom implementations of Block then allow for extensions to models with non-trivial transformation properties, e.g., due to more complicated flavour symmetries.

class Block(factor: int | Fraction | Complex = 1)

Bases: object

Super class to derive from. Already implements default behaviour if sensible. Implements the transformations acting as the identity. => To be overwritten by appropriate non-trivial cases.

If the instance of a Block carries indices (or a more general suffix), those details must be specified via a decorator @indices or @defaultIndices, where the latter makes some implicit assumptions on how to read off the conventions used for the indices. This will set the class-attributes __indexType__, __indexName__ and __suffix__ to some non-trivial values. For more details how to declare indices, see indices. CAVEAT: Do not modify those attributes directly!

The name of the arguments passed to @indices has to match exactly the names of the class members used internally, i.e.,

testIdx = CustomIndex("testIdx", ["a", "b"])
@indices("(%s;%s)", mu = sptIdx, nu = testIdx)
class MyBlock(Block):
   def __init__(self,x:sptIdx,y:testIdx,factor:int|Fraction|Complex=1):
      self.mu = x
      self.nu = y

The unique types used in the keyword arguments matching the actual type of the index are mandatory as they are used to decide how the data is to be processed when parsing custom Block implementations from file. Currently there are two cases

match = "123"
if issubclass(f, CustomIndex):
   print(getattr(f,match))
else:
   print(f(int(match)))

CAVEAT: Deviating from this pattern will break the package!

Parameters:

factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

__indexName__

Refers to the name for each of the indices used in the implementation of Block. CAVEAT: Do not modify!

Type:

tuple[str]

__indexType__

Refers to the type of each of the indices used in the implementation of Block. Must be chosen accordingly to properly stringify and parse this Block. CAVEAT: Do not modify!

Type:

tuple[type]

__suffix__

String representation of all the indices. Expected to contain as many %s as there are indices present in the implementation of Block. This will be used for both calls to __str__ as well as parsing Block from string via regular expressions. CAVEAT: Do not modify!

Type:

str

__neg__()

Changes the sign of the overall factor.

Returns:

A copy of Block with negative overall factor.

Return type:

Block

__str__()

Returns identifiable string representation of Block including the appropriate index structure for non-trivial indices.

Returns:

String representation of implementation of Block.

Return type:

str

Raises:

AssertionError – If overall prefactor is non-trivial, i.e., call to Block.simplify in parent has been forgotten.

classmethod _toRegex()

Turns the specific Block implementation cls into a regex string to be used when parsing string representations of a LinearComb. The class name as well as any index or generalisation thereof are (expected to be) put into a regex group.

Returns:

Regular expression matching the particular implementation of Block starting with the class name followed by an implementation-specific suffix. Typically some indices.

Return type:

str

classmethod _types()

Determines the types for the indices relevant for the (custom) Block implementation from the function-signature of Block.__init__. Type hints involving the exact types of the indices are mandatory!

Returns:

Type for each of the indices.

Return type:

list[type]

charge()

Implements conventional charge conjugation.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

chiralSpurion()

Implements conventional spurionic chiral transformation.

Returns:

Anything other than masses or Dirac gamma matrices transforms trivially under chiral spurion.

Return type:

int

reflection(mu: int)

Implements conventional Euclidean reflection in direction mu.

Parameters:

mu (int) – Spacetime direction.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

rotation(plane: int)

Implements conventional 90 degree rotations in the chosen plane as defined in rotPlanes.

Parameters:

plane (int) – Identifier of the current rotational plane [0,len(rotPlanes)[.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

simplify()

Is expected to take care of any relations among different index permutations. => Has to be adapted for non-trivial cases!

classmethod variants()

Yields a generator over all declared (generalised) indices thus amounting to all the allowed index combinations.

=> May be adapted for non-trivial cases!

Returns:

Iterator over all possible variants of the particular implementation of Block.

Return type:

Iterator[Block]

class Colour(factor: int | Fraction | Complex = 1)

Bases: Block

Right now used as dummy to avoid explicit index contraction of Nc^2-1 elements. -> Could be implemented for Nc=2 w/o loss of generality?

Parameters:

factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

class D(mu: sptIdx, factor: int | Fraction | Complex = 1)

Bases: d

charge()

Implements conventional charge conjugation.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

class D0(factor: int | Fraction | Complex = 1)

Bases: Block

Used to mask fermion EOM acting to the right when creating all variants.

Parameters:

factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

charge()

Implements conventional charge conjugation.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

chiralSpurion()

Implements conventional spurionic chiral transformation.

Returns:

Anything other than masses or Dirac gamma matrices transforms trivially under chiral spurion.

Return type:

int

class D0l(factor: int | Fraction | Complex = 1)

Bases: Block

Used to mask fermion EOM acting to the left when creating all variants.

Parameters:

factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

charge()

Implements conventional charge conjugation.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

chiralSpurion()

Implements conventional spurionic chiral transformation.

Returns:

Anything other than masses or Dirac gamma matrices transforms trivially under chiral spurion.

Return type:

int

class DF(mu: sptIdx, factor: int | Fraction | Complex = 1)

Bases: d

Used to mask gluon EOM acting to the right when creating all variants.

Parameters:
  • mu (sptIdx) – Spacetime index [0,dim[.

  • factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

charge()

Implements conventional charge conjugation.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

class Dl(mu: sptIdx, factor: int | Fraction | Complex = 1)

Bases: d

charge()

Implements conventional charge conjugation.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

class F(mu: sptIdx, nu: sptIdx, factor: int | Fraction | Complex = 1)

Bases: Block

Represents the field strength tensor

F(mu,nu) = [D(mu),D(nu)]

with all the expected transformation properties. Current convention is to keep mu<nu and otherwise introduce an overall minus sign.

Parameters:
  • mu (sptIdx) – Spacetime index [0,dim[.

  • nu (sptIdx) – Spacetime index [0,dim[.

  • factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

charge()

Implements conventional charge conjugation.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

reflection(mu: int)

Implements conventional Euclidean reflection in direction mu.

Parameters:

mu (int) – Spacetime direction.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

rotation(plane: int)

Implements conventional 90 degree rotations in the chosen plane as defined in rotPlanes.

Parameters:

plane (int) – Identifier of the current rotational plane [0,len(rotPlanes)[.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

simplify()

Is expected to take care of any relations among different index permutations. => Has to be adapted for non-trivial cases!

classmethod variants()

Returns all variants of F[mu,nu] with mu<nu.

Returns:

Iterator of all variants of F[mu,nu] with mu<nu.

Return type:

Iterator[F]

class M(factor: int | Fraction | Complex = 1)

Bases: Block

Represents the quark mass matrix when inserted into a singlet or a Trace. Otherwise it is the average sum of quark masses of the bilinear (which is equivalent to the quark mass matrix for the singlet).

Parameters:

factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

chiralSpurion()

Masses transform non-trivially under chiral spurion transformation. You could phrase it as if they anticommute with g5.

Returns:

Chiral spurion transformation behaviour, here -1.

Return type:

int

class Multiplicative(factor: int | Fraction | Complex = 1)

Bases: ABC, Block

Abstract class to hint at implementation of __mul__ during call to simplify.

Parameters:

factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

abstractmethod __mul__(factor)

Multiplication with instance of same type , i.e.,

self.__class__ is factor.__class__ == True

must be implemented for any subclass of Multiplicative.

Parameters:

factor (Multiplicative) – 2nd factor of same type.

Returns:

Product of this instance and factor.

Return type:

Multiplicative

class _AlgebraBlock(blocks: list[Block], factor: int | Fraction | Complex = 1)

Bases: Block

Container for covariant derivatives acting on an algebra-valued object like F[mu,nu], Colour, DF[mu] etc.

CAVEAT: For internal use only!

Parameters:
  • blocks (list[Block]) – Ordered collection of covariant derivatives acting on the last element that is algebra valued.

  • factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

__str__()

Overwritten default behaviour of str(self) to handle with collections of Block.

Returns:

String representation of all instances of Block contained within the _AlgebraBlock.

Return type:

str

charge()

Implements conventional charge conjugation.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

reflection(mu: int)

Implements conventional Euclidean reflection in direction mu.

Parameters:

mu (int) – Spacetime direction.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

rotation(plane: int)

Implements conventional 90 degree rotations in the chosen plane as defined in rotPlanes.

Parameters:

plane (int) – Identifier of the current rotational plane [0,len(rotPlanes)[.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

simplify()

Is expected to take care of any relations among different index permutations. => Has to be adapted for non-trivial cases!

class _DFl(mu: sptIdx, factor: int | Fraction | Complex = 1)

Bases: d

Used to mask gluon EOM acting to the right when creating all variants.

CAVEAT: For internal use only!

Parameters:
  • mu (sptIdx) – Spacetime index [0,dim[.

  • factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

charge()

Implements conventional charge conjugation.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

class d(mu: sptIdx, factor: int | Fraction | Complex = 1)

Bases: Block

Represents a total derivative. Due to its transformation properties (vector-like) it is also used as a parent class of covariant derivatives and the gluonic EOM.

Parameters:
  • mu (sptIdx) – Spacetime index [0,dim[.

  • factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

reflection(mu: int)

Implements conventional Euclidean reflection in direction mu.

Parameters:

mu (int) – Spacetime direction.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

rotation(plane: int)

Implements conventional 90 degree rotations in the chosen plane as defined in rotPlanes.

Parameters:

plane (int) – Identifier of the current rotational plane [0,len(rotPlanes)[.

Returns:

A copy of itself transformed accordingly.

Return type:

Block

class dM(factor: int | Fraction | Complex = 1)

Bases: M

Represents half the difference of quark masses of the left and right flavour in a Bilinear,

q.dM.Q = (m(q)-m(Q))/2 q.Q

i.e., dM vanishes when inserted into a singlet. In combination with M this allows to work out mass-differences arising from D0l, D0 acting in both directions within a LinearComb.

Parameters:

factor (int|Fraction|Complex, optional) – Overall factor, defaults to 1.

charge()

The mass-difference changes sign under charge conjugations as the flavours in a Bilinear get exchanged.

Returns:

A copy of this instance with opposite sign of the overal factor.

Return type:

dM