24 #ifndef GRAPH_H_INCLUDED 25 #define GRAPH_H_INCLUDED 31 class FeynruleMomentum;
33 class ConjugationList;
53 class Node:
public std::enable_shared_from_this<Node>{
83 static std::vector<std::shared_ptr<Node>> copyGraph(
108 class Vertex:
public std::vector<std::shared_ptr<Node>> {
124 Vertex(
const std::vector<const mty::QuantumField*>& fields,
126 bool t_external=
false);
136 bool isExternal()
const;
148 bool hasFreeNode()
const;
166 bool isDegenerateWith(
const Vertex& other)
const;
195 std::vector<std::shared_ptr<Node>> getContractibleNodes()
const;
197 std::vector<std::shared_ptr<Node>> getContractibleNodes(
204 void setExternal(
bool t_external);
215 int getTotalDegeneracyFactor()
const;
276 IMPLEMENTS_STD_VECTOR(
Vertex, vertices)
297 std::vector<Vertex>
const &getVertices()
const;
302 void addVertex(
const Vertex& newVertex);
312 bool hasValenceLeft()
const;
325 int getFirstContractibleVertex()
const;
341 std::vector<int> getContractibleVertices(
356 std::vector<std::shared_ptr<Node>> getNodes()
const;
365 int connect(
int indexVertex);
374 bool connect(
Vertex& other);
388 std::vector<Vertex> vertices;
400 using Expr_type = std::pair<csl::Expr, ConjugationList>;
412 Graph(
const std::vector<mty::QuantumField>&
field,
413 std::map<csl::Tensor, size_t>& vertexIds,
422 std::map<csl::Tensor, size_t>& vertexIds,
441 Graph& operator=(
const Graph& other) =
default;
483 int getFactor()
const;
485 int getTotalDegeneracyFactor()
const;
487 std::vector<Vertex>
const &getVertices()
const;
489 void addFactor(
int t_factor);
491 void setFactor(
int t_factor);
493 void setSymmetrizeExternalLegs(
bool t_symmetrize);
495 void multiply(
int t_factor);
497 void multiply(
csl::Expr const &t_factor);
503 bool isFullyConnected()
const;
511 bool isPhysical()
const;
513 bool isValid()
const;
515 int getNLoops()
const;
521 int getFieldDimension()
const;
530 std::vector<Expr_type> getExpression()
const;
532 std::vector<Expr_type> getExpression(
536 std::vector<const mty::QuantumField*> getFields()
const;
538 std::vector<const mty::QuantumField*> getConnectedFieldsInVertex(
544 std::vector<std::shared_ptr<Node>>& getNodes();
546 std::vector<std::shared_ptr<Node>>
const& getNodes()
const;
563 std::vector<std::shared_ptr<Graph>> contractionStep()
const;
565 bool compare(
const Graph& other,
566 std::map<csl::Tensor, csl::Tensor>& mapping,
567 bool fieldBlind =
false)
const;
569 bool compare(
const Graph& other,
570 bool fieldBlind =
false)
const;
572 void contractHighMass(
584 friend std::ostream&
operator<<(std::ostream& fout,
588 Vertex const *getVertexOf(
590 std::vector<Vertex>
const &vertices
594 std::vector<std::shared_ptr<Node>> nextNodes(
596 std::vector<Vertex>
const &vertices
600 int countExternalLegs(
601 std::vector<csl::Tensor>::iterator first,
602 std::vector<csl::Tensor>::iterator last,
603 std::vector<Vertex>
const &vertices
608 std::vector<csl::Tensor>::iterator first,
609 std::vector<csl::Tensor>::iterator last,
611 std::vector<Vertex>
const &vertices
625 void isolateIndependantVertices();
627 void removeIntVertex(
int indexVertex);
633 void initConnectedComponent();
635 Expr_type getPartialExpression(
637 const std::vector<mty::QuantumField>& initialOrder,
642 getSymmetry(
const Vertex& vertex,
645 std::vector<std::vector<std::shared_ptr<Node>>> symmetrize()
const;
647 static std::vector<std::shared_ptr<Node>> copyNodes(
650 static void applySymmetry(
659 std::vector<int> getContractibleExtVertices(
667 std::vector<int> getContractibleIntVertices(
675 std::vector<int> getContractibleConnectedVertices(
716 std::vector<csl::Tensor>& foundNodes);
720 static bool compareFieldsDummyPoint(
723 std::map<csl::Tensor, csl::Tensor>& constraints,
724 bool fieldBlind =
false);
726 static bool compareNodesWithConstraints(
729 std::map<csl::Tensor, csl::Tensor>& constraints,
730 bool fieldBlind =
false);
735 std::vector<std::shared_ptr<Node>> sortedNodes;
740 long long int factor = 1;
744 bool symmetrizeExternalLegs =
false;
780 mutable bool fixedExpression =
false;
782 mutable std::vector<Expr_type> expression;
796 static csl::Expr applyWickTheoremOnDiagram(
797 const Graph& diagram,
798 std::vector<mty::FeynruleMomentum>& witnessMapping,
799 bool ruleMode =
true);
801 static csl::vector_expr applyWickTheoremOnDiagrams(
803 std::vector<mty::FeynruleMomentum>& witnessMapping,
804 bool ruleMode =
true);
806 static std::vector<mty::FeynmanDiagram> getDiagrams(
809 std::map<csl::Tensor, size_t>& vertexIds,
810 std::vector<mty::FeynruleMomentum>& witnessMapping,
811 bool symmetriseExternalLegs =
false,
812 bool ruleMode =
true);
814 static std::vector<mty::FeynmanDiagram> getDiagrams(
817 std::map<csl::Tensor, size_t>& vertexIds,
818 bool symmetriseExternalLegs =
false,
819 bool ruleMode =
true);
830 static bool isContractionZero(
831 const std::vector<mty::QuantumField>& fields,
832 size_t maxLoops =
size_t(-1),
833 size_t nVertices =
size_t(-1));
835 static bool isContractionZero(
836 const std::vector<mty::QuantumField const*>& fields,
837 size_t maxLoops =
size_t(-1),
838 size_t nVertices =
size_t(-1));
851 static std::vector<std::vector<mty::QuantumField>> splitFields(
852 const std::vector<mty::QuantumField>&
field);
854 static std::vector<std::vector<mty::QuantumField const*>> splitFields(
855 const std::vector<mty::QuantumField const*>& field);
881 void setSymmetrizeExternalLegs(
bool t_symmetrize);
886 Graph getInitialDiagram()
const;
894 std::vector<std::shared_ptr<Graph>> getDiagrams();
902 void eliminateNonPhysicalDiagrams(
910 void calculateDiagrams();
917 bool diagramsCalculated =
false;
919 bool symmetrizeExternalLegs =
false;
996 const std::vector<csl::Tensor>& foundNodes);
1000 const std::vector<csl::Tensor>& foundNodes);
1020 int countFermions(std::vector<const mty::QuantumField*>::const_iterator begin,
1021 std::vector<const mty::QuantumField*>::const_iterator end);
1033 std::vector<const mty::QuantumField*> B);
1036 std::vector<const mty::QuantumField*> B);
1046 std::vector<mty::FeynruleMomentum>& witnessMapping,
1047 bool ruleMode =
true);
std::vector< Vertex > extVertex
List of external vertices not already contracted.
Definition: graph.h:764
Definition: feynruleMomentum.h:68
std::vector< int > independentVertices
Sets of integers spotting the independant internal vertices in intVertex.
Definition: graph.h:775
const mty::QuantumField * field
mty::QuantumField represented by the node in the graph.
Definition: graph.h:91
Node(const mty::QuantumField *t_field)
Constructor with one parameter. Initializes a NULL partner.
Definition: graph.h:62
int countFermions(std::vector< const mty::QuantumField *>::const_iterator begin, std::vector< const mty::QuantumField *>::const_iterator end)
Counts the number of fermions in a std::vector of mty::QuantumField.
Definition: graph.cpp:1914
std::ostream & operator<<(std::ostream &fout, csl::Type type)
Class handling the full application of Wick theorem. Starts from an initial Graph fully disconnected...
Definition: graph.h:792
Namespace of MARTY.
Definition: 2HDM.h:31
bool external
Tells if the Vertex is external, i.e. composed of field insertions.
Definition: graph.h:264
std::shared_ptr< std::vector< Vertex > > init
Initial order of vertices, in order to keep track of a possible sign of commutation between fields...
Definition: graph.h:752
~Graph()
Destructor.
Definition: graph.h:431
bool isFree() const
Tells if the Node is free or not.
Definition: graph.h:79
std::vector of Vertex that represents the connected component of a Graph. A Graph has typically one C...
Definition: graph.h:274
void contractNodes(const std::shared_ptr< Node > &node1, const std::shared_ptr< Node > &node2)
Contracts two Node together, i.e. sets the partner of each node equal to a std::weak_ptr to the other...
Definition: graph.cpp:1786
csl::vector_expr convertGraphsToCorrelators(const std::vector< std::shared_ptr< Graph >> &diagrams, std::vector< mty::FeynruleMomentum > &witnessMapping, bool ruleMode=true)
Converts a std::vector of fully connected graphs into a std::vector of expressions (one expression pe...
Definition: graph.cpp:1963
Represents a contractible mty::QuantumField in the context of Wick contraction.
Definition: graph.h:53
int getCommutationSign(const std::vector< mty::QuantumField > &A, std::vector< const mty::QuantumField *> B)
Computes and returns the sign cost of the commutation of two sets of mty::QuantumField. , with the number of fermion permutations necessary to Transform A to B.
Definition: graph.cpp:1933
bool areExactlyContractible(const mty::QuantumField &f1, const mty::QuantumField &f2)
Tells if the contraction of two mty::QuantumField is non zero.
Definition: graph.cpp:1804
std::vector< std::shared_ptr< Graph > > feynmanDiagram
All possible diagrams once contractions have been done. Result of the function calculateDiagrams()).
Definition: graph.h:930
Class deriving from csl::TensorFieldElement, may enter expressions. In contrary to QuantumFieldParent...
Definition: quantumField.h:1614
~WickCalculator()
Destructor.
Definition: graph.h:879
Handles wick contractions. A graph contains Vertices, and is able to connect them in all possible way...
Definition: graph.h:396
Represents a Vertex in feynman diagrams, i.e. a set of Nodes at the same space-time point...
Definition: graph.h:108
File containing the ConjugationInfo class. Used for Majorana amplitudes.
bool operator==(const Expr &a, const Expr &b)
Graph initialDiagram
Initial diagram for contractions.
Definition: graph.h:924
std::weak_ptr< Node > partner
std::weak_ptr to the Node with which it is contracted, if it is. Else the value is empty...
Definition: graph.h:97
Contains all objects in the theory. In particular QuantumField objects, Gauge, Flavor, Particle...
Definition: model.h:68
bool areDegenerate(const mty::QuantumField &f1, const mty::QuantumField &f2)
Tells if two mty::QuantumField are degenerate, i.e. have the same value in the contraction sens...
Definition: graph.cpp:1793
Base class for parents of QuantumField objects.
Definition: quantumField.h:152
ConnectedComponent connectedCompo
Connected component of the Graph (contains all its vertices).
Definition: graph.h:759
std::vector< Vertex > intVertex
List of internal vertices not already contracted.
Definition: graph.h:769
bool operator!=(const Expr &a, const Expr &b)
Contains QuantumField and QuantumFieldParent, basic objects handling quantum fields as csl expression...
std::vector< mty::QuantumField > convertExprToFields(const csl::Expr &expr)
Converts a csl csl::Expr that is just a product of field into a std::vector of mty::QuantumField obje...
Definition: graph.cpp:1867
Definition: feynmanDiagram.h:31