Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
mty::wick::Graph Class Reference

Handles wick contractions. A graph contains Vertices, and is able to connect them in all possible ways returning the set of all possible Graph. More...

#include <graph.h>

Public Types

using Expr_type = std::pair< csl::Expr, ConjugationList >
 

Public Member Functions

 Graph ()
 Default constructor. Empty Graph.
 
 Graph (const std::vector< mty::QuantumField > &field, std::map< csl::Tensor, size_t > &vertexIds, bool ruleMode)
 Constructor with one parameter. More...
 
 Graph (const csl::Expr &expr, std::map< csl::Tensor, size_t > &vertexIds, bool ruleMode)
 Constructor with one parameter. More...
 
 Graph (Graph const &other, std::vector< std::shared_ptr< Node >> const &init)
 
 ~Graph ()
 Destructor.
 
 Graph (const Graph &other)=default
 Copy constructor = C++ default.
 
Graphoperator= (const Graph &other)=default
 Overload of operator= : C++ default.
 
Graph copy () const
 
int getFactor () const
 
int getTotalDegeneracyFactor () const
 
std::vector< Vertex > const & getVertices () const
 
void addFactor (int t_factor)
 
void setFactor (int t_factor)
 
void setSymmetrizeExternalLegs (bool t_symmetrize)
 
void multiply (int t_factor)
 
void multiply (csl::Expr const &t_factor)
 
bool isFullyConnected () const
 
bool isPhysical () const
 A Graph is considered physical if it is not (yet) fully connected or if it is composed of one unique connected component. More...
 
bool isValid () const
 
int getNLoops () const
 
int getFieldDimension () const
 
std::vector< Expr_type > getExpression () const
 For a fully connected Graph, return the associated csl csl::Expr, applying combinatorial factors and propagators of the contracted pairs of fields (see mty::QuantumField::getPropagator()). More...
 
std::vector< Expr_type > getExpression (mty::FeynruleMomentum &witness) const
 
std::vector< const mty::QuantumField * > getFields () const
 
std::vector< const mty::QuantumField * > getConnectedFieldsInVertex (const mty::QuantumField *init) const
 
const mty::QuantumFieldgetConnectedField (const mty::QuantumField *init) const
 
std::vector< std::shared_ptr< Node > > & getNodes ()
 
std::vector< std::shared_ptr< Node > > const & getNodes () const
 
bool empty () const
 
std::vector< std::shared_ptr< Graph > > contractionStep () const
 Performs one contraction step (the Graph must not be fully connected) and returns all possible new Graphs. More...
 
bool compare (const Graph &other, std::map< csl::Tensor, csl::Tensor > &mapping, bool fieldBlind=false) const
 
bool compare (const Graph &other, bool fieldBlind=false) const
 
void contractHighMass (mty::QuantumFieldParent const *field)
 
bool operator== (const Graph &other) const
 

Static Public Member Functions

static Vertex const * getVertexOf (std::shared_ptr< Node > const &node, std::vector< Vertex > const &vertices)
 
static std::vector< std::shared_ptr< Node > > nextNodes (std::shared_ptr< Node > const &node, std::vector< Vertex > const &vertices)
 
static int countExternalLegs (std::vector< csl::Tensor >::iterator first, std::vector< csl::Tensor >::iterator last, std::vector< Vertex > const &vertices)
 
static int walk (std::vector< csl::Tensor >::iterator first, std::vector< csl::Tensor >::iterator last, std::shared_ptr< Node > const &node, std::vector< Vertex > const &vertices)
 

Private Member Functions

void isolateIndependantVertices ()
 Isolates at the Graph's creation independant Internal vertices. More...
 
void removeIntVertex (int indexVertex)
 
void initConnectedComponent ()
 Puts the first external vertex in the connected component and removes it from the set of external vertices for further contractions.
 
Expr_type getPartialExpression (std::vector< std::shared_ptr< Node >> &nodes, const std::vector< mty::QuantumField > &initialOrder, mty::FeynruleMomentum &witnessMapping, csl::Expr const &globalFactor) const
 
csl::ObjectSymmetry< const mty::QuantumField * > getSymmetry (const Vertex &vertex, const mty::QuantumField *field) const
 
std::vector< std::vector< std::shared_ptr< Node > > > symmetrize () const
 
std::vector< int > getContractibleExtVertices (const mty::QuantumField *field) const
 
std::vector< int > getContractibleIntVertices (const mty::QuantumField *field) const
 
std::vector< int > getContractibleConnectedVertices (const mty::QuantumField *field) const
 
bool contractExternal (const mty::QuantumField *field, int indexVertex)
 Tries to contract the mty::QuantumField field between the ConnectedComponent and the external vertex at position indexVertex. More...
 
bool contractInternal (const mty::QuantumField *field, int indexVertex)
 Tries to contract the mty::QuantumField field between the ConnectedComponent and the internal vertex at position indexVertex. More...
 
bool contractConnected (const mty::QuantumField *field, int indexVertex)
 Tries to contract the mty::QuantumField field between the ConnectedComponent and the vertex at position indexVertex in connectedCompo. More...
 

Static Private Member Functions

static std::vector< std::shared_ptr< Node > > copyNodes (const std::vector< std::shared_ptr< Node >> &toCopy)
 
static void applySymmetry (std::vector< std::shared_ptr< Node >> &nodes, const csl::ObjectPermutation< const mty::QuantumField *> &permutation)
 
static void addFoundNode (const std::shared_ptr< Node > &newNode, std::vector< csl::Tensor > &foundNodes)
 
static void sortNodes (std::vector< std::shared_ptr< Node >> &nodes)
 
static bool compareFieldsDummyPoint (const mty::QuantumField *fieldA, const mty::QuantumField *fieldB, std::map< csl::Tensor, csl::Tensor > &constraints, bool fieldBlind=false)
 
static bool compareNodesWithConstraints (const std::shared_ptr< Node > &nodeA, const std::shared_ptr< Node > &nodeB, std::map< csl::Tensor, csl::Tensor > &constraints, bool fieldBlind=false)
 

Private Attributes

std::vector< std::shared_ptr< Node > > sortedNodes
 
long long int factor = 1
 Combinatorial factor of the Graph in its current state of contraction.
 
csl::Expr exprFactor = CSL_1
 
bool symmetrizeExternalLegs = false
 
bool ruleMode
 
std::shared_ptr< std::vector< Vertex > > init
 Initial order of vertices, in order to keep track of a possible sign of commutation between fields.
 
std::shared_ptr< std::vector< mty::QuantumField > > initialOrder
 
ConnectedComponent connectedCompo
 Connected component of the Graph (contains all its vertices).
 
std::vector< VertexextVertex
 List of external vertices not already contracted.
 
std::vector< VertexintVertex
 List of internal vertices not already contracted.
 
std::vector< int > independentVertices
 Sets of integers spotting the independant internal vertices in intVertex.
 
csl::ObjectSymmetry< const mty::QuantumField * > symmetry = Id_Sym(const mty::QuantumField*)
 
bool fixedExpression = false
 
std::vector< Expr_type > expression
 

Friends

std::ostream & operator<< (std::ostream &fout, const Graph &g)
 Overload of operator<< for Graph. More...
 

Detailed Description

Handles wick contractions. A graph contains Vertices, and is able to connect them in all possible ways returning the set of all possible Graph.

Constructor & Destructor Documentation

◆ Graph() [1/2]

mty::wick::Graph::Graph ( const std::vector< mty::QuantumField > &  field,
std::map< csl::Tensor, size_t > &  vertexIds,
bool  ruleMode 
)
explicit

Constructor with one parameter.

Parameters
fieldstd::vector of mty::QuantumField on which apply contractions.

◆ Graph() [2/2]

mty::wick::Graph::Graph ( const csl::Expr expr,
std::map< csl::Tensor, size_t > &  vertexIds,
bool  ruleMode 
)
explicit

Constructor with one parameter.

Parameters
exprcsl csl::Expr converted into fields (convertExprToFields()).

Member Function Documentation

◆ contractConnected()

bool mty::wick::Graph::contractConnected ( const mty::QuantumField field,
int  indexVertex 
)
private

Tries to contract the mty::QuantumField field between the ConnectedComponent and the vertex at position indexVertex in connectedCompo.

Parameters
fieldmty::QuantumField being contracted.
indexVertexPosition of the second Vertex being contracted in connectedCompo.
Returns
True if the contraction is done.
False if it was not possible.

◆ contractExternal()

bool mty::wick::Graph::contractExternal ( const mty::QuantumField field,
int  indexVertex 
)
private

Tries to contract the mty::QuantumField field between the ConnectedComponent and the external vertex at position indexVertex.

Parameters
fieldmty::QuantumField being contracted.
indexVertexPosition of the external Vertex to contract with connectedCompo.
Returns
True if the contraction is done.
False if it was not possible.

◆ contractInternal()

bool mty::wick::Graph::contractInternal ( const mty::QuantumField field,
int  indexVertex 
)
private

Tries to contract the mty::QuantumField field between the ConnectedComponent and the internal vertex at position indexVertex.

Parameters
fieldmty::QuantumField being contracted.
indexVertexPosition of the internal Vertex to contract with connectedCompo.
Returns
True if the contraction is done.
False if it was not possible.

◆ contractionStep()

std::vector< std::shared_ptr< Graph > > mty::wick::Graph::contractionStep ( ) const

Performs one contraction step (the Graph must not be fully connected) and returns all possible new Graphs.

A contraction step consists in contracting the first contractible Node of the ConnectedComponent with every possible partner. Each partner gives a new Graph, and all these possible graphs are returned in a std::vector.

Returns
All possible graphs after one contraction step in a std::vector.

◆ empty()

bool mty::wick::Graph::empty ( ) const
Returns
True if the Graph is empty.
False else.

◆ getContractibleConnectedVertices()

vector< int > mty::wick::Graph::getContractibleConnectedVertices ( const mty::QuantumField field) const
private
Parameters
fieldmty::QuantumField to contract.
Returns
A std::vector of integers corresponding to the positions of vertices contractible with field in connectedCompo.

◆ getContractibleExtVertices()

vector< int > mty::wick::Graph::getContractibleExtVertices ( const mty::QuantumField field) const
private
Parameters
fieldmty::QuantumField to contract.
Returns
A std::vector of integers corresponding to the positions of external vertices contractible with field.

◆ getContractibleIntVertices()

vector< int > mty::wick::Graph::getContractibleIntVertices ( const mty::QuantumField field) const
private
Parameters
fieldmty::QuantumField to contract.
Returns
A std::vector of integers corresponding to the positions of internal vertices contractible with field.

◆ getExpression()

std::vector< Graph::Expr_type > mty::wick::Graph::getExpression ( ) const

For a fully connected Graph, return the associated csl csl::Expr, applying combinatorial factors and propagators of the contracted pairs of fields (see mty::QuantumField::getPropagator()).

Returns
The symbolic expression where contractions are replaced by propagators.

◆ getFactor()

int mty::wick::Graph::getFactor ( ) const
Returns
factor, the combiinatorial factor of the graph.

◆ getFieldDimension()

int mty::wick::Graph::getFieldDimension ( ) const
Returns
The total number of fields in the Graph (counting powers of fields).

◆ isFullyConnected()

bool mty::wick::Graph::isFullyConnected ( ) const
Returns
True if the Graph is fully connected (no free Node left).
False else.

◆ isolateIndependantVertices()

void mty::wick::Graph::isolateIndependantVertices ( )
private

Isolates at the Graph's creation independant Internal vertices.

It is important to avoid unnecessary calculations and keep the good combinatorial factors to recognize identical internal vertices. For example two vertices \( \phi(X)^3\quad \phi(Y)^3 \) are degenerate (see Vertex::isDegenerateWith()). Contractions will be performed considering the two vertices discernable (eg treating X before Y) and a factor 2 will be added in front the Graph's expression.

◆ isPhysical()

bool mty::wick::Graph::isPhysical ( ) const

A Graph is considered physical if it is not (yet) fully connected or if it is composed of one unique connected component.

Returns
True if the Graph is physical.
False else.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  fout,
const Graph g 
)
friend

Overload of operator<< for Graph.

Parameters
foutOutput stream.
gGraph to display.
Returns
The output flux.

The documentation for this class was generated from the following files: