Skip to content

Commit edae8dc

Browse files
committed
Fixing sign conventions and translations between Packages
1 parent 8941c60 commit edae8dc

File tree

14 files changed

+21282
-25869
lines changed

14 files changed

+21282
-25869
lines changed

examples/FlowingReparametrisation.nb

Lines changed: 9276 additions & 14025 deletions
Large diffs are not rendered by default.

examples/Yang-Mills.nb

Lines changed: 11716 additions & 11670 deletions
Large diffs are not rendered by default.

modules/AnSEL/Simplify.m

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -560,22 +560,14 @@
560560
$ProfileTermsEqualSuccess++;
561561
Return @ FTerm[2, t1]
562562
];
563-
If[Length[t1] >= 2 && Length[t2] >= 2,
564-
If[t1[[2 ;; ]] === t2[[2 ;; ]] && FreeQ[{t1[[1]]}, Alternatives @@ $indexedObjects, Infinity],
565-
$ProfileTermsEqual += AbsoluteTime[] - $profT0;
566-
$ProfileTermsEqualSuccess++;
567-
Return @ FTerm[t1[[1]] + t2[[1]], t1[[2 ;; ]]]
568-
];
569-
If[t1[[2 ;; ]] === t2[[1 ;; ]] && FreeQ[{t1[[1]]}, Alternatives @@ $indexedObjects, Infinity],
570-
$ProfileTermsEqual += AbsoluteTime[] - $profT0;
571-
$ProfileTermsEqualSuccess++;
572-
Return @ FTerm[t1[[1]] + 1, t1[[2 ;; ]]]
573-
];
574-
If[t1[[1 ;; ]] === t2[[2 ;; ]] && FreeQ[{t1[[1]]}, Alternatives @@ $indexedObjects, Infinity],
575-
$ProfileTermsEqual += AbsoluteTime[] - $profT0;
576-
$ProfileTermsEqualSuccess++;
577-
Return @ FTerm[1 + t2[[1]], t1[[1 ;; ]]]
578-
];
563+
{fac1, terms1} = SplitPrefactor[setup, t1];
564+
{fac2, terms2} = SplitPrefactor[setup, t2];
565+
If[terms1 === terms2,
566+
factor = fac1 + fac2;
567+
$ProfileTermsEqual += AbsoluteTime[] - $profT0;
568+
$ProfileTermsEqualSuccess++;
569+
If[factor === 0, Return[FTerm[0]]];
570+
Return[FTerm[factor, terms1]]
579571
];
580572
(* Use pre-computed data *)
581573
cidxt1 = data1["cidx"];

modules/FEDeriK/Cleaning.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
Abort[]
4444
];
4545
indices = GetClosedSuperIndices[setup, ret];
46-
newIndices = Map[Symbol @ SymbolName @ Unique[StringReplace[ToString[#], i : DigitCharacter.. :> ""]]&, indices];
46+
newIndices = Map[Symbol @ SymbolName @ Unique["ci"]&, indices];
4747
replacements = Thread[indices -> newIndices];
4848
If[ValueQ[$FixIndicesTime], $FixIndicesTime += AbsoluteTime[] - t0; $FixIndicesCount++];
4949
Return[ret /. replacements];

modules/FEDeriK/Compatibility.m

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,16 @@
6262
];
6363

6464
QMeSForm[setup_, expr_] :=
65-
(AssertFSetup[setup]; Map[QMeSNaming[setup, #]&, expr, {1, 3}] //. {FEx :> List, FTerm :> Times});
65+
(
66+
AssertFSetup[setup];
67+
Map[QMeSNaming[setup, #]&, expr, {1, 3}] //. {FEx :> List, FTerm :> Times}
68+
);
6669

6770
QMeSForm[setup_, expr_Association] :=
68-
(AssertFSetup[setup]; AssociationMap[QMeSForm[setup, #]&, expr]);
71+
(
72+
AssertFSetup[setup];
73+
AssociationMap[QMeSForm[setup, #]&, expr]
74+
);
6975

7076
(* Transforming QMeS to FunKit *)
7177

@@ -96,13 +102,13 @@
96102
newa =
97103
newa //.
98104
{
99-
<|"type" -> "Regulatordot", "indices" -> {a__}|> :> makeObj[Rdot, {a}[[All, 1]], {a}[[All, 2, 1]]]
105+
<|"type" -> "Regulatordot", "indices" -> {a__}|> :> makeObj[Rdot, {a}[[All, 1]], -{a}[[All, 2, 1]]]
100106
,(**)
101107
<|"type" -> "Propagator", "indices" -> {a__}|> :> makeObj[Propagator, {a}[[All, 1]], {a}[[All, 2, 1]]]
102108
,(**)
103-
assoc_Association /; assoc["type"] === "nPoint" && assoc["spec"] === "classical" :> makeObj[S, assoc["indices"][[All, 1]], -assoc["indices"][[All, 2, 1]]]
109+
<|"type" -> "nPoint", "indices" -> {a__}, "nPoint" -> _, "spec" -> "classical"|> :> makeObj[S, {a}[[All, 1]], -{a}[[All, 2, 1]]]
104110
,(**)
105-
<|"type" -> "nPoint", "indices" -> {a__}, __|> :> makeObj[GammaN, {a}[[All, 1]], {a}[[All, 2, 1]]]
111+
<|"type" -> "nPoint", "indices" -> {a__}, "nPoint" -> _, "spec" -> "none"|> :> makeObj[GammaN, {a}[[All, 1]], -{a}[[All, 2, 1]]]
106112
};
107113
Return[FTerm[pref, ##]& @@ newa]
108114
];
@@ -154,4 +160,7 @@
154160
DoFunForm::notImplemented = "DoFunForm is not yet implemented.";
155161

156162
DoFunForm[args___] :=
157-
(Message[DoFunForm::notImplemented]; Abort[]);
163+
(
164+
Message[DoFunForm::notImplemented];
165+
Abort[]
166+
);

modules/FEDeriK/Global.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
FMakeClassicalAction[] /; Head[$GlobalSetup] =!= Symbol :=
121121
FMakeClassicalAction[$GlobalSetup];
122122

123-
FMakeClassicalAction[] :=
123+
FMakeClassicalAction[] /; Head[$GlobalSetup] === Symbol :=
124124
(
125125
Message[FunKit::noGlobalSetup];
126126
Abort[]

modules/FEDeriK/MasterEquations.m

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,21 @@
2222
Message[FMakeClassicalAction::noTruncation];
2323
Abort[]
2424
];
25-
FEx @@
26-
Map[
27-
(
28-
prefac = Split[#];
29-
prefac = Times @@ (1 / ((Length[#]& /@ prefac)!));
30-
indices = Map[Unique["i"]&, #];
31-
FTerm[prefac, makeObj[S, #, -indices]] ** (FTerm @@ Table[#[[i]][indices[[i]]], {i, 1, Length[#]}])
32-
)&
33-
,
34-
OrderFieldList[setup, #]& /@ setup["Truncation"][S]
35-
]
25+
FOrderFields[
26+
setup
27+
,
28+
FEx @@
29+
Map[
30+
(
31+
prefac = Split[#];
32+
prefac = Times @@ (1 / ((Length[#]& /@ prefac)!));
33+
indices = Map[Unique["i"]&, #];
34+
FTerm[prefac, makeObj[S, Reverse @ #, -Reverse @ indices]] ** (FTerm @@ Table[#[[i]][indices[[i]]], {i, 1, Length[#]}])
35+
)&
36+
,
37+
OrderFieldList[setup, #]& /@ setup["Truncation"][S]
38+
]
39+
]
3640
];
3741

3842
(**********************************************************************************
@@ -91,11 +95,13 @@
9195
ReduceIndices[setup, #]&;
9296
(*Separate powers out into factors in the FTerm. Need this to insert FDOp in the next step*)
9397
dS = dS //. Times[pre___, f1_[id1_], post___] :> NonCommutativeMultiply[pre, f1[id1], post];
94-
(*Insert \[Phi]^a->\[CapitalPhi]^a+G^ab\[Delta]/\[Delta]\[CapitalPhi]^b
95-
Use Replace at level {2} (FTerm arguments) to avoid replacing field[index]
96-
patterns inside indexed objects in NotationB.*)
98+
(*Insert \[Phi]^a->\[CapitalPhi]^a+G^ab\[Delta]/\[Delta]\[CapitalPhi]^b
99+
Use Replace at level {2} (FTerm arguments) to avoid replacing field[index]
100+
patterns inside indexed objects in NotationB.*)
97101
dS =
98-
Replace[dS,
102+
Replace[
103+
dS
104+
,
99105
Map[
100106
#[id_] :>
101107
Module[{i},
@@ -104,13 +110,15 @@
104110
]&
105111
,
106112
GetAllFields[setup]
107-
],
113+
]
114+
,
108115
{2}
109116
];
110117
dS //
111118
FResolveDerivatives[setup, #]& //
112119
If[ModuleLoaded[AnSEL] && $AutoSimplify === True,
113-
FunKit`FSimplify[setup, #],
120+
FunKit`FSimplify[setup, #]
121+
,
114122
#
115123
]&
116124
];

modules/FEDeriK/Truncation.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,8 @@ Collect concrete fields from ALL indices (not just closed), since
875875
Return[ret0];
876876
];
877877

878+
$TruncationAlgorithm = CTrunc;
879+
878880
FTruncate[setup_, expr_FEx] :=
879881
Module[{ret0, ret1, ret2, ret3, annotations},
880882
AssertFSetup[setup];
@@ -894,7 +896,7 @@ Collect concrete fields from ALL indices (not just closed), since
894896
{ret0, annotations} = SeparateFExAnnotations[expr];
895897
(*Take care of closed indices — CTrunc returns lists-of-lists*)
896898
Module[{t0 = AbsoluteTime[]},
897-
ret0 = BalancedMap[LTrunc[setup, #]&, ret0];
899+
ret0 = BalancedMap[$TruncationAlgorithm[setup, #]&, ret0];
898900
(*Merge: ret0 is a List where each element is a list-of-bare-lists from LTrunc.
899901
Flatten one level, filter empties/zeros, wrap each bare list in FTerm.*)
900902
ret0 =

modules/TRACY/FORM.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,9 @@
261261
If[FileExistsQ[Directory[] <> "/form.set"],
262262
Return[]
263263
];
264-
session = StartExternalSession[{"Python", "Evaluator" -> <|"Dependencies" -> {"formtools-formset"}, "EnvironmentName" -> "FunKit"|>}];
265-
ExternalEvaluate[session, {"import formset", "formset.main(['-o','" <> Directory[] <> "/form.set" <> "','-p','100'])"}];
266-
DeleteObject[session];
264+
If[$VersionNumber >= 14.1,
265+
session = StartExternalSession[{"Python", "Evaluator" -> <|"Dependencies" -> {"formtools-formset"}, "EnvironmentName" -> "FunKit"|>}];
266+
ExternalEvaluate[session, {"import formset", "formset.main(['-o','" <> Directory[] <> "/form.set" <> "','-p','100'])"}];
267+
DeleteObject[session];
268+
];
267269
];

publication/FunKit.tex

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,27 @@ \subsection{Deriving diagrams}
760760
In the above, $(-1)^{ab}$ is the fermionic minus sign as defined in \labelcref{eq:fminus}, represented in \FunKit as \mmaInlineCell{Input}{\mmaDef{FMinus}[\{\mmaDef{AnyField},\mmaDef{AnyField}\},\{a,b\}]}. Note additionally that, $\gamma_{ab}$ is represented as \mmaInlineCell{Input}{\mmaDef{\(\pmb{\gamma}\)}[\{\mmaDef{AnyField},\mmaDef{AnyField}\},\{-a,-b\}]}, see also \Cref{tab:notation} for an overview of the notation.
761761
762762
\FunKit has automatically simplified the diagrams resulting from the above derivation. For finer control, the functions \mathem{\mmaDef{FResolveFDOp}} and \mathem{\mmaDef{FSimplify}} allow resolving derivatives and simplifying expressions step by step. In general, however, we recommend using \mathem{\mmaDef{FTakeDerivatives}}, as it provides the most automated workflow and generates additional simplification hints such as symmetry properties of the derivatives.
763-
We describe the simplification and derivative algorithm used by \FunKit in more detail in the green boxes below.
763+
We describe the simplification and derivative algorithms used by \FunKit in more detail in the green boxes below.
764+
765+
766+
\begin{tcolorbox}[title=Algorithm details: Diagram simplification,
767+
title filled=false,
768+
colback=pastelgreen!5!white,
769+
colframe=pastelgreen!73!black,
770+
fonttitle=\bfseries]
771+
772+
With \mathem{\mmaDef{FSimplify}} we introduce an algorithm for the simplification of large sums of diagrams. \mathem{\mmaDef{FSimplify}} can detect identical diagrams and performs the following steps to find all matches and sum them:
773+
%
774+
\begin{enumerate}
775+
\item All Diagrams with exactly the same content of objects and the same set of open indices are grouped together.
776+
\item Each group is then processed in parallel: Pairs of diagrams are sequentially built and compared.
777+
\item The comparison of two diagrams is performed by traversing the graphs of both at the same time and checking for identity.
778+
\item If symmetries of open indices are provided, all permutations (with possible prefactors, e.g. minus signs for fermionic permutations) are also explored.
779+
\item If the graphs are identical, they are merged. When merging, the second diagram is prepended with a factor containing all signs needed to give it precisely the same index ordering and structure as the first diagram.
780+
\end{enumerate}
781+
782+
\end{tcolorbox}
783+
764784
765785
\begin{tcolorbox}[title=Algorithm details: Derivatives,
766786
title filled=false,
@@ -789,29 +809,6 @@ \subsection{Deriving diagrams}
789809
790810
\end{tcolorbox}
791811
792-
\vfill
793-
794-
\newpage
795-
796-
797-
\begin{tcolorbox}[title=Algorithm details: Diagram simplification,
798-
title filled=false,
799-
colback=pastelgreen!5!white,
800-
colframe=pastelgreen!73!black,
801-
fonttitle=\bfseries]
802-
803-
With \mathem{\mmaDef{FSimplify}} we introduce an algorithm for the simplification of large sums of diagrams. \mathem{\mmaDef{FSimplify}} can detect identical diagrams and performs the following steps to find all matches and sum them:
804-
%
805-
\begin{enumerate}
806-
\item All Diagrams with exactly the same content of objects and the same set of open indices are grouped together.
807-
\item Each group is then processed in parallel: Pairs of diagrams are sequentially built and compared.
808-
\item The comparison of two diagrams is performed by traversing the graphs of both at the same time and checking for identity.
809-
\item If symmetries of open indices are provided, all permutations (with possible prefactors, e.g. minus signs for fermionic permutations) are also explored.
810-
\item If the graphs are identical, they are merged. When merging, the second diagram is prepended with a factor containing all signs needed to give it precisely the same index ordering and structure as the first diagram.
811-
\end{enumerate}
812-
813-
\end{tcolorbox}
814-
815812
816813
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
817814
\subsection{Truncating the output}
@@ -1491,7 +1488,7 @@ \section{Comparisons and Benchmarks}
14911488
\quad Dyson-Schwinger equations & \cmark & \cmark & \cmark \\
14921489
\quad Flow equations (fRG) & \cmark & \cmark & \cmark \\
14931490
\quad (Modified) Slavnov-Taylor id. & \xmark & \cmark & \cmark \\
1494-
\quad Composite operator equations & \cmark & \xmark & \xmark \\
1491+
\quad Composite operator equations & \cmark & \xmark & (\cmark)\footnote{Although \FunKit does not provide these natively, they can be easily implemented by hand by constructing the objects with \texttt{FDOp}.} \\
14951492
\quad Arbitrary master equations & \xmark & \xmark & \cmark \\
14961493
\quad Multi-index func.\ derivatives & \xmark & \xmark & \cmark \\
14971494
\midrule
@@ -1554,6 +1551,17 @@ \section{Comparisons and Benchmarks}
15541551
\end{figure*}
15551552
15561553
1554+
%%%%%%%%%%%%%%%%%%%%
1555+
\section{Limitations and Important Notices}
1556+
1557+
While \FunKit covers a broad range of applications, of course some limitations remain. Truncations are specified as explicit lists of field-content tuples, meaning that rule-based truncation schemes — such as retaining all operators up to a given mass dimension or derivative order — must be currently constructed manually by the~user.
1558+
1559+
A fundamental challenge is the resolution of functional derivatives, which involves a product-rule expansion that can lead to rapid intermediate expression growth for large truncations.
1560+
Although \FunKit mitigates this through in-loop simplification parallelisation and appropriate algorithm design, the scaling remains a practical bottleneck for very large systems. This is however not a problem of \FunKit, but rather of the approach itself.
1561+
1562+
Also, while \FunKit generates optimised code for the integrands of functional equations, it does not provide a numerical integration framework; the user must embed the generated code into their own solver or use an existing framework such as \texttt{DiFfRG} \cite{Sattler:2024ozv}.
1563+
Finally, direct support for Windows is currently not available, as FORM does not support native execution on Windows systems. However, using \FunKit via WSL (Windows Subsystem for Linux) is possible.
1564+
15571565
15581566
%%%%%%%%%%%%%%%%%%%%
15591567
\section{Conclusions}
@@ -1571,14 +1579,6 @@ \section{Conclusions}
15711579
15721580
We demonstrated the capabilities of \FunKit at the example of Yang-Mills theory, scalar field theory, a Yukawa theory and an NJL model. As for master equations, we show DSEs, the Wetterich equation, the modified STIs and dynamically reparameterised flow equations. All these examples can be found in the \FunKit repository, see also \Cref{tab:examples}.
15731581
1574-
While \FunKit covers a broad range of applications, of course some limitations remain. Truncations are specified as explicit lists of field-content tuples, meaning that rule-based truncation schemes — such as retaining all operators up to a given mass dimension or derivative order — must be currently constructed manually by the~user.
1575-
1576-
A fundamental challenge is the resolution of functional derivatives, which involves a product-rule expansion that can lead to rapid intermediate expression growth for large truncations.
1577-
Although \FunKit mitigates this through in-loop simplification parallelisation and appropriate algorithm design, the scaling remains a practical bottleneck for very large systems. This is however not a problem of \FunKit, but rather of the approach itself.
1578-
1579-
Also, while \FunKit generates optimised code for the integrands of functional equations, it does not provide a numerical integration framework; the user must embed the generated code into their own solver or use an existing framework such as \texttt{DiFfRG} \cite{Sattler:2024ozv}.
1580-
Finally, direct support for Windows is currently not available, as FORM does not support native execution on Windows systems. However, using \FunKit via WSL (Windows Subsystem for Linux) is possible.
1581-
15821582
\FunKit is already a basis for several on-going projects in the fQCD collaboration \cite{fQCD} involving large QCD truncations with dynamical hadronisation and other flowing reparametrisations.
15831583
As it is embedded in the tools of the fQCD collaboration, e.g. it has become the symbolic backend of the \texttt{DiFfRG} framework \cite{Sattler:2024ozv}, \FunKit will continue to see improvements in the future.
15841584
@@ -1708,7 +1708,24 @@ \section{Superindex Notation Details}
17081708
\begin{align}
17091709
\textrm{Sym}_{\phi_1\phi_2\phi_3q_4q_5\bar{q}_5} = \frac{1}{3!}\frac{1}{2!}\frac{1}{1!}\,.
17101710
\end{align}
1711-
1711+
%
1712+
When building a DSE, \FunKit assumes the following form of a classical action:
1713+
%
1714+
\begin{align}
1715+
S[\phi] = \sum_{\{i_1\ldots i_n\} \in \text{Trunc}(S)} S_{i_n\ldots i_1} \phi^{i_1}\phi^{i_n}\,,
1716+
\end{align}
1717+
%
1718+
where $\text{Trunc}(S)$ represents the set of all (ordered) correlation functions included in the truncation list for $S$.
1719+
As an example, this results in a classical action for the Yang-Mills theory that reads
1720+
%
1721+
\begin{align}
1722+
S_\textrm{YM} &= S_{A^{i_1}A^{i_1}}A^{i_1}A^{i_2} + S_{c^{i_2}\bar{c}^{i_1}}\bar{c}^{i_1}c^{i_2}
1723+
\notag\\[0.5ex]
1724+
&\qquad + S_{A^{i_3}A^{i_2}A^{i_1}}A^{i_1}A^{i_2}A^{i_3} + S_{A^{i_4}A^{i_3}A^{i_2}A^{i_1}}A^{i_1}A^{i_2}A^{i_3}A^{i_4} + S_{A^{i_3}c^{i_2}\bar{c}^{i_1}}\bar{c}^{i_1}c^{i_2}A^{i_3}\,.
1725+
\end{align}
1726+
%
1727+
This is identical with how \QMeS defines its classical action.
1728+
However, \DoFun adds an additional minus sign for fermionic vertices \cite{Huber:2011qr} when constructing the classical action - special care to this should be taken by users when comparing or porting existing \DoFun code to \FunKit.
17121729
17131730
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17141731
\section{NJL Model Example}

0 commit comments

Comments
 (0)