Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
Data Structures | Enumerations | Functions
mty::simpli Namespace Reference

Namespace containing the main simplification method for MARTY and all its dependencies. More...

Data Structures

struct  FermionEOMData
 Helper structure for the application of Dirac equation (equations of motions for spin 1/2) More...
 

Enumerations

enum  Mode {
  FeynmanRule,
  Amplitude,
  SquaredAmplitude,
  WilsonCoefficient
}
 Mode for the main simplification routine specifying what calculation is done to adapt the simplification procedure.
 

Functions

void simplify (csl::Expr &expr, std::vector< mty::QuantumField > const &insertions, std::vector< csl::Tensor > const &momenta, mty::FeynOptions const &options, Mode mode)
 Main simplification routine of MARTY, used for amplitudes, squared amplitude and Wilson coefficients. More...
 
color::ColorSpace const * inColorSpace (csl::Index const &index)
 Returns the colorspace associated to an index (nullptr if the index does not live in any ColorSpace). More...
 
color::ColorSpace const * isColorStructure (csl::IndexStructure const &structure)
 Returns the adjoint colorspace for a generator, nullptr for another structure.o. More...
 
color::ColorSpace const * isColorStructure (csl::Expr const &expr)
 Returns a colorspace if the expression is a color structure. More...
 
csl::IndexStructure colorStructure (csl::Expr const &node, color::ColorSpace const *color)
 Returns all color indices found in an expression lying in a particular color space. More...
 
bool factorIndicial (csl::Expr &res)
 Factors indicial expressions in a bigger expression. More...
 
csl::Expr colorAbbreviation (std::vector< csl::Expr > const &exprs, std::vector< color::ColorSpace const *> const &spaces)
 Abbreviates color structure in expressions under the generic name "Color". More...
 
bool expandInProd (csl::Expr &prod, std::function< csl::IndexStructure(csl::Expr const &)> const &structureGetter)
 Expands indicial expressions in a way avoiding unnecessary terms, in particular not expanding expressions that have no common index. More...
 
bool expandColorIndices (csl::Expr &res)
 Expands expressions containing color indices to allow all algebra simplifications. More...
 
bool simplifyColorWeights (csl::Expr &expr)
 Calculates color traces in an expression. More...
 
bool findColorAbbreviation (csl::Expr &expr)
 Abbreviates color structures in an expression under the generic name "Color". More...
 
bool expandMinkoStructures (csl::Expr &expr)
 Expands Minkowski structures to contract all possible indices. More...
 
bool expandMinkoMetric (csl::Expr &expr)
 Expands Minkowski metrics to contract all possible indices. More...
 
bool expandMinkoEpsilon (csl::Expr &expr)
 Expands Minkowski epsilon symbols to contract all possible indices. More...
 
bool simplifyEpsilonInProd (csl::Expr &prod, csl::IndexStructure &indices)
 Simplifies the contraction of an epsilon tensor with a symmetric structure index. More...
 
bool simplifyEpsilon (csl::Expr &expr)
 Simplifies epsilon contractions with symmetric indices in an expression. More...
 
bool expandGammaMatrices (csl::Expr &expr)
 Expands gamma matrices in an expression to be able to simplify fermion chains (and traces). More...
 
bool simplifyFermionChains (csl::Expr &expr)
 Simplifies fermion chains using the mty::FermionChain utility. More...
 
void expandForFermionOrdering (csl::Expr &expr)
 Forces the ordering of external fermions by making sure that all Dirac structures are expanded. More...
 
void expandMomentaExperimental (csl::Expr &res, std::vector< csl::Tensor > const &momenta)
 Expands expressions containing momenta to contract all indices, typically replacing \( p_i^\mu\cdot p_{j\mu} \mapsto s_{ij} \). More...
 
void reduceTensorIntegrals (csl::Expr &expr)
 Replaces the one-loop momentum integrals by their reduced form depending on scalar integrals. More...
 
std::pair< csl::Expr, csl::ExprgetMomentumReplacement (std::vector< mty::QuantumField > const &insertions, std::vector< csl::Tensor > const &momenta, size_t posReplaced)
 Creates the relevant replacement (using momentum conservation) to replace one particular momentum. More...
 
void replaceMomentum (csl::Expr &init, std::vector< mty::QuantumField > const &insertions, std::vector< csl::Tensor > const &momenta, size_t posReplaced)
 Applies the momentum conservation by replacing one of the external momenta by the combination of the others. More...
 
void simplifyImpulsions (csl::Expr &init, std::vector< mty::QuantumField > const &insertions, std::vector< csl::Tensor > const &momenta)
 Applies the momentum conservation by replacing one of the external momenta by the combination of the others. More...
 
void applyEOM (csl::Expr &ampl, std::vector< FermionEOMData > &onShellFermions)
 Applies the equations of motions in an expression. More...
 
void applyEOM (csl::Expr &ampl, std::vector< mty::QuantumField > const &insertions, std::vector< csl::Tensor > const &momenta)
 Applies the equations of motion in an expression. More...
 
void addLocalTerms (csl::Expr &res)
 Adds the local terms in an expression. More...
 
bool maybeSimplified (csl::Expr const &expr)
 Helper function that tells if an expression may be simplified in amplitudes. More...
 
void findExternalAbbreviation (csl::Expr &expr)
 Abbreviates external legs in the expression using the generic name "EXT". More...
 
void abbreviateIntegral (csl::Expr &res)
 Abbreviate scalar integrals (or combinations of them) into abbreviations with the generic name "INT". More...
 
void abbreviateAll (csl::Expr &res)
 Abbreviates all the sub-expressions that are relevant. More...
 
bool findAbbreviations (csl::Expr &res)
 Abbreviates all the sub-expressions that are relevant considering constant factors only. More...
 
void applyDerivativesInStructure (csl::Expr &expr)
 Searches in the expression derived fields and applies the derivatives in the fields themselves. More...
 
void suppressDiracDelta (csl::Expr &expr, csl::Expr const &PSum)
 Removes a dirac delta sub-expression. More...
 
bool mayBeSimplified (csl::Expr const &expr)
 
static bool isMomentum (csl::Expr &tensor)
 
bool commonIndex (std::vector< size_t > const &A, std::vector< size_t > const &B)
 
void mergeIn (std::vector< size_t > &target, std::vector< size_t > const &toCopy)
 
std::vector< std::vector< size_t > > findStructureMatches (std::vector< csl::IndexStructure > const &structures)
 
static bool hasCommonIndex (csl::Expr const &A, csl::Expr const &B, csl::Space const *space=nullptr)
 
static bool compareFields (QuantumField const &A, QuantumField const &B)
 
static int getDMinkoPower (csl::Expr const &expr)
 

Detailed Description

Namespace containing the main simplification method for MARTY and all its dependencies.

Function Documentation

◆ abbreviateAll()

void mty::simpli::abbreviateAll ( csl::Expr res)

Abbreviates all the sub-expressions that are relevant.

This function is more powerful than findAbbreviations() as it will also find external abbreviations ("EXT") and momentum abbreviations ("P")

Parameters
resExpression to abbreviate.

◆ abbreviateIntegral()

void mty::simpli::abbreviateIntegral ( csl::Expr res)

Abbreviate scalar integrals (or combinations of them) into abbreviations with the generic name "INT".

Parameters
resExpression to abbreviate.

◆ addLocalTerms()

void mty::simpli::addLocalTerms ( csl::Expr res)

Adds the local terms in an expression.

This function is defined in dimensionalRegularization.cpp but the declaration is reminded. Local terms are added when, in dim. reg., the Minkowki space dimension \( D = 4 - 2\epsilon \) is multiplied by a divergent integral \( I = \frac{a}{\epsilon} + b + \mathcal{O}(\epsilon)\), as the epsilon terms cancel each other to produce another constant term. In this simple case we obtain (removing the purely divergent term):

\[ D\cdot I = (4 - 2\epsilon)(\frac{a}{\epsilon} + b) = 4b + Local, \]

with

\[ Local = -2a. \]

Warning
This uses a simple algorithm to parse the total \( D \) factors mutiplying integrals but works only for non-factored expressions. This is fine as long as, in the main simplification chain, the amplitude is factored after this function is called.
Parameters
resExpression in which local terms are added.

◆ applyDerivativesInStructure()

void mty::simpli::applyDerivativesInStructure ( csl::Expr expr)

Searches in the expression derived fields and applies the derivatives in the fields themselves.

QuantumField objects may carry an additional derivative indicial structure, that is used here to get simple quantum field objects (no derivative) while keeping the information about the Minkowski derivatives to use in the quantum calculation. This is equivalent to the analytical replacement / definition:

\[ \partial _\mu \Phi _A(X) \equiv \Phi_{A;\mu}(X) \]

Parameters
exprExpression in which the the function is applied.

◆ applyEOM() [1/2]

void mty::simpli::applyEOM ( csl::Expr ampl,
std::vector< FermionEOMData > &  onShellFermions 
)

Applies the equations of motions in an expression.

This function uses the SGL (Symbolic Gamma-matrices Library), a module of MARTY specialized in this purpose, to apply the EOM in fermion currents.

Parameters
amplExpression in which the EOM must be applied.
onShellFermionsOn-shell fermions.

◆ applyEOM() [2/2]

void mty::simpli::applyEOM ( csl::Expr ampl,
std::vector< mty::QuantumField > const &  insertions,
std::vector< csl::Tensor > const &  momenta 
)

Applies the equations of motion in an expression.

This function detects all the on-shell fermions for the process and call the other overload of applyEOM() to effectively apply the Dirac equation.

Parameters
amplExpression in which the EOM must be applied.
insertionsField insertions for the process.
momentaExternal momenta corresponding to the field insertions.

◆ colorAbbreviation()

csl::Expr mty::simpli::colorAbbreviation ( std::vector< csl::Expr > const &  exprs,
std::vector< color::ColorSpace const *> const &  spaces 
)

Abbreviates color structure in expressions under the generic name "Color".

For all different terms this function tries to simplify first the expression before abbreviating it. If after simplification there is still color indices the result is encapsulated into an abbreviation, otherwise it is left as is.

Parameters
exprsDifferent expressions containing color structures.
spacesColor spaces corresponding to the different expressions ( must be the same size as exprs). )
Returns
The product of all abbreviated expressions in exprs.

◆ colorStructure()

csl::IndexStructure mty::simpli::colorStructure ( csl::Expr const &  node,
color::ColorSpace const *  color 
)

Returns all color indices found in an expression lying in a particular color space.

Parameters
nodeExpression to explore.
colorColor space for which this function searches indices.
Returns
The IndexStructure containing all found indices.

◆ expandColorIndices()

bool mty::simpli::expandColorIndices ( csl::Expr res)

Expands expressions containing color indices to allow all algebra simplifications.

Parameters
resExpression in which color indexed structures must be expanded.
Returns
True if something has been expanded.
False else.

◆ expandForFermionOrdering()

void mty::simpli::expandForFermionOrdering ( csl::Expr expr)

Forces the ordering of external fermions by making sure that all Dirac structures are expanded.

Parameters
exprExpression to expand.

◆ expandGammaMatrices()

bool mty::simpli::expandGammaMatrices ( csl::Expr expr)

Expands gamma matrices in an expression to be able to simplify fermion chains (and traces).

Parameters
exprExpression to simplify.
Returns
True if a simplification has been found.
False else.

◆ expandInProd()

bool mty::simpli::expandInProd ( csl::Expr prod,
std::function< csl::IndexStructure(csl::Expr const &)> const &  structureGetter 
)

Expands indicial expressions in a way avoiding unnecessary terms, in particular not expanding expressions that have no common index.

This function takes as parameter another function that must return, for any expression, the index structure relevant for expansion (e.g. returning only Minkowski indices if the purpose is to expand Minkowski metric terms). The expansion will be performed between two sub-expressions if they have at least one common index by this mean.

Note
Dev note : This function could now probably be replaced by the much more powerful and general csl::DeepPartialExpand() that can be tuned as will. This function is now used only in expandColorIndices().
Parameters
prodProd in which the expansion must take place.
structureGetterFunction that must return the index structure of an expression relevant for the expansion.
Returns
True if something has been expanded
False else.

◆ expandMinkoEpsilon()

bool mty::simpli::expandMinkoEpsilon ( csl::Expr expr)

Expands Minkowski epsilon symbols to contract all possible indices.

This function only expand sub-terms that allow to contract one epsilon with another tensor that has a common index. All other terms are let in sums, not expanded.

Note
Dev note : This is using the emitter / receiver pattern of csl::DeepPartialExpand(): to use without moderation !
Parameters
exprExpression in which Minkowski epsilon terms must be expanded.
Returns
True if something has been expanded.
False else.

◆ expandMinkoMetric()

bool mty::simpli::expandMinkoMetric ( csl::Expr expr)

Expands Minkowski metrics to contract all possible indices.

This function only expand sub-terms that allow to contract one metric with another tensor that has a common index. All other terms are let in sums, not expanded.

Note
Dev note : This is using the emitter / receiver pattern of csl::DeepPartialExpand(): to use without moderation !
Parameters
exprExpression in which Minkowski metric terms must be expanded.
Returns
True if something has been expanded.
False else.

◆ expandMinkoStructures()

bool mty::simpli::expandMinkoStructures ( csl::Expr expr)

Expands Minkowski structures to contract all possible indices.

This function calls expandMinkoMetric() and expandMinkoEpsilon() successively.

Parameters
exprExpression in which Minkowski structures must be expanded.
Returns
True if something has been expanded.
False else.

◆ expandMomentaExperimental()

void mty::simpli::expandMomentaExperimental ( csl::Expr res,
std::vector< csl::Tensor > const &  momenta 
)

Expands expressions containing momenta to contract all indices, typically replacing \( p_i^\mu\cdot p_{j\mu} \mapsto s_{ij} \).

Parameters
resExpression to expand.
momentaSet of momenta involved.

◆ factorIndicial()

bool mty::simpli::factorIndicial ( csl::Expr res)

Factors indicial expressions in a bigger expression.

This function is there mostly to compensate the lack of such a general function in CSL, that factors indicial tensors. This function is yet not very general and can probably not be used reliably to this purpose in other contexts.

Parameters
resExpression to factor
Returns
True if something has been changed (factored).
False else.

◆ findAbbreviations()

bool mty::simpli::findAbbreviations ( csl::Expr res)

Abbreviates all the sub-expressions that are relevant considering constant factors only.

This function is simply searches for combination of factors than can be grouped into a unique abbreviation "Ab".

Parameters
resExpression to abbreviate.

◆ findColorAbbreviation()

bool mty::simpli::findColorAbbreviation ( csl::Expr expr)

Abbreviates color structures in an expression under the generic name "Color".

This function gathers all colorstructures of possibly different vector spaces and then calls colorAbbreviation() to effectively determine an abbreviation for each different space.

Parameters
exprExpression to abbreviate.
Returns
True if the expression has been abbreviated in some way.
False else.

◆ findExternalAbbreviation()

void mty::simpli::findExternalAbbreviation ( csl::Expr expr)

Abbreviates external legs in the expression using the generic name "EXT".

Note
Dev Note : This function works only for external fields of type PolarizationField. Could probably be extended very easily to QuantumField objects using the following condition
dynamic_cast<mty::QuantumField const*>(sub[i].get())
Parameters
exprExpression ni which the abbreviation will be applied.

◆ getMomentumReplacement()

std::pair< csl::Expr, csl::Expr > mty::simpli::getMomentumReplacement ( std::vector< mty::QuantumField > const &  insertions,
std::vector< csl::Tensor > const &  momenta,
size_t  posReplaced 
)

Creates the relevant replacement (using momentum conservation) to replace one particular momentum.

The two elements returned in a pair can be used directly in a csl replacement function on a particular expression as presented in the following sample code

auto [p, momentumEquivalent] = getMomentumReplacement(args...);
csl::Replace(amplitude, p, momentumEquivalent);
Parameters
insertionsInsertions for the process.
momentaSet of external momenta of the process.
posReplacedPosition of the momentum (in momenta) that must be replaced by the relevant combination of the others.
Returns
A pair containing the momentum replacement to forward to csl::Replace().

◆ inColorSpace()

color::ColorSpace const * mty::simpli::inColorSpace ( csl::Index const &  index)

Returns the colorspace associated to an index (nullptr if the index does not live in any ColorSpace).

Parameters
indexIndex form which the space is obtained.
Returns
The pointer to const ColorSpace if the index lives in such a vector space.
nullptr else

◆ isColorStructure() [1/2]

color::ColorSpace const * mty::simpli::isColorStructure ( csl::IndexStructure const &  structure)

Returns the adjoint colorspace for a generator, nullptr for another structure.o.

All indices of the structure must lie in a color space otherwise it is not a generator and this function returns nullptr. This allows to select only the objects that may want to simplify with each other !

Parameters
structureThe index structure of the tensor to test.
Returns
The adjoint colorspace if the indexstructure is the one of a group generator.
nullptr else.
See also
inColorSpace()

◆ isColorStructure() [2/2]

color::ColorSpace const * mty::simpli::isColorStructure ( csl::Expr const &  expr)

Returns a colorspace if the expression is a color structure.

This function should not be used for mixed color / non color expressions. In a mixed case, the behaviour is not defined. Otherwise, a colorspace will be returned independently of the complexity of the expression (if it is a color structure).

Parameters
tensorExpression to test.
Returns
The color space associated to the expression if there is one
nullptr else.

◆ maybeSimplified()

bool mty::simpli::maybeSimplified ( csl::Expr const &  expr)

Helper function that tells if an expression may be simplified in amplitudes.

If this function returns false, the main simplification routines can remove the expression from the amplitude to pass all simplification steps and put it back at the end to save unnecessary calculations.

Parameters
exprExpression to check if it may be simplified.
Returns
True if the expression must not be discarded.
False else.

◆ reduceTensorIntegrals()

void mty::simpli::reduceTensorIntegrals ( csl::Expr expr)

Replaces the one-loop momentum integrals by their reduced form depending on scalar integrals.

The scalar integrals are later evaluated numerically using the LoopTools library.

Parameters
exprExpression to simplify.

◆ replaceMomentum()

void mty::simpli::replaceMomentum ( csl::Expr init,
std::vector< mty::QuantumField > const &  insertions,
std::vector< csl::Tensor > const &  momenta,
size_t  posReplaced 
)

Applies the momentum conservation by replacing one of the external momenta by the combination of the others.

Parameters
initExpression in which the momentum conservation is applied.
insertionsInsertions for the process.
momentaSet of external momenta of the process.
posReplacedPosition of the momentum (in momenta) that must be replaced by the relevant combination of the others.
See also
getMomentumReplacement()

◆ simplify()

void mty::simpli::simplify ( csl::Expr expr,
std::vector< mty::QuantumField > const &  insertions,
std::vector< csl::Tensor > const &  momenta,
mty::FeynOptions const &  options,
Mode  mode 
)

Main simplification routine of MARTY, used for amplitudes, squared amplitude and Wilson coefficients.

This function for now is used for all calculations in MARTY with minor differences (handled through the mode given as a parameter). It calls directly or indirectly all the other functions in this file to simplify Dirac algebra, Group algebra, Equations of motions, momentum integrals, introducing abbreviations etc.

Parameters
exprExpression to simplify.
insertionsInsertions of the process.
momentaExternal momenta corresponding to the field insertions.
modeSimplification mode specifying if the expression is an amplitude, squared amplitude or Wilson coefficient.

◆ simplifyColorWeights()

bool mty::simpli::simplifyColorWeights ( csl::Expr expr)

Calculates color traces in an expression.

Parameters
exprExpression to simplify.
Returns
True if a simplification has taken place.
Fasle else.

◆ simplifyEpsilon()

bool mty::simpli::simplifyEpsilon ( csl::Expr expr)

Simplifies epsilon contractions with symmetric indices in an expression.

This function detects all epsilon tensors in a product and calls simplifyEpsilonInProd() to simplify it if it is contracted with symmetric indices.

Parameters
exprExpression to simplify.
Returns
True if a simplification has been found.
False else.

◆ simplifyEpsilonInProd()

bool mty::simpli::simplifyEpsilonInProd ( csl::Expr prod,
csl::IndexStructure indices 
)

Simplifies the contraction of an epsilon tensor with a symmetric structure index.

This function is fully general and tries to swap indices that are contracted with the epsilon tensor to detect a symmetry. If a symmetry is detected, then the result is zero.

Parameters
prodProduct to simplify ni which the epsilon tensor has been removed.
indicesIndices of the initial epsilon tensor.
Returns
True if a simplification has been found (the result is zero).
False else.

◆ simplifyFermionChains()

bool mty::simpli::simplifyFermionChains ( csl::Expr expr)

Simplifies fermion chains using the mty::FermionChain utility.

Parameters
exprExpression to simplify.
Returns
True if a simplification has been found.
False else.

◆ simplifyImpulsions()

void mty::simpli::simplifyImpulsions ( csl::Expr init,
std::vector< mty::QuantumField > const &  insertions,
std::vector< csl::Tensor > const &  momenta 
)

Applies the momentum conservation by replacing one of the external momenta by the combination of the others.

The momentum that is to be replaced is chosen automatically by this function following an ordering rule for the external fields. To maximize the possible simplifications, the momentum that are kept are those of on-shell fermions (because they can later be simplified later on through the Dirac equation). This function calls replaceMomentum().

Parameters
initExpression in which the momentum conservation is applied.
insertionsInsertions for the process.
momentaSet of external momenta of the process.

◆ suppressDiracDelta()

void mty::simpli::suppressDiracDelta ( csl::Expr expr,
csl::Expr const &  PSum 
)

Removes a dirac delta sub-expression.

This function is used at the end of a quantum calculation to remove the \( \delta ^{(4)}(\sum _i p_i) \) (with \( p_i \) external momenta) that appears naturally but does not enter the final amplitude result. The momentum sum in the dirac delta to remove must be provided.

Parameters
exprExpression in which
PSumMomentum sum appearing in the dirac delta to remove.