1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 15:55:37 +00:00
Grid/lib/qcd/spin/gamma-gen/gamma-gen.nb

1634 lines
60 KiB
Mathematica

(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 11.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 60858, 1625]
NotebookOptionsPosition[ 58965, 1561]
NotebookOutlinePosition[ 59326, 1577]
CellTagsIndexPosition[ 59283, 1574]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[TextData[StyleBox["Grid physics library, www.github.com/paboyle/Grid \n\n\
Source file: lib/qcd/spin/gamma-gen/gamma-gen.nb\n\nCopyright (C) 2015\n\
Copyright (C) 2016\nCopyright (C) 2017\n\nAuthor: Antonin Portelli \
<antonin.portelli@me.com>\n\nThis program is free software; you can \
redistribute it and/or modify\nit under the terms of the GNU General Public \
License as published by\nthe Free Software Foundation; either version 2 of \
the License, or\n(at your option) any later version.\n\nThis program is \
distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; \
without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A \
PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\n\
You should have received a copy of the GNU General Public License along\nwith \
this program; if not, write to the Free Software Foundation, Inc.,\n51 \
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\nSee the full \
license in the file \[OpenCurlyDoubleQuote]LICENSE\[CloseCurlyDoubleQuote] in \
the top level distribution directory",
Background->RGBColor[1, 1, 0.85]]], "Text",
CellChangeTimes->{{3.694192702097444*^9, 3.694192776106186*^9}, {
3.6942089129622507`*^9, 3.694208916624515*^9}},
Background->RGBColor[1, 1, 0.85]],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{"ClearAll", "[", "\"\<Global`*\>\"", "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Unprotect", "[", "\"\<Dot\>\"", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{"SetDirectory", "[",
RowBox[{"NotebookDirectory", "[", "]"}], "]"}]}], "Input",
CellChangeTimes->{{3.69418610909842*^9, 3.694186122331771*^9}, {
3.694189694542165*^9, 3.6941897146300087`*^9}}],
Cell[BoxData["\<\"/Users/antonin/Development/Grid/lib/qcd/spin/gamma-gen\"\>"]\
, "Output",
CellChangeTimes->{{3.694189715067813*^9, 3.694189718130962*^9}, {
3.694207343654113*^9, 3.694207368715312*^9}, 3.694208353902673*^9,
3.694208422714191*^9, 3.694208720092059*^9, 3.694208887255764*^9,
3.6942115023319197`*^9, 3.694211674672401*^9, 3.694211769773765*^9,
3.694212832251072*^9, 3.694212924703574*^9, 3.694213477890645*^9,
3.694214215876555*^9, 3.694214744582322*^9, 3.694214868607993*^9, {
3.694214930774279*^9, 3.694214956189962*^9}, 3.69421520097348*^9,
3.6942153028002653`*^9, 3.694215388363636*^9, 3.694215531793765*^9,
3.694293467607703*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell["Clifford algebra generation", "Section",
CellChangeTimes->{{3.6942089434583883`*^9, 3.694208978559093*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"com", "[",
RowBox[{"a_", ",", "b_"}], "]"}], ":=",
RowBox[{
RowBox[{"a", ".", "b"}], "-",
RowBox[{"b", ".", "a"}]}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"acom", "[",
RowBox[{"a_", ",", "b_"}], "]"}], ":=",
RowBox[{
RowBox[{"a", ".", "b"}], "+",
RowBox[{"b", ".", "a"}]}]}]}], "Input",
CellChangeTimes->{{3.694184330267939*^9, 3.694184337479828*^9}, {
3.694184821238667*^9, 3.6941848260602217`*^9}}],
Cell["Definition of the matrix representation of the algebra:", "Text",
CellChangeTimes->{{3.6942090405172586`*^9, 3.694209073962101*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"mat", "[", "id", "]"}], "=",
RowBox[{"IdentityMatrix", "[", "4", "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "gx", "]"}], "=",
RowBox[{"(", GridBox[{
{"0", "0", "0", "\[ImaginaryI]"},
{"0", "0", "\[ImaginaryI]", "0"},
{"0",
RowBox[{"-", "\[ImaginaryI]"}], "0", "0"},
{
RowBox[{"-", "\[ImaginaryI]"}], "0", "0", "0"}
}], ")"}]}], ";",
RowBox[{
RowBox[{"mat", "[", "gy", "]"}], "=",
RowBox[{"(", GridBox[{
{"0", "0", "0",
RowBox[{"-", "1"}]},
{"0", "0", "1", "0"},
{"0", "1", "0", "0"},
{
RowBox[{"-", "1"}], "0", "0", "0"}
}], ")"}]}], ";",
RowBox[{
RowBox[{"mat", "[", "gz", "]"}], "=",
RowBox[{"(", GridBox[{
{"0", "0", "\[ImaginaryI]", "0"},
{"0", "0", "0",
RowBox[{"-", "\[ImaginaryI]"}]},
{
RowBox[{"-", "\[ImaginaryI]"}], "0", "0", "0"},
{"0", "\[ImaginaryI]", "0", "0"}
}], ")"}]}], ";",
RowBox[{
RowBox[{"mat", "[", "gt", "]"}], "=",
RowBox[{"(", GridBox[{
{"0", "0", "1", "0"},
{"0", "0", "0", "1"},
{"1", "0", "0", "0"},
{"0", "1", "0", "0"}
}], ")"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "g5", "]"}], "=",
RowBox[{
RowBox[{"mat", "[", "gx", "]"}], ".",
RowBox[{"mat", "[", "gy", "]"}], ".",
RowBox[{"mat", "[", "gz", "]"}], ".",
RowBox[{"mat", "[", "gt", "]"}]}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "gx5", "]"}], "=",
RowBox[{
RowBox[{"mat", "[", "gx", "]"}], ".",
RowBox[{"mat", "[", "g5", "]"}]}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "gy5", "]"}], "=",
RowBox[{
RowBox[{"mat", "[", "gy", "]"}], ".",
RowBox[{"mat", "[", "g5", "]"}]}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "gz5", "]"}], "=",
RowBox[{
RowBox[{"mat", "[", "gz", "]"}], ".",
RowBox[{"mat", "[", "g5", "]"}]}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "gt5", "]"}], "=",
RowBox[{
RowBox[{"mat", "[", "gt", "]"}], ".",
RowBox[{"mat", "[", "g5", "]"}]}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "\[Sigma]xy", "]"}], "=",
RowBox[{
RowBox[{"com", "[",
RowBox[{
RowBox[{"mat", "[", "gx", "]"}], ",",
RowBox[{"mat", "[", "gy", "]"}]}], "]"}], "/", "2"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "\[Sigma]xz", "]"}], "=",
RowBox[{
RowBox[{"com", "[",
RowBox[{
RowBox[{"mat", "[", "gx", "]"}], ",",
RowBox[{"mat", "[", "gz", "]"}]}], "]"}], "/", "2"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "\[Sigma]xt", "]"}], "=",
RowBox[{
RowBox[{"com", "[",
RowBox[{
RowBox[{"mat", "[", "gx", "]"}], ",",
RowBox[{"mat", "[", "gt", "]"}]}], "]"}], "/", "2"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "\[Sigma]yz", "]"}], "=",
RowBox[{
RowBox[{"com", "[",
RowBox[{
RowBox[{"mat", "[", "gy", "]"}], ",",
RowBox[{"mat", "[", "gz", "]"}]}], "]"}], "/", "2"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "\[Sigma]yt", "]"}], "=",
RowBox[{
RowBox[{"com", "[",
RowBox[{
RowBox[{"mat", "[", "gy", "]"}], ",",
RowBox[{"mat", "[", "gt", "]"}]}], "]"}], "/", "2"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mat", "[", "\[Sigma]zt", "]"}], "=",
RowBox[{
RowBox[{"com", "[",
RowBox[{
RowBox[{"mat", "[", "gz", "]"}], ",",
RowBox[{"mat", "[", "gt", "]"}]}], "]"}], "/", "2"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"palg", "=",
RowBox[{"{",
RowBox[{
"id", ",", "gx", ",", "gy", ",", "gz", ",", "gt", ",", "g5", ",", "gx5",
",", "gy5", ",", "gz5", ",", "gt5", ",", "\[Sigma]xy", ",", "\[Sigma]xz",
",", "\[Sigma]xt", ",", "\[Sigma]yz", ",", "\[Sigma]yt", ",",
"\[Sigma]zt"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"malg", "=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"-", "i"}], ",",
RowBox[{"{",
RowBox[{"i", ",", "palg"}], "}"}]}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"alg", "=",
RowBox[{"Union", "[",
RowBox[{"palg", ",", "malg"}], "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"Do", "[",
RowBox[{
RowBox[{
RowBox[{"mat", "[",
RowBox[{"-", "i"}], "]"}], "=",
RowBox[{"-",
RowBox[{"mat", "[", "i", "]"}]}]}], ",",
RowBox[{"{",
RowBox[{"i", ",", "palg"}], "}"}]}], "]"}]}], "Input",
CellChangeTimes->{{3.694182703426999*^9, 3.694182706401226*^9}, {
3.6941838790187283`*^9, 3.694184129323387*^9}, {3.694184186220387*^9,
3.6941842073992023`*^9}, {3.694184241024517*^9, 3.6941843050620823`*^9}, {
3.694184341303878*^9, 3.694184431096826*^9}, {3.694184469241919*^9,
3.694184532366125*^9}, {3.694184830238468*^9, 3.694184950533866*^9}, {
3.694185044355978*^9, 3.694185099415689*^9}, {3.694185502749824*^9,
3.694185675128971*^9}, {3.694185728773429*^9, 3.694185729056695*^9},
3.694185780274218*^9, 3.6941858224264593`*^9, {3.694185941282981*^9,
3.694185950262871*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"mat", "[",
RowBox[{"-", "gt5"}], "]"}], "//", "MatrixForm"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"(",
RowBox[{"r", " ", "=", " ",
RowBox[{"RandomReal", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"-", "10"}], ",", "10"}], "}"}], ",",
RowBox[{"{",
RowBox[{"4", ",", "4"}], "}"}]}], "]"}]}], ")"}], "//",
"MatrixForm"}]}], "Input",
CellChangeTimes->{{3.694293480790983*^9, 3.69429352615298*^9}, {
3.694293583868273*^9, 3.694293627905012*^9}}],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"0", "0", "1", "0"},
{"0", "0", "0", "1"},
{
RowBox[{"-", "1"}], "0", "0", "0"},
{"0",
RowBox[{"-", "1"}], "0", "0"}
},
GridBoxAlignment->{
"Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.7]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}],
Function[BoxForm`e$,
MatrixForm[BoxForm`e$]]]], "Output",
CellChangeTimes->{{3.6942934848800297`*^9, 3.694293510379167*^9}, {
3.694293591310405*^9, 3.694293628362492*^9}}],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{
RowBox[{"-", "0.25452891888633644`"}], "3.9497832842151723`",
RowBox[{"-", "6.956210966956014`"}],
RowBox[{"-", "1.1605509642484506`"}]},
{
RowBox[{"-", "9.759118843088793`"}], "5.857502491851477`",
"2.261037884838345`", "7.119654104319878`"},
{
RowBox[{"-", "2.281513144390619`"}],
RowBox[{"-", "6.615660517890536`"}], "0.8161523737384115`",
"6.455639430863592`"},
{"7.570477003311133`", "7.839673906449725`",
RowBox[{"-", "0.1228536610401676`"}],
RowBox[{"-", "3.5575684207365654`"}]}
},
GridBoxAlignment->{
"Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.7]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}],
Function[BoxForm`e$,
MatrixForm[BoxForm`e$]]]], "Output",
CellChangeTimes->{{3.6942934848800297`*^9, 3.694293510379167*^9}, {
3.694293591310405*^9, 3.694293628381173*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"mat", "[",
RowBox[{"-", "gt"}], "]"}], ".", "rhsv"}], "//",
"MatrixForm"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"rhsv", ".",
RowBox[{"mat", "[",
RowBox[{"-", "gt"}], "]"}]}], "//", "MatrixForm"}]}], "Input",
CellChangeTimes->{{3.694293596046916*^9, 3.694293618686639*^9}, {
3.6942936668548403`*^9, 3.694293671450027*^9}, {3.6942939975199223`*^9,
3.694294027927437*^9}}],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]",
TagBox[GridBox[{
{
RowBox[{"-",
RowBox[{"rhs", "[", "2", "]"}]}]},
{
RowBox[{"-",
RowBox[{"rhs", "[", "3", "]"}]}]},
{
RowBox[{"-",
RowBox[{"rhs", "[", "0", "]"}]}]},
{
RowBox[{"-",
RowBox[{"rhs", "[", "1", "]"}]}]}
},
GridBoxAlignment->{
"Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.5599999999999999]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}],
Column], "\[NoBreak]", ")"}],
Function[BoxForm`e$,
MatrixForm[BoxForm`e$]]]], "Output",
CellChangeTimes->{{3.694293605879734*^9, 3.69429361931848*^9},
3.694293671734251*^9, {3.6942940079400787`*^9, 3.694294028852909*^9}}],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]",
TagBox[GridBox[{
{
RowBox[{"-",
RowBox[{"rhs", "[", "2", "]"}]}]},
{
RowBox[{"-",
RowBox[{"rhs", "[", "3", "]"}]}]},
{
RowBox[{"-",
RowBox[{"rhs", "[", "0", "]"}]}]},
{
RowBox[{"-",
RowBox[{"rhs", "[", "1", "]"}]}]}
},
GridBoxAlignment->{
"Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.5599999999999999]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}],
Column], "\[NoBreak]", ")"}],
Function[BoxForm`e$,
MatrixForm[BoxForm`e$]]]], "Output",
CellChangeTimes->{{3.694293605879734*^9, 3.69429361931848*^9},
3.694293671734251*^9, {3.6942940079400787`*^9, 3.6942940288814163`*^9}}]
}, Open ]],
Cell["Generation of the abstract algebra:", "Text",
CellChangeTimes->{{3.6942090658330803`*^9, 3.694209076132119*^9}}],
Cell[BoxData[{
RowBox[{"Do", "[",
RowBox[{
RowBox[{
RowBox[{"Dot", "[",
RowBox[{"i1", ",", "i2"}], "]"}], "=",
RowBox[{
RowBox[{"Select", "[",
RowBox[{"alg", ",",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"mat", "[", "i1", "]"}], ".",
RowBox[{"mat", "[", "i2", "]"}]}], "\[Equal]",
RowBox[{"mat", "[", "#", "]"}]}], "&"}]}], "]"}], "[",
RowBox[{"[", "1", "]"}], "]"}]}], ",",
RowBox[{"{",
RowBox[{"i1", ",", "palg"}], "}"}], ",",
RowBox[{"{",
RowBox[{"i2", ",", "palg"}], "}"}]}], "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"Dot", "[",
RowBox[{
RowBox[{"-", "i1_"}], ",", "i2_"}], "]"}], ":=",
RowBox[{"-",
RowBox[{"i1", ".", "i2"}]}]}], ";",
RowBox[{
RowBox[{"Dot", "[",
RowBox[{"i1_", ",",
RowBox[{"-", "i2_"}]}], "]"}], ":=",
RowBox[{"-",
RowBox[{"i1", ".", "i2"}]}]}], ";",
RowBox[{
RowBox[{"Dot", "[",
RowBox[{
RowBox[{"-", "i1_"}], ",",
RowBox[{"-", "i2_"}]}], "]"}], ":=",
RowBox[{"i1", ".", "i2"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.6941860329437103`*^9, 3.6941860343133917`*^9}, {
3.694186163571176*^9, 3.6941862016761427`*^9}, {3.69418700219066*^9,
3.6941870425469627`*^9}}],
Cell["Check that we can reconstruct the Euclidean metric:", "Text",
CellChangeTimes->{{3.694209080190936*^9, 3.694209096585559*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{"acom", "[",
RowBox[{"i1", ",", "i2"}], "]"}], "/", "2"}], ",",
RowBox[{"{",
RowBox[{"i1", ",",
RowBox[{"{",
RowBox[{"gx", ",", "gy", ",", "gz", ",", "gt"}], "}"}]}], "}"}], ",",
RowBox[{"{",
RowBox[{"i2", ",",
RowBox[{"{",
RowBox[{"gx", ",", "gy", ",", "gz", ",", "gt"}], "}"}]}], "}"}]}],
"]"}], "//", "MatrixForm"}]], "Input"],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"id", "0", "0", "0"},
{"0", "id", "0", "0"},
{"0", "0", "id", "0"},
{"0", "0", "0", "id"}
},
GridBoxAlignment->{
"Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.7]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}],
Function[BoxForm`e$,
MatrixForm[BoxForm`e$]]]], "Output",
CellChangeTimes->{
3.694186559657666*^9, 3.6941870440388947`*^9, 3.694189718434745*^9, {
3.694207344033985*^9, 3.694207369106125*^9}, 3.694208354345052*^9,
3.694208423089445*^9, 3.6942087204812307`*^9, 3.6942088876269073`*^9,
3.694211502659554*^9, 3.6942116750282307`*^9, 3.694211770126875*^9,
3.6942128326290417`*^9, 3.6942129251958523`*^9, 3.694213478493619*^9,
3.694214216283064*^9, 3.694214744924881*^9, 3.694214869005068*^9, {
3.694214931160738*^9, 3.6942149565175247`*^9}, 3.69421520140513*^9,
3.694215303184371*^9, 3.694215388782826*^9, 3.694215532274271*^9,
3.694293468120837*^9}]
}, Open ]],
Cell["Full multiplication table:", "Text",
CellChangeTimes->{{3.694209113187169*^9, 3.6942091210767593`*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{
RowBox[{"Table", "[",
RowBox[{
RowBox[{"i1", ".", "i2"}], ",",
RowBox[{"{",
RowBox[{"i1", ",", "palg"}], "}"}], ",",
RowBox[{"{",
RowBox[{"i2", ",", "palg"}], "}"}]}], "]"}], "//",
"MatrixForm"}]], "Input",
CellChangeTimes->{{3.6941862426584797`*^9, 3.694186256858178*^9}, {
3.694186605271886*^9, 3.694186617894228*^9}, {3.694186972131384*^9,
3.69418697419895*^9}, {3.694192885918524*^9, 3.694192888888296*^9}}],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"id", "gx", "gy", "gz", "gt", "g5", "gx5", "gy5", "gz5", "gt5",
"\[Sigma]xy", "\[Sigma]xz", "\[Sigma]xt", "\[Sigma]yz", "\[Sigma]yt",
"\[Sigma]zt"},
{"gx", "id", "\[Sigma]xy", "\[Sigma]xz", "\[Sigma]xt", "gx5", "g5",
RowBox[{"-", "\[Sigma]zt"}], "\[Sigma]yt",
RowBox[{"-", "\[Sigma]yz"}], "gy", "gz", "gt",
RowBox[{"-", "gt5"}], "gz5",
RowBox[{"-", "gy5"}]},
{"gy",
RowBox[{"-", "\[Sigma]xy"}], "id", "\[Sigma]yz", "\[Sigma]yt", "gy5",
"\[Sigma]zt", "g5",
RowBox[{"-", "\[Sigma]xt"}], "\[Sigma]xz",
RowBox[{"-", "gx"}], "gt5",
RowBox[{"-", "gz5"}], "gz", "gt", "gx5"},
{"gz",
RowBox[{"-", "\[Sigma]xz"}],
RowBox[{"-", "\[Sigma]yz"}], "id", "\[Sigma]zt", "gz5",
RowBox[{"-", "\[Sigma]yt"}], "\[Sigma]xt", "g5",
RowBox[{"-", "\[Sigma]xy"}],
RowBox[{"-", "gt5"}],
RowBox[{"-", "gx"}], "gy5",
RowBox[{"-", "gy"}],
RowBox[{"-", "gx5"}], "gt"},
{"gt",
RowBox[{"-", "\[Sigma]xt"}],
RowBox[{"-", "\[Sigma]yt"}],
RowBox[{"-", "\[Sigma]zt"}], "id", "gt5", "\[Sigma]yz",
RowBox[{"-", "\[Sigma]xz"}], "\[Sigma]xy", "g5", "gz5",
RowBox[{"-", "gy5"}],
RowBox[{"-", "gx"}], "gx5",
RowBox[{"-", "gy"}],
RowBox[{"-", "gz"}]},
{"g5",
RowBox[{"-", "gx5"}],
RowBox[{"-", "gy5"}],
RowBox[{"-", "gz5"}],
RowBox[{"-", "gt5"}], "id",
RowBox[{"-", "gx"}],
RowBox[{"-", "gy"}],
RowBox[{"-", "gz"}],
RowBox[{"-", "gt"}],
RowBox[{"-", "\[Sigma]zt"}], "\[Sigma]yt",
RowBox[{"-", "\[Sigma]yz"}],
RowBox[{"-", "\[Sigma]xt"}], "\[Sigma]xz",
RowBox[{"-", "\[Sigma]xy"}]},
{"gx5",
RowBox[{"-", "g5"}], "\[Sigma]zt",
RowBox[{"-", "\[Sigma]yt"}], "\[Sigma]yz", "gx",
RowBox[{"-", "id"}],
RowBox[{"-", "\[Sigma]xy"}],
RowBox[{"-", "\[Sigma]xz"}],
RowBox[{"-", "\[Sigma]xt"}], "gy5", "gz5", "gt5",
RowBox[{"-", "gt"}], "gz",
RowBox[{"-", "gy"}]},
{"gy5",
RowBox[{"-", "\[Sigma]zt"}],
RowBox[{"-", "g5"}], "\[Sigma]xt",
RowBox[{"-", "\[Sigma]xz"}], "gy", "\[Sigma]xy",
RowBox[{"-", "id"}],
RowBox[{"-", "\[Sigma]yz"}],
RowBox[{"-", "\[Sigma]yt"}],
RowBox[{"-", "gx5"}], "gt",
RowBox[{"-", "gz"}], "gz5", "gt5", "gx"},
{"gz5", "\[Sigma]yt",
RowBox[{"-", "\[Sigma]xt"}],
RowBox[{"-", "g5"}], "\[Sigma]xy", "gz", "\[Sigma]xz", "\[Sigma]yz",
RowBox[{"-", "id"}],
RowBox[{"-", "\[Sigma]zt"}],
RowBox[{"-", "gt"}],
RowBox[{"-", "gx5"}], "gy",
RowBox[{"-", "gy5"}],
RowBox[{"-", "gx"}], "gt5"},
{"gt5",
RowBox[{"-", "\[Sigma]yz"}], "\[Sigma]xz",
RowBox[{"-", "\[Sigma]xy"}],
RowBox[{"-", "g5"}], "gt", "\[Sigma]xt", "\[Sigma]yt", "\[Sigma]zt",
RowBox[{"-", "id"}], "gz",
RowBox[{"-", "gy"}],
RowBox[{"-", "gx5"}], "gx",
RowBox[{"-", "gy5"}],
RowBox[{"-", "gz5"}]},
{"\[Sigma]xy",
RowBox[{"-", "gy"}], "gx",
RowBox[{"-", "gt5"}], "gz5",
RowBox[{"-", "\[Sigma]zt"}],
RowBox[{"-", "gy5"}], "gx5",
RowBox[{"-", "gt"}], "gz",
RowBox[{"-", "id"}],
RowBox[{"-", "\[Sigma]yz"}],
RowBox[{"-", "\[Sigma]yt"}], "\[Sigma]xz", "\[Sigma]xt", "g5"},
{"\[Sigma]xz",
RowBox[{"-", "gz"}], "gt5", "gx",
RowBox[{"-", "gy5"}], "\[Sigma]yt",
RowBox[{"-", "gz5"}], "gt", "gx5",
RowBox[{"-", "gy"}], "\[Sigma]yz",
RowBox[{"-", "id"}],
RowBox[{"-", "\[Sigma]zt"}],
RowBox[{"-", "\[Sigma]xy"}],
RowBox[{"-", "g5"}], "\[Sigma]xt"},
{"\[Sigma]xt",
RowBox[{"-", "gt"}],
RowBox[{"-", "gz5"}], "gy5", "gx",
RowBox[{"-", "\[Sigma]yz"}],
RowBox[{"-", "gt5"}],
RowBox[{"-", "gz"}], "gy", "gx5", "\[Sigma]yt", "\[Sigma]zt",
RowBox[{"-", "id"}], "g5",
RowBox[{"-", "\[Sigma]xy"}],
RowBox[{"-", "\[Sigma]xz"}]},
{"\[Sigma]yz",
RowBox[{"-", "gt5"}],
RowBox[{"-", "gz"}], "gy", "gx5",
RowBox[{"-", "\[Sigma]xt"}],
RowBox[{"-", "gt"}],
RowBox[{"-", "gz5"}], "gy5", "gx",
RowBox[{"-", "\[Sigma]xz"}], "\[Sigma]xy", "g5",
RowBox[{"-", "id"}],
RowBox[{"-", "\[Sigma]zt"}], "\[Sigma]yt"},
{"\[Sigma]yt", "gz5",
RowBox[{"-", "gt"}],
RowBox[{"-", "gx5"}], "gy", "\[Sigma]xz", "gz",
RowBox[{"-", "gt5"}],
RowBox[{"-", "gx"}], "gy5",
RowBox[{"-", "\[Sigma]xt"}],
RowBox[{"-", "g5"}], "\[Sigma]xy", "\[Sigma]zt",
RowBox[{"-", "id"}],
RowBox[{"-", "\[Sigma]yz"}]},
{"\[Sigma]zt",
RowBox[{"-", "gy5"}], "gx5",
RowBox[{"-", "gt"}], "gz",
RowBox[{"-", "\[Sigma]xy"}],
RowBox[{"-", "gy"}], "gx",
RowBox[{"-", "gt5"}], "gz5", "g5",
RowBox[{"-", "\[Sigma]xt"}], "\[Sigma]xz",
RowBox[{"-", "\[Sigma]yt"}], "\[Sigma]yz",
RowBox[{"-", "id"}]}
},
GridBoxAlignment->{
"Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.7]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}],
Function[BoxForm`e$,
MatrixForm[BoxForm`e$]]]], "Output",
CellChangeTimes->{{3.694186251703266*^9, 3.6941862573246403`*^9}, {
3.69418660949746*^9, 3.694186618329227*^9}, 3.6941869746472473`*^9,
3.694187045160287*^9, 3.69418971854458*^9, 3.694192889450261*^9, {
3.694207344114737*^9, 3.694207369223531*^9}, 3.694208354449048*^9,
3.694208423183125*^9, 3.6942087205954943`*^9, 3.694208887707542*^9,
3.694211502726407*^9, 3.694211675104418*^9, 3.694211770202587*^9,
3.694212832700527*^9, 3.69421292529856*^9, 3.694213478604137*^9,
3.694214216368701*^9, 3.694214744992138*^9, 3.694214869090289*^9, {
3.694214931237383*^9, 3.6942149565897913`*^9}, 3.6942152015279818`*^9,
3.694215303248364*^9, 3.694215388866436*^9, 3.694215532359406*^9,
3.694293468220346*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["Header file Dirac.h generation", "Section",
CellChangeTimes->{{3.694208986784461*^9, 3.6942090005062523`*^9}}],
Cell["File skeleton:", "Text",
CellFrame->{{0, 0}, {0, 0.5}},
CellChangeTimes->{{3.694209131604498*^9, 3.694209133792495*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"makeHeaderCode", "[",
RowBox[{"enumCode_", ",", "funcCode_"}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"out", "=", "\"\<\>\""}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", " ", "=", " ",
RowBox[{
"out", "<>", "\[IndentingNewLine]",
"\"\<#ifndef GRID_QCD_DIRAC_H\n#define GRID_QCD_DIRAC_H\n\n// code \
generated by the Mathematica notebook gamma-gen/gamma-gen.nb\n\n#include \
<array>\n\nnamespace Grid {\nnamespace QCD {\n\nclass Gamma {\n public:\n\
\>\""}]}], ";", "\[IndentingNewLine]",
RowBox[{"out", " ", "=", " ",
RowBox[{"out", "<>", "enumCode"}]}], ";", "\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{
"out", "<>",
"\"\< static const std::array<const char *, nGamma> \
name;\n static const std::array<std::array<Algebra, nGamma>, nGamma> \
mul;\n Algebra g;\n \
public:\n Gamma(Algebra initg): g(initg) {} \n};\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"out", " ", "=",
RowBox[{"out", "<>", "funcCode"}]}], ";", "\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{
"out", "<>",
"\"\<\ninline Gamma operator*(const Gamma &g1, const Gamma &g2)\n{\n \
return Gamma(Gamma::mul[g1.g][g2.g]);\n}\n\n}}\n\n#endif\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}], "]"}]}]], "Input",
CellChangeTimes->{{3.69419645529875*^9, 3.694196727399803*^9}, {
3.694196786125751*^9, 3.694196882528638*^9}, {3.694197240621915*^9,
3.694197350313327*^9}, {3.694206801774742*^9, 3.6942068152492313`*^9}, {
3.694206953106125*^9, 3.694206955712624*^9}, 3.694207329784376*^9, {
3.694207361301278*^9, 3.694207363264554*^9}, {3.694207717624036*^9,
3.694207756242198*^9}, {3.694208382782*^9, 3.694208417198256*^9}, {
3.694208503080744*^9, 3.6942086978552227`*^9}, {3.6942113930386953`*^9,
3.694211409741232*^9}, {3.6942115367346992`*^9, 3.694211695577471*^9}, {
3.694211732616888*^9, 3.69421173594759*^9}, {3.694212824802087*^9,
3.69421282832565*^9}, {3.69421325181595*^9, 3.6942133005791903`*^9}, {
3.694214209845763*^9, 3.6942142108217773`*^9}, {3.694214621189205*^9,
3.694214647829077*^9}, {3.694214730808668*^9, 3.6942148593149223`*^9}, {
3.694214900404429*^9, 3.694214905595294*^9}, {3.6942155281289682`*^9,
3.6942155289376802`*^9}}],
Cell["Gamma enum generation:", "Text",
CellFrame->{{0, 0}, {0, 0.5}},
CellChangeTimes->{{3.694209168488991*^9, 3.6942091715073423`*^9},
3.694209215969149*^9}],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"enum", "[", "id", "]"}], "=", "\"\<Algebra::Identity\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "gx", "]"}], "=", "\"\<Algebra::GammaX\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "gy", "]"}], "=", "\"\<Algebra::GammaY\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "gz", "]"}], "=", "\"\<Algebra::GammaZ\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "gt", "]"}], "=", "\"\<Algebra::GammaT\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "g5", "]"}], "=", "\"\<Algebra::Gamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "gx5", "]"}], "=", "\"\<Algebra::GammaXGamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "gy5", "]"}], "=", "\"\<Algebra::GammaYGamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "gz5", "]"}], "=", "\"\<Algebra::GammaZGamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "gt5", "]"}], "=", "\"\<Algebra::GammaTGamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "\[Sigma]xy", "]"}], "=",
"\"\<Algebra::SigmaXY\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "\[Sigma]xz", "]"}], "=",
"\"\<Algebra::SigmaXZ\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "\[Sigma]xt", "]"}], "=",
"\"\<Algebra::SigmaXT\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "\[Sigma]yz", "]"}], "=",
"\"\<Algebra::SigmaYZ\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "\[Sigma]yt", "]"}], "=",
"\"\<Algebra::SigmaYT\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[", "\[Sigma]zt", "]"}], "=",
"\"\<Algebra::SigmaZT\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "id"}], "]"}], "=", "\"\<Algebra::MinusIdentity\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "gx"}], "]"}], "=", "\"\<Algebra::MinusGammaX\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "gy"}], "]"}], "=", "\"\<Algebra::MinusGammaY\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "gz"}], "]"}], "=", "\"\<Algebra::MinusGammaZ\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "gt"}], "]"}], "=", "\"\<Algebra::MinusGammaT\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "g5"}], "]"}], "=", "\"\<Algebra::MinusGamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "gx5"}], "]"}], "=", "\"\<Algebra::MinusGammaXGamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "gy5"}], "]"}], "=", "\"\<Algebra::MinusGammaYGamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "gz5"}], "]"}], "=", "\"\<Algebra::MinusGammaZGamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "gt5"}], "]"}], "=", "\"\<Algebra::MinusGammaTGamma5\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "\[Sigma]xy"}], "]"}], "=",
"\"\<Algebra::MinusSigmaXY\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "\[Sigma]xz"}], "]"}], "=",
"\"\<Algebra::MinusSigmaXZ\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "\[Sigma]xt"}], "]"}], "=",
"\"\<Algebra::MinusSigmaXT\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "\[Sigma]yz"}], "]"}], "=",
"\"\<Algebra::MinusSigmaYZ\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "\[Sigma]yt"}], "]"}], "=",
"\"\<Algebra::MinusSigmaYT\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"enum", "[",
RowBox[{"-", "\[Sigma]zt"}], "]"}], "=",
"\"\<Algebra::MinusSigmaZT\>\""}], ";"}]}], "Input",
CellChangeTimes->{{3.69418665896658*^9, 3.6941867305497723`*^9}, {
3.694186782865391*^9, 3.694186840513199*^9}, {3.694186889568404*^9,
3.694186968177154*^9}, {3.6941870767730503`*^9, 3.69418716300373*^9}, {
3.694213209628356*^9, 3.6942132459364033`*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"makeEnumCode", "[", "indent_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "out", "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", "=",
RowBox[{
"indent", "<>", "\"\<GRID_SERIALIZABLE_ENUM(Algebra, undef,\>\""}]}],
";", "\[IndentingNewLine]",
RowBox[{"ind", "=", "0"}], ";", "\[IndentingNewLine]",
RowBox[{"Do", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"out", "=",
RowBox[{
"out", "<>", "\"\<\\n\>\"", "<>", "indent", "<>", " ",
"\"\< \>\"", "<>",
RowBox[{"StringPadRight", "[",
RowBox[{
RowBox[{"StringTrim", "[",
RowBox[{
RowBox[{"enum", "[", "i", "]"}], ",", "\"\<Algebra::\>\""}],
"]"}], ",", "17"}], "]"}], "<>", "\"\<, \>\"", "<>",
RowBox[{"ToString", "[", "ind", "]"}]}]}], ";",
"\[IndentingNewLine]",
RowBox[{"out", " ", "=", " ",
RowBox[{"out", "<>",
RowBox[{"If", "[",
RowBox[{
RowBox[{"i", "\[Equal]",
RowBox[{"Last", "[", "alg", "]"}]}], ",",
RowBox[{
"\"\<);\\n\>\"", "<>", "indent", "<>",
"\"\<static constexpr unsigned int nGamma = \>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"ind", "+", "1"}], "]"}], "<>", "\"\<;\\n\>\""}], ",",
"\"\<,\>\"", ",", "\"\<,\>\""}], "]"}]}]}], ";",
"\[IndentingNewLine]",
RowBox[{"ind", "=",
RowBox[{"ind", "+", "1"}]}]}], ",", "\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"i", ",", "alg"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}], "]"}]}]], "Input",
CellChangeTimes->{{3.694187393082726*^9, 3.694187405147518*^9}, {
3.694187542837305*^9, 3.694187612925947*^9}, {3.694187643751446*^9,
3.694187659177355*^9}, {3.69418773039787*^9, 3.694187848150207*^9}, {
3.6941879877586403`*^9, 3.6941880928686857`*^9}, {3.694188156471807*^9,
3.694188204997113*^9}, {3.694188290260517*^9, 3.694188291135356*^9}, {
3.6941933492591*^9, 3.6941934762397633`*^9}, {3.694206335439877*^9,
3.694206371730096*^9}, {3.694206667692852*^9, 3.6942066758217916`*^9}, {
3.694206752732321*^9, 3.694206753090602*^9}, {3.6942071072527027`*^9,
3.694207214318696*^9}, {3.694211442308366*^9, 3.694211490100521*^9}, {
3.6942115668101377`*^9, 3.694211571070611*^9}, {3.6942133172135267`*^9,
3.694213325783718*^9}}],
Cell["Multiplication functions generation:", "Text",
CellFrame->{{0, 0}, {0, 0.5}},
CellChangeTimes->{{3.69420919761381*^9, 3.694209206431526*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"rhsv", "=",
RowBox[{"{",
RowBox[{
RowBox[{"rhs", "[", "0", "]"}], ",",
RowBox[{"rhs", "[", "1", "]"}], ",",
RowBox[{"rhs", "[", "2", "]"}], ",",
RowBox[{"rhs", "[", "3", "]"}]}], "}"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"vecCoef", "[",
RowBox[{"v_", "[", "i_", "]"}], "]"}], ":=",
RowBox[{
RowBox[{"ToString", "[", "v", "]"}], "<>", "\"\<(\>\"", "<>",
RowBox[{"ToString", "[", "i", "]"}], "<>",
"\"\<)\>\""}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"lmatCoef", "[",
RowBox[{"v_", "[", "i_", "]"}], "]"}], ":=",
RowBox[{
RowBox[{"ToString", "[", "v", "]"}], "<>", "\"\<(\>\"", "<>",
RowBox[{"ToString", "[", "i", "]"}], "<>",
"\"\<, i)\>\""}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"rmatCoef", "[",
RowBox[{"v_", "[", "i_", "]"}], "]"}], ":=",
RowBox[{
RowBox[{"ToString", "[", "v", "]"}], "<>", "\"\<(i, \>\"", "<>",
RowBox[{"ToString", "[", "i", "]"}], "<>",
"\"\<)\>\""}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"expr", "[",
RowBox[{"ir_", ",",
RowBox[{"rhs", "[", "i_", "]"}], ",", "strFn_"}], "]"}], ":=",
RowBox[{
RowBox[{"strFn", "[",
RowBox[{"ret", "[", "ir", "]"}], "]"}], "<>", "\"\< = \>\"", "<>", " ",
RowBox[{"strFn", "[",
RowBox[{"rhs", "[", "i", "]"}], "]"}], "<>",
"\"\<;\>\""}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"expr", "[",
RowBox[{"ir_", ",",
RowBox[{"Times", "[",
RowBox[{
RowBox[{"-", "1"}], ",",
RowBox[{"rhs", "[", "i_", "]"}]}], "]"}], ",", "strFn_"}], "]"}], ":=",
RowBox[{
RowBox[{"strFn", "[",
RowBox[{"ret", "[", "ir", "]"}], "]"}], "<>", "\"\< = -\>\"", "<>", " ",
RowBox[{"strFn", "[",
RowBox[{"rhs", "[", "i", "]"}], "]"}], "<>",
"\"\<;\>\""}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"expr", "[",
RowBox[{"ir_", ",",
RowBox[{"Times", "[",
RowBox[{
RowBox[{"Complex", " ", "[",
RowBox[{"0", ",", "1"}], "]"}], ",",
RowBox[{"rhs", "[", "i_", "]"}]}], "]"}], ",", "strFn_"}], "]"}], ":=",
RowBox[{
RowBox[{"strFn", "[",
RowBox[{"ret", "[", "ir", "]"}], "]"}], "<>", "\"\< = timesI(\>\"", "<>",
" ",
RowBox[{"strFn", "[",
RowBox[{"rhs", "[", "i", "]"}], "]"}], "<>",
"\"\<);\>\""}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"expr", "[",
RowBox[{"ir_", ",",
RowBox[{"Times", "[",
RowBox[{
RowBox[{"Complex", " ", "[",
RowBox[{"0", ",",
RowBox[{"-", "1"}]}], "]"}], ",",
RowBox[{"rhs", "[", "i_", "]"}]}], "]"}], ",", "strFn_"}], "]"}], ":=",
RowBox[{
RowBox[{"strFn", "[",
RowBox[{"ret", "[", "ir", "]"}], "]"}], "<>", "\"\< = timesMinusI(\>\"", "<>",
" ",
RowBox[{"strFn", "[",
RowBox[{"rhs", "[", "i", "]"}], "]"}], "<>",
"\"\<);\>\""}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"vecFunc", "[", "g_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"out", "=", "\"\<\>\""}], ",",
RowBox[{"ir", "=", "0"}]}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", "=",
RowBox[{
"\"\<template<class vtype>\ninline void mult\>\"", "<>",
"\[IndentingNewLine]",
RowBox[{"StringTrim", "[",
RowBox[{
RowBox[{"enum", "[", "g", "]"}], ",", "\"\<Algebra::\>\""}], "]"}],
"<>", "\[IndentingNewLine]",
"\"\<(iVector<vtype, Ns> &ret, const iVector<vtype, Ns> \
&rhs)\\n{\\n\>\""}]}], ";", "\[IndentingNewLine]",
RowBox[{"Do", "[",
RowBox[{
RowBox[{
RowBox[{"out", "=",
RowBox[{"out", "<>", "\"\< \>\"", "<>",
RowBox[{"expr", "[",
RowBox[{"ir", ",", "c", ",", "vecCoef"}], "]"}], "<>",
"\"\<\\n\>\""}]}], ";",
RowBox[{"ir", "=",
RowBox[{"ir", "+", "1"}]}]}], ",",
RowBox[{"{",
RowBox[{"c", ",",
RowBox[{
RowBox[{"mat", "[", "g", "]"}], ".", "rhsv"}]}], "}"}]}], "]"}],
";", "\[IndentingNewLine]",
RowBox[{"out", " ", "=",
RowBox[{"out", "<>", "\"\<};\\n\>\""}]}], ";", "\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"lmatFunc", "[", "g_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"out", "=", "\"\<\>\""}], ",",
RowBox[{"ir", "=", "0"}]}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", "=",
RowBox[{
"\"\<template<class vtype>\ninline void lmult\>\"", "<>",
"\[IndentingNewLine]",
RowBox[{"StringTrim", "[",
RowBox[{
RowBox[{"enum", "[", "g", "]"}], ",", "\"\<Algebra::\>\""}], "]"}], "<>",
"\[IndentingNewLine]",
"\"\<(iMatrix<vtype, Ns> &ret, const iMatrix<vtype, Ns> &rhs)\\n{\\n\>\
\"", "<>", "\[IndentingNewLine]",
"\"\< for(unsigned int i = 0; i < Ns; ++i)\\n {\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Do", "[",
RowBox[{
RowBox[{
RowBox[{"out", "=",
RowBox[{"out", "<>", "\"\< \>\"", "<>",
RowBox[{"expr", "[",
RowBox[{"ir", ",", "c", ",", "lmatCoef"}], "]"}], "<>",
"\"\<\\n\>\""}]}], ";",
RowBox[{"ir", "=",
RowBox[{"ir", "+", "1"}]}]}], ",",
RowBox[{"{",
RowBox[{"c", ",",
RowBox[{
RowBox[{"mat", "[", "g", "]"}], ".", "rhsv"}]}], "}"}]}], "]"}],
";", "\[IndentingNewLine]",
RowBox[{"out", " ", "=",
RowBox[{"out", "<>", "\"\< }\\n};\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}],
"]"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"rmatFunc", "[", "g_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"out", "=", "\"\<\>\""}], ",",
RowBox[{"ir", "=", "0"}]}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", "=",
RowBox[{
"\"\<template<class vtype>\ninline void rmult\>\"", "<>",
"\[IndentingNewLine]",
RowBox[{"StringTrim", "[",
RowBox[{
RowBox[{"enum", "[", "g", "]"}], ",", "\"\<Algebra::\>\""}], "]"}], "<>",
"\[IndentingNewLine]",
"\"\<(iMatrix<vtype, Ns> &ret, const iMatrix<vtype, Ns> &rhs)\\n{\\n\>\
\"", "<>", "\[IndentingNewLine]",
"\"\< for(unsigned int i = 0; i < Ns; ++i)\\n {\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Do", "[",
RowBox[{
RowBox[{
RowBox[{"out", "=",
RowBox[{"out", "<>", "\"\< \>\"", "<>",
RowBox[{"expr", "[",
RowBox[{"ir", ",", "c", ",", "rmatCoef"}], "]"}], "<>",
"\"\<\\n\>\""}]}], ";",
RowBox[{"ir", "=",
RowBox[{"ir", "+", "1"}]}]}], ",",
RowBox[{"{",
RowBox[{"c", ",",
RowBox[{"rhsv", ".",
RowBox[{"mat", "[", "g", "]"}]}]}], "}"}]}], "]"}], ";",
"\[IndentingNewLine]",
RowBox[{"out", " ", "=",
RowBox[{"out", "<>", "\"\< }\\n};\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}],
"]"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"allFunc", "[", "g_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"out", "=", "\"\<\>\""}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", "=",
RowBox[{"out", "<>",
RowBox[{"vecFunc", "[", "g", "]"}], "<>", "\"\<\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{"out", "<>",
RowBox[{"lmatFunc", "[", "g", "]"}], "<>", "\"\<\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{"out", "<>",
RowBox[{"rmatFunc", "[", "g", "]"}], "<>", "\"\<\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}],
"]"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"vecFinal", "[", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"out", "=", "\"\<\>\""}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
"out", "=",
"\"\<template<class vtype> \ninline auto operator*(const Gamma &G, \
const iVector<vtype, Ns> &arg)\n->typename \
std::enable_if<matchGridTensorIndex<iVector<vtype, Ns>, SpinorIndex>::value, \
iVector<vtype, Ns>>::type\n{\n iVector<vtype, Ns> ret;\n\n switch (G.g) \n \
{\n\>\""}], ";", "\[IndentingNewLine]",
RowBox[{"Do", "[",
RowBox[{
RowBox[{
RowBox[{"out", " ", "=",
RowBox[{"out", "<>", "\"\< case Gamma::\>\"", "<>",
RowBox[{"enum", "[", "g", "]"}], "<>", "\"\<:\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{"out", "<>", "\"\< mult\>\"", "<>",
RowBox[{"StringTrim", "[",
RowBox[{
RowBox[{"enum", "[", "g", "]"}], ",", "\"\<Algebra::\>\""}],
"]"}], "<>", "\"\<(ret, arg); break;\\n\>\""}]}]}], ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"g", ",", "alg"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{
"out", "<>",
"\"\< default: assert(0);\n }\n \n return ret;\n}\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}],
"]"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"lmatFinal", "[", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"out", "=", "\"\<\>\""}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
"out", "=",
"\"\<template<class vtype> \ninline auto operator*(const Gamma &G, \
const iMatrix<vtype, Ns> &arg)\n->typename \
std::enable_if<matchGridTensorIndex<iMatrix<vtype, Ns>, SpinorIndex>::value, \
iMatrix<vtype, Ns>>::type\n{\n iMatrix<vtype, Ns> ret;\n\n switch (G.g) \n \
{\n\>\""}], ";", "\[IndentingNewLine]",
RowBox[{"Do", "[",
RowBox[{
RowBox[{
RowBox[{"out", " ", "=",
RowBox[{"out", "<>", "\"\< case Gamma::\>\"", "<>",
RowBox[{"enum", "[", "g", "]"}], "<>", "\"\<:\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{"out", "<>", "\"\< lmult\>\"", "<>",
RowBox[{"StringTrim", "[",
RowBox[{
RowBox[{"enum", "[", "g", "]"}], ",", "\"\<Algebra::\>\""}],
"]"}], "<>", "\"\<(ret, arg); break;\\n\>\""}]}]}], ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"g", ",", "alg"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{
"out", "<>",
"\"\< default: assert(0);\n }\n \n return ret;\n}\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}],
"]"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"makeFuncCode", "[", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"out", "=", "\"\<\>\""}], "}"}], ",",
RowBox[{
RowBox[{"Do", "[",
RowBox[{
RowBox[{"out", "=",
RowBox[{"out", "<>",
RowBox[{"allFunc", "[", "g", "]"}]}]}], ",",
RowBox[{"{",
RowBox[{"g", ",", "alg"}], "}"}]}], "]"}], ";",
RowBox[{"Return", "[", "out", "]"}]}]}],
"]"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"rmatFinal", "[", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"out", "=", "\"\<\>\""}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
"out", "=",
"\"\<template<class vtype> \ninline auto operator*(const iMatrix<vtype, \
Ns> &arg, const Gamma &G)\n->typename \
std::enable_if<matchGridTensorIndex<iMatrix<vtype, Ns>, SpinorIndex>::value, \
iMatrix<vtype, Ns>>::type\n{\n iMatrix<vtype, Ns> ret;\n\n switch (G.g) \n \
{\n\>\""}], ";", "\[IndentingNewLine]",
RowBox[{"Do", "[",
RowBox[{
RowBox[{
RowBox[{"out", " ", "=",
RowBox[{"out", "<>", "\"\< case Gamma::\>\"", "<>",
RowBox[{"enum", "[", "g", "]"}], "<>", "\"\<:\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{"out", "<>", "\"\< rmult\>\"", "<>",
RowBox[{"StringTrim", "[",
RowBox[{
RowBox[{"enum", "[", "g", "]"}], ",", "\"\<Algebra::\>\""}],
"]"}], "<>", "\"\<(ret, arg); break;\\n\>\""}]}]}], ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"g", ",", "alg"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{
"out", "<>",
"\"\< default: assert(0);\n }\n \n return ret;\n}\\n\>\""}]}], ";",
"\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}],
"]"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"makeFuncCode", "[", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"out", "=", "\"\<\>\""}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Do", "[",
RowBox[{
RowBox[{"out", "=",
RowBox[{"out", "<>",
RowBox[{"allFunc", "[", "g", "]"}]}]}], ",",
RowBox[{"{",
RowBox[{"g", ",", "alg"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"out", "=",
RowBox[{
"out", "<>",
"\"\<\n// FIXME\n//\n// Optimisation; switch over to a \
\\\"multGammaX(ret._internal,arg._internal)\\\" style early and\n// note that \
doing so from the lattice operator will avoid copy back and case switch \
overhead, as\n// was done for the tensor math operator to remove operator * \
notation early\n//\n\n//left multiply\ntemplate<class vtype> \ninline auto \
operator*(const Gamma &G, const iScalar<vtype> &arg)\n->typename \
std::enable_if<matchGridTensorIndex<iScalar<vtype>,SpinorIndex>::notvalue,\
iScalar<vtype>>::type \n{\n iScalar<vtype> ret;\n \
ret._internal=G*arg._internal;\n return ret;\n}\n\ntemplate<class vtype,int \
N>\ninline auto operator*(const Gamma &G, const iVector<vtype, N> &arg)\n\
->typename \
std::enable_if<matchGridTensorIndex<iVector<vtype,N>,SpinorIndex>::notvalue,\
iVector<vtype,N>>::type \n{\n iVector<vtype,N> ret;\n for(int i=0;i<N;i++){\
\n ret._internal[i]=G*arg._internal[i];\n }\n return ret;\n}\n\n\
template<class vtype, int N>\ninline auto operator*(const Gamma &G, const \
iMatrix<vtype, N> &arg) \n->typename \
std::enable_if<matchGridTensorIndex<iMatrix<vtype,N>,SpinorIndex>::notvalue,\
iMatrix<vtype,N>>::type \n{\n iMatrix<vtype,N> ret;\n for(int i=0;i<N;i++){\
\n for(int j=0;j<N;j++){\n ret._internal[i][j]=G*arg._internal[i][j];\n \
}}\n return ret;\n}\n\n//right multiply\ntemplate<class vtype>\ninline auto \
operator*(const iScalar<vtype> &arg, const Gamma &G)\n->typename \
std::enable_if<matchGridTensorIndex<iScalar<vtype>,SpinorIndex>::notvalue,\
iScalar<vtype>>::type \n{\n iScalar<vtype> ret;\n \
ret._internal=arg._internal*G;\n return ret;\n}\n\ntemplate<class vtype, int \
N>\ninline auto operator * (const iMatrix<vtype, N> &arg, const Gamma &G) \n\
->typename \
std::enable_if<matchGridTensorIndex<iMatrix<vtype,N>,SpinorIndex>::notvalue,\
iMatrix<vtype,N>>::type \n{\n iMatrix<vtype,N> ret;\n for(int i=0;i<N;i++){\
\n for(int j=0;j<N;j++){\n ret._internal[i][j]=arg._internal[i][j]*G;\n \
}}\n return ret;\n}\n\n\>\"", "<>",
RowBox[{"vecFinal", "[", "]"}], "<>", "\"\<\\n\>\"", "<>",
RowBox[{"lmatFinal", "[", "]"}], "<>", "\"\<\\n\>\"", "<>",
RowBox[{"rmatFinal", "[", "]"}]}]}], ";", "\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}], "]"}]}]}], "Input",
CellChangeTimes->{{3.6941903338959*^9, 3.694190334958905*^9}, {
3.694190447518065*^9, 3.694190478462919*^9}, {3.69419063973578*^9,
3.694190653669788*^9}, {3.694190716258309*^9, 3.694190763163622*^9}, {
3.6941907963765583`*^9, 3.694190805046734*^9}, {3.69419084029659*^9,
3.694190865238916*^9}, {3.694190901904236*^9, 3.694191193971095*^9}, {
3.694191319457264*^9, 3.694191355674004*^9}, {3.694191450019418*^9,
3.694191492801243*^9}, {3.694191537908826*^9, 3.6941918755887957`*^9}, {
3.694191978131227*^9, 3.694191986666445*^9}, {3.694192020425993*^9,
3.694192167484473*^9}, {3.6941922686760483`*^9, 3.69419237821404*^9}, {
3.6941924316822777`*^9, 3.694192445274864*^9}, 3.694193521866951*^9, {
3.694206465375606*^9, 3.6942065075728807`*^9}, {3.694206554520149*^9,
3.694206587955097*^9}, {3.694206881090027*^9, 3.6942069067224293`*^9}, {
3.694207497315682*^9, 3.6942076418716516`*^9}, {3.694207790223007*^9,
3.694207989637043*^9}, {3.694208028110401*^9, 3.694208057057311*^9}, {
3.694208089863509*^9, 3.6942082975753603`*^9}, {3.694212881031795*^9,
3.694212885985661*^9}, {3.694213330227892*^9, 3.694213417940996*^9}, {
3.694214921431739*^9, 3.694214951876449*^9}, {3.6942151046483088`*^9,
3.694215118335286*^9}, {3.6942151634191313`*^9, 3.694215188429871*^9}, {
3.6942940839999113`*^9, 3.694294090686364*^9}}],
Cell["Header file generation:", "Text",
CellFrame->{{0, 0}, {0, 0.5}},
CellChangeTimes->{{3.694209229931735*^9, 3.694209240365596*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"file", "=",
RowBox[{"OpenWrite", "[", "\"\<Dirac.h\>\"", "]"}]}], ";",
RowBox[{"WriteString", "[",
RowBox[{"file", ",",
RowBox[{"makeHeaderCode", "[",
RowBox[{
RowBox[{"makeEnumCode", "[", "\"\< \>\"", "]"}], ",",
RowBox[{"makeFuncCode", "[", "]"}]}], "]"}]}], "]"}], ";",
RowBox[{"Close", "[", "file", "]"}], ";"}]], "Input",
CellChangeTimes->{{3.694207263508134*^9, 3.694207312537463*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell["Dirac.cc source file generation", "Section",
CellChangeTimes->{{3.694209250542284*^9, 3.694209266269907*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{
"out", " ", "=", " ",
"\"\<const std::array<std::array<Gamma::Algebra, Gamma::nGamma>, \
Gamma::nGamma> \nGamma::mul = {{\\n\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Do", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Do", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", "=",
RowBox[{"out", "<>",
RowBox[{"If", "[",
RowBox[{
RowBox[{"i2", "\[Equal]",
RowBox[{"First", "[", "alg", "]"}]}], ",", "\"\< {\>\"", ",",
"\"\< \>\"", ",", "\"\< \>\""}], "]"}], "\[IndentingNewLine]",
"<>", "\"\<Gamma::\>\"", "<>",
RowBox[{"enum", "[",
RowBox[{"i1", ".", "i2"}], "]"}], "<>",
RowBox[{"If", "[",
RowBox[{
RowBox[{"i2", "\[Equal]",
RowBox[{"Last", "[", "alg", "]"}]}], ",", "\"\<}\>\"", ",",
"\"\<\>\"", ",", "\"\<\>\""}], "]"}], "\[IndentingNewLine]", "<>",
RowBox[{"If", "[",
RowBox[{
RowBox[{"i2", "\[Equal]",
RowBox[{"Last", "[", "alg", "]"}]}], ",",
RowBox[{"If", "[",
RowBox[{
RowBox[{"i1", "\[Equal]",
RowBox[{"Last", "[", "alg", "]"}]}], ",", "\"\<\>\"", ",",
"\"\<\\n ,\\n\>\"", ",", "\"\<\\n ,\\n\>\""}], "]"}], ",",
"\"\<,\\n\>\"", ",", "\"\<,\\n\>\""}], "]"}]}]}], ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"i2", ",", "alg"}], "}"}]}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"i1", ",", "alg"}], "}"}]}], "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", "=",
RowBox[{"out", "<>", "\"\<\\n}};\>\""}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"file", "=",
RowBox[{"OpenWrite", "[", "\"\<GammaMulTable.h\>\"", "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"WriteString", "[",
RowBox[{"file", ",", "out"}], "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Close", "[", "file", "]"}], ";"}]}], "Input",
CellChangeTimes->{{3.694188457712205*^9, 3.694188459081934*^9}, {
3.694188583199066*^9, 3.694188690803248*^9}, {3.6941887378127832`*^9,
3.6941889049946423`*^9}, {3.694188939559833*^9, 3.6941889419840307`*^9}, {
3.694189004894498*^9, 3.694189029210237*^9}, 3.694189123631489*^9, {
3.694189184854504*^9, 3.694189212219471*^9}, {3.694189278607349*^9,
3.694189315273435*^9}, {3.694189367213715*^9, 3.694189508102169*^9}, {
3.694189592594305*^9, 3.69418967222689*^9}, {3.69418976988986*^9,
3.694189793142088*^9}, {3.6941898310221663`*^9, 3.694189833288706*^9}, {
3.694189898235135*^9, 3.694189929506019*^9}, 3.6941900145565357`*^9, {
3.694190119264579*^9, 3.694190161822473*^9}, {3.694209485052578*^9,
3.6942094865108747`*^9}, {3.694211744604581*^9, 3.6942117644193983`*^9}, {
3.694211794987585*^9, 3.694211795663188*^9}, 3.694213436760853*^9, {
3.6942134707645893`*^9, 3.69421347411766*^9}, {3.694215381435295*^9,
3.694215385261436*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"makeSourceCode", "[", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"out", "=", "\"\<\>\""}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", " ", "=", " ",
RowBox[{
"out", "<>", "\[IndentingNewLine]",
"\"\<#include <Grid.h>\n\nnamespace Grid {\nnamespace QCD {\n\n\
#include \\\"GammaMulTable.h\\\"\n\nconst std::array<const char *, \
Gamma::nGamma> Gamma::name = {{\n\>\""}]}], ";", "\[IndentingNewLine]",
RowBox[{"Do", "[",
RowBox[{
RowBox[{"out", " ", "=", " ",
RowBox[{"out", "<>", "\"\< \\\"\>\"", "<>", "\[IndentingNewLine]",
RowBox[{"StringPadRight", "[",
RowBox[{
RowBox[{"StringTrim", "[",
RowBox[{
RowBox[{"StringReplace", "[",
RowBox[{
RowBox[{"enum", "[", "g", "]"}], ",",
RowBox[{"\"\<Minus\>\"", "\[Rule]", "\"\<-\>\""}]}], "]"}],
",", "\"\<Algebra::\>\""}], "]"}], ",", "13"}], "]"}], "<>",
"\[IndentingNewLine]", "\"\<\\\"\>\"", "<>", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"g", "\[Equal]",
RowBox[{"Last", "[", "alg", "]"}]}], ",", "\"\<}};\\n\>\"", ",",
"\"\<,\\n\>\"", ",", "\"\<,\\n\>\""}], "]"}]}]}], ",",
RowBox[{"{",
RowBox[{"g", ",", "alg"}], "}"}]}], "]"}], ";",
"\[IndentingNewLine]",
RowBox[{"out", " ", "=",
RowBox[{"out", "<>", "\"\<\n}}\n\>\""}]}], ";", "\[IndentingNewLine]",
RowBox[{"Return", "[", "out", "]"}]}]}], "]"}]}],
"\[IndentingNewLine]"}]], "Input",
CellChangeTimes->{{3.69421121373662*^9, 3.694211248473432*^9}, {
3.6942118524105463`*^9, 3.694211892664316*^9}, {3.69421196260581*^9,
3.69421202215168*^9}, {3.69421216516626*^9, 3.694212368624585*^9}, {
3.694212488334324*^9, 3.694212500692437*^9}, 3.6942134310746183`*^9, {
3.694215284859365*^9, 3.694215285515815*^9}, {3.694215368213806*^9,
3.69421537607312*^9}, {3.694215508990799*^9, 3.694215509814066*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"file", "=",
RowBox[{"OpenWrite", "[", "\"\<Dirac.cc\>\"", "]"}]}], ";",
RowBox[{"WriteString", "[",
RowBox[{"file", ",",
RowBox[{"makeSourceCode", "[", "]"}]}], "]"}], ";",
RowBox[{"Close", "[", "file", "]"}], ";"}]], "Input",
CellChangeTimes->{{3.694212294084733*^9, 3.694212304244363*^9}, {
3.6942124200138683`*^9, 3.694212434840803*^9}}]
}, Open ]]
},
WindowSize->{1246, 1005},
WindowMargins->{{213, Automatic}, {Automatic, 0}},
FrontEndVersion->"11.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (September \
21, 2016)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 1295, 18, 502, "Text"],
Cell[CellGroupData[{
Cell[1878, 42, 393, 8, 75, "Input"],
Cell[2274, 52, 680, 10, 32, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[2991, 67, 114, 1, 64, "Section"],
Cell[3108, 70, 475, 14, 54, "Input"],
Cell[3586, 86, 139, 1, 30, "Text"],
Cell[3728, 89, 5454, 168, 427, "Input"],
Cell[CellGroupData[{
Cell[9207, 261, 547, 16, 54, "Input"],
Cell[9757, 279, 820, 23, 92, "Output"],
Cell[10580, 304, 1245, 31, 92, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[11862, 340, 448, 12, 54, "Input"],
Cell[12313, 354, 1028, 31, 96, "Output"],
Cell[13344, 387, 1030, 31, 96, "Output"]
}, Open ]],
Cell[14389, 421, 119, 1, 30, "Text"],
Cell[14511, 424, 1295, 41, 96, "Input"],
Cell[15809, 467, 133, 1, 30, "Text"],
Cell[CellGroupData[{
Cell[15967, 472, 479, 15, 32, "Input"],
Cell[16449, 489, 1285, 29, 96, "Output"]
}, Open ]],
Cell[17749, 521, 110, 1, 30, "Text"],
Cell[CellGroupData[{
Cell[17884, 526, 476, 12, 32, "Input"],
Cell[18363, 540, 6339, 161, 312, "Output"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[24751, 707, 117, 1, 64, "Section"],
Cell[24871, 710, 128, 2, 38, "Text"],
Cell[25002, 714, 2518, 48, 747, "Input"],
Cell[27523, 764, 164, 3, 38, "Text"],
Cell[27690, 769, 4876, 148, 684, "Input"],
Cell[32569, 919, 2588, 55, 201, "Input"],
Cell[35160, 976, 149, 2, 38, "Text"],
Cell[35312, 980, 17242, 426, 3456, "Input"],
Cell[52557, 1408, 137, 2, 38, "Text"],
Cell[52697, 1412, 468, 11, 32, "Input"]
}, Open ]],
Cell[CellGroupData[{
Cell[53202, 1428, 116, 1, 64, "Section"],
Cell[53321, 1431, 3046, 66, 285, "Input"],
Cell[56370, 1499, 2179, 48, 432, "Input"],
Cell[58552, 1549, 397, 9, 32, "Input"]
}, Open ]]
}
]
*)