From a37e71f362acb3abc17b342da358b07a1c51d456 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 23 Jan 2017 19:13:43 -0800 Subject: [PATCH 01/10] New automatic implementation of gamma matrices, Meson and SeqGamma are broken --- benchmarks/Benchmark_dwf.cc | 12 +- benchmarks/Benchmark_dwf_sweep.cc | 10 +- benchmarks/Benchmark_wilson.cc | 14 +- benchmarks/Benchmark_wilson_sweep.cc | 10 +- extras/Hadrons/Modules/MContraction/Meson.hpp | 4 +- extras/Hadrons/Modules/MSource/SeqGamma.hpp | 2 +- lib/qcd/action/fermion/WilsonFermion.cc | 10 +- lib/qcd/action/fermion/WilsonFermion5D.cc | 20 +- lib/qcd/action/fermion/g5HermitianLinop.h | 2 +- lib/qcd/spin/Dirac.cc | 125 +- lib/qcd/spin/Dirac.h | 2003 ++++++++++++----- lib/qcd/spin/GammaMulTable.h | 1058 +++++++++ lib/qcd/spin/gamma-gen/gamma-gen.nb | 1457 ++++++++++++ lib/qcd/utils/LinalgUtils.h | 10 +- scripts/filelist | 4 +- tests/Test_cayley_even_odd_vec.cc | 14 +- tests/Test_dwf_mixedcg_prec.cc | 10 +- tests/core/Test_cf_coarsen_support.cc | 10 +- tests/core/Test_checker.cc | 10 +- tests/core/Test_contfrac_even_odd.cc | 10 +- tests/core/Test_dwf_even_odd.cc | 10 +- tests/core/Test_dwf_rb5d.cc | 10 +- tests/core/Test_fft.cc | 18 +- tests/core/Test_gamma.cc | 22 +- tests/core/Test_wilson_even_odd.cc | 10 +- tests/core/Test_wilson_tm_even_odd.cc | 10 +- tests/debug/Test_cayley_cg.cc | 10 +- tests/debug/Test_cayley_coarsen_support.cc | 10 +- tests/debug/Test_cayley_even_odd.cc | 10 +- tests/solver/Test_cf_cr_unprec.cc | 10 +- tests/solver/Test_contfrac_cg.cc | 10 +- tests/solver/Test_dwf_cg_prec.cc | 4 +- tests/solver/Test_dwf_cg_schur.cc | 10 +- tests/solver/Test_dwf_cg_unprec.cc | 10 +- tests/solver/Test_dwf_cr_unprec.cc | 10 +- tests/solver/Test_dwf_fpgcr.cc | 10 +- tests/solver/Test_dwf_hdcr.cc | 2 +- tests/solver/Test_wilson_cg_prec.cc | 10 +- tests/solver/Test_wilson_cg_schur.cc | 10 +- tests/solver/Test_wilson_cg_unprec.cc | 10 +- tests/solver/Test_wilson_cr_unprec.cc | 10 +- 41 files changed, 4129 insertions(+), 882 deletions(-) create mode 100644 lib/qcd/spin/GammaMulTable.h create mode 100644 lib/qcd/spin/gamma-gen/gamma-gen.nb diff --git a/benchmarks/Benchmark_dwf.cc b/benchmarks/Benchmark_dwf.cc index 10e4521b..753cd60f 100644 --- a/benchmarks/Benchmark_dwf.cc +++ b/benchmarks/Benchmark_dwf.cc @@ -37,11 +37,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; typedef WilsonFermion5D WilsonFermion5DR; @@ -321,7 +321,7 @@ int main (int argc, char ** argv) ref = zero; for(int mu=0;mu & L, int Ls, int threads, int report =0 ); diff --git a/benchmarks/Benchmark_wilson.cc b/benchmarks/Benchmark_wilson.cc index 4930713c..11f1353f 100644 --- a/benchmarks/Benchmark_wilson.cc +++ b/benchmarks/Benchmark_wilson.cc @@ -37,11 +37,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; bool overlapComms = false; @@ -106,7 +106,7 @@ int main (int argc, char ** argv) { // Naive wilson implementation ref = zero; for(int mu=0;mu::execute(void) std::vector buf; Result result; - g5 = makeGammaProd(Ns*Ns - 1); + //g5 = makeGammaProd(Ns*Ns - 1); result.corr.resize(Ns*Ns); for (unsigned int i = 0; i < Ns*Ns; ++i) { - g[i] = makeGammaProd(i); + //g[i] = makeGammaProd(i); } for (unsigned int iSink = 0; iSink < Ns*Ns; ++iSink) { diff --git a/extras/Hadrons/Modules/MSource/SeqGamma.hpp b/extras/Hadrons/Modules/MSource/SeqGamma.hpp index 611b0108..f336f6ea 100644 --- a/extras/Hadrons/Modules/MSource/SeqGamma.hpp +++ b/extras/Hadrons/Modules/MSource/SeqGamma.hpp @@ -144,7 +144,7 @@ void TSeqGamma::execute(void) std::vector p; Complex i(0.0,1.0); - g = makeGammaProd(par().gamma); + //g = makeGammaProd(par().gamma); p = strToVec(par().mom); ph = zero; for(unsigned int mu = 0; mu < env().getNd(); mu++) diff --git a/lib/qcd/action/fermion/WilsonFermion.cc b/lib/qcd/action/fermion/WilsonFermion.cc index 04c3671f..acf60a8b 100644 --- a/lib/qcd/action/fermion/WilsonFermion.cc +++ b/lib/qcd/action/fermion/WilsonFermion.cc @@ -149,11 +149,11 @@ void WilsonFermion::MeooeDag(const FermionField &in, FermionField &out) { typedef Lattice > LatComplex; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; std::vector latt_size = _grid->_fdimensions; diff --git a/lib/qcd/action/fermion/WilsonFermion5D.cc b/lib/qcd/action/fermion/WilsonFermion5D.cc index d70c98c3..944b3290 100644 --- a/lib/qcd/action/fermion/WilsonFermion5D.cc +++ b/lib/qcd/action/fermion/WilsonFermion5D.cc @@ -503,11 +503,11 @@ void WilsonFermion5D::MomentumSpacePropagatorHt(FermionField &out,const Fe typedef iSinglet Tcomplex; typedef Lattice > LatComplex; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; std::vector latt_size = _grid->_fdimensions; @@ -574,11 +574,11 @@ void WilsonFermion5D::MomentumSpacePropagatorHt(FermionField &out,const Fe template void WilsonFermion5D::MomentumSpacePropagatorHw(FermionField &out,const FermionField &in,RealD mass) { - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; GridBase *_grid = _FourDimGrid; diff --git a/lib/qcd/action/fermion/g5HermitianLinop.h b/lib/qcd/action/fermion/g5HermitianLinop.h index af23c36f..cca7a113 100644 --- a/lib/qcd/action/fermion/g5HermitianLinop.h +++ b/lib/qcd/action/fermion/g5HermitianLinop.h @@ -80,7 +80,7 @@ class Gamma5HermitianLinearOperator : public LinearOperatorBase { Matrix &_Mat; Gamma g5; public: - Gamma5HermitianLinearOperator(Matrix &Mat): _Mat(Mat), g5(Gamma::Gamma5) {}; + Gamma5HermitianLinearOperator(Matrix &Mat): _Mat(Mat), g5(Gamma::Algebra::Gamma5) {}; void Op (const Field &in, Field &out){ HermOp(in,out); } diff --git a/lib/qcd/spin/Dirac.cc b/lib/qcd/spin/Dirac.cc index 8279a4a7..98dff14a 100644 --- a/lib/qcd/spin/Dirac.cc +++ b/lib/qcd/spin/Dirac.cc @@ -1,95 +1,42 @@ - /************************************************************************************* - - Grid physics library, www.github.com/paboyle/Grid - - Source file: ./lib/qcd/spin/Dirac.cc - - Copyright (C) 2015 - -Author: Peter Boyle - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - See the full license in the file "LICENSE" in the top level distribution directory - *************************************************************************************/ - /* END LEGAL */ #include namespace Grid { +namespace QCD { - namespace QCD { +#include "GammaMulTable.h" - Gamma::GammaMatrix Gamma::GammaMatrices [] = { - Gamma::Identity, - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT, - Gamma::Gamma5, - Gamma::MinusIdentity, - Gamma::MinusGammaX, - Gamma::MinusGammaY, - Gamma::MinusGammaZ, - Gamma::MinusGammaT, - Gamma::MinusGamma5 - }; - const char *Gamma::GammaMatrixNames[] = { - "Identity ", - "GammaX ", - "GammaY ", - "GammaZ ", - "GammaT ", - "Gamma5 ", - "-Identity", - "-GammaX ", - "-GammaY ", - "-GammaZ ", - "-GammaT ", - "-Gamma5 ", - " " - }; - - SpinMatrix makeGammaProd(const unsigned int i) - { - SpinMatrix g; - - g = 1.; - if (i & 0x1) - { - g = g*Gamma(Gamma::GammaMatrix::GammaX); - } - if (i & 0x2) - { - g = g*Gamma(Gamma::GammaMatrix::GammaY); - } - if (i & 0x4) - { - g = g*Gamma(Gamma::GammaMatrix::GammaZ); - } - if (i & 0x8) - { - g = g*Gamma(Gamma::GammaMatrix::GammaT); - } - - return g; - } +const std::array Gamma::name = {{ + "-Gamma5 ", + "Gamma5 ", + "-GammaT ", + "GammaT ", + "-GammaTGamma5", + "GammaTGamma5 ", + "-GammaX ", + "GammaX ", + "-GammaXGamma5", + "GammaXGamma5 ", + "-GammaY ", + "GammaY ", + "-GammaYGamma5", + "GammaYGamma5 ", + "-GammaZ ", + "GammaZ ", + "-GammaZGamma5", + "GammaZGamma5 ", + "-Identity ", + "Identity ", + "-SigmaXT ", + "SigmaXT ", + "-SigmaXY ", + "SigmaXY ", + "-SigmaXZ ", + "SigmaXZ ", + "-SigmaYT ", + "SigmaYT ", + "-SigmaYZ ", + "SigmaYZ ", + "-SigmaZT ", + "SigmaZT "}}; - // void sprojMul( vHalfSpinColourVector &out,vColourMatrix &u, vSpinColourVector &in){ - // vHalfSpinColourVector hspin; - // spProjXp(hspin,in); - // mult(&out,&u,&hspin); - // } - } -} +}} diff --git a/lib/qcd/spin/Dirac.h b/lib/qcd/spin/Dirac.h index 00bd519c..1dd87cfc 100644 --- a/lib/qcd/spin/Dirac.h +++ b/lib/qcd/spin/Dirac.h @@ -1,628 +1,1413 @@ - /************************************************************************************* - - Grid physics library, www.github.com/paboyle/Grid - - Source file: ./lib/qcd/spin/Dirac.h - - Copyright (C) 2015 - -Author: Peter Boyle -Author: Peter Boyle - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - See the full license in the file "LICENSE" in the top level distribution directory - *************************************************************************************/ - /* END LEGAL */ #ifndef GRID_QCD_DIRAC_H #define GRID_QCD_DIRAC_H -namespace Grid{ +// code generated by the Mathematica notebook gamma-gen/gamma-gen.nb + +#include + +namespace Grid { namespace QCD { - - class Gamma { - +class Gamma { public: + GRID_SERIALIZABLE_ENUM(Algebra, undef, + MinusGamma5 , 0, + Gamma5 , 1, + MinusGammaT , 2, + GammaT , 3, + MinusGammaTGamma5, 4, + GammaTGamma5 , 5, + MinusGammaX , 6, + GammaX , 7, + MinusGammaXGamma5, 8, + GammaXGamma5 , 9, + MinusGammaY , 10, + GammaY , 11, + MinusGammaYGamma5, 12, + GammaYGamma5 , 13, + MinusGammaZ , 14, + GammaZ , 15, + MinusGammaZGamma5, 16, + GammaZGamma5 , 17, + MinusIdentity , 18, + Identity , 19, + MinusSigmaXT , 20, + SigmaXT , 21, + MinusSigmaXY , 22, + SigmaXY , 23, + MinusSigmaXZ , 24, + SigmaXZ , 25, + MinusSigmaYT , 26, + SigmaYT , 27, + MinusSigmaYZ , 28, + SigmaYZ , 29, + MinusSigmaZT , 30, + SigmaZT , 31); + static constexpr unsigned int nGamma = 32; + static const std::array name; + static const std::array, nGamma> mul; + Algebra g; + public: + Gamma(Algebra initg): g(initg) {} +}; +template +inline void multMinusGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = -rhs(0); + ret(1) = -rhs(1); + ret(2) = rhs(2); + ret(3) = rhs(3); +}; - const int Ns=4; - - enum GammaMatrix { - Identity, - GammaX, - GammaY, - GammaZ, - GammaT, - Gamma5, - MinusIdentity, - MinusGammaX, - MinusGammaY, - MinusGammaZ, - MinusGammaT, - MinusGamma5 - // GammaXGamma5, // Rest are composite (willing to take hit for two calls sequentially) - // GammaYGamma5, // as they are less commonly used. - // GammaZGamma5, - // GammaTGamma5, - // SigmaXY, - // SigmaXZ, - // SigmaYZ, - // SigmaXT, - // SigmaYT, - // SigmaZT, - // MinusGammaXGamma5, easiest to form by composition - // MinusGammaYGamma5, as performance is not critical for these - // MinusGammaZGamma5, - // MinusGammaTGamma5, - // MinusSigmaXY, - // MinusSigmaXZ, - // MinusSigmaYZ, - // MinusSigmaXT, - // MinusSigmaYT, - // MinusSigmaZT - }; - - static GammaMatrix GammaMatrices[]; - static const char *GammaMatrixNames[]; +template +inline void lmultMinusGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = -rhs(0, i); + ret(1, i) = -rhs(1, i); + ret(2, i) = rhs(2, i); + ret(3, i) = rhs(3, i); + } +}; - Gamma (GammaMatrix g) { _g=g; } +template +inline void rmultMinusGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = -rhs(i, 0); + ret(i, 1) = -rhs(i, 1); + ret(i, 2) = rhs(i, 2); + ret(i, 3) = rhs(i, 3); + } +}; - GammaMatrix _g; +template +inline void multGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = rhs(0); + ret(1) = rhs(1); + ret(2) = -rhs(2); + ret(3) = -rhs(3); +}; - }; +template +inline void lmultGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = rhs(0, i); + ret(1, i) = rhs(1, i); + ret(2, i) = -rhs(2, i); + ret(3, i) = -rhs(3, i); + } +}; + +template +inline void rmultGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = rhs(i, 0); + ret(i, 1) = rhs(i, 1); + ret(i, 2) = -rhs(i, 2); + ret(i, 3) = -rhs(i, 3); + } +}; + +template +inline void multMinusGammaT(iVector &ret, const iVector &rhs) +{ + ret(0) = -rhs(2); + ret(1) = -rhs(3); + ret(2) = -rhs(0); + ret(3) = -rhs(1); +}; + +template +inline void lmultMinusGammaT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = -rhs(2, i); + ret(1, i) = -rhs(3, i); + ret(2, i) = -rhs(0, i); + ret(3, i) = -rhs(1, i); + } +}; + +template +inline void rmultMinusGammaT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = -rhs(i, 2); + ret(i, 1) = -rhs(i, 3); + ret(i, 2) = -rhs(i, 0); + ret(i, 3) = -rhs(i, 1); + } +}; + +template +inline void multGammaT(iVector &ret, const iVector &rhs) +{ + ret(0) = rhs(2); + ret(1) = rhs(3); + ret(2) = rhs(0); + ret(3) = rhs(1); +}; + +template +inline void lmultGammaT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = rhs(2, i); + ret(1, i) = rhs(3, i); + ret(2, i) = rhs(0, i); + ret(3, i) = rhs(1, i); + } +}; + +template +inline void rmultGammaT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = rhs(i, 2); + ret(i, 1) = rhs(i, 3); + ret(i, 2) = rhs(i, 0); + ret(i, 3) = rhs(i, 1); + } +}; + +template +inline void multMinusGammaTGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = rhs(2); + ret(1) = rhs(3); + ret(2) = -rhs(0); + ret(3) = -rhs(1); +}; + +template +inline void lmultMinusGammaTGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = rhs(2, i); + ret(1, i) = rhs(3, i); + ret(2, i) = -rhs(0, i); + ret(3, i) = -rhs(1, i); + } +}; + +template +inline void rmultMinusGammaTGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = rhs(i, 2); + ret(i, 1) = rhs(i, 3); + ret(i, 2) = -rhs(i, 0); + ret(i, 3) = -rhs(i, 1); + } +}; + +template +inline void multGammaTGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = -rhs(2); + ret(1) = -rhs(3); + ret(2) = rhs(0); + ret(3) = rhs(1); +}; + +template +inline void lmultGammaTGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = -rhs(2, i); + ret(1, i) = -rhs(3, i); + ret(2, i) = rhs(0, i); + ret(3, i) = rhs(1, i); + } +}; + +template +inline void rmultGammaTGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = -rhs(i, 2); + ret(i, 1) = -rhs(i, 3); + ret(i, 2) = rhs(i, 0); + ret(i, 3) = rhs(i, 1); + } +}; + +template +inline void multMinusGammaX(iVector &ret, const iVector &rhs) +{ + ret(0) = timesMinusI(rhs(3)); + ret(1) = timesMinusI(rhs(2)); + ret(2) = timesI(rhs(1)); + ret(3) = timesI(rhs(0)); +}; + +template +inline void lmultMinusGammaX(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesMinusI(rhs(3, i)); + ret(1, i) = timesMinusI(rhs(2, i)); + ret(2, i) = timesI(rhs(1, i)); + ret(3, i) = timesI(rhs(0, i)); + } +}; + +template +inline void rmultMinusGammaX(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesMinusI(rhs(i, 3)); + ret(i, 1) = timesMinusI(rhs(i, 2)); + ret(i, 2) = timesI(rhs(i, 1)); + ret(i, 3) = timesI(rhs(i, 0)); + } +}; + +template +inline void multGammaX(iVector &ret, const iVector &rhs) +{ + ret(0) = timesI(rhs(3)); + ret(1) = timesI(rhs(2)); + ret(2) = timesMinusI(rhs(1)); + ret(3) = timesMinusI(rhs(0)); +}; + +template +inline void lmultGammaX(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesI(rhs(3, i)); + ret(1, i) = timesI(rhs(2, i)); + ret(2, i) = timesMinusI(rhs(1, i)); + ret(3, i) = timesMinusI(rhs(0, i)); + } +}; + +template +inline void rmultGammaX(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesI(rhs(i, 3)); + ret(i, 1) = timesI(rhs(i, 2)); + ret(i, 2) = timesMinusI(rhs(i, 1)); + ret(i, 3) = timesMinusI(rhs(i, 0)); + } +}; + +template +inline void multMinusGammaXGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = timesI(rhs(3)); + ret(1) = timesI(rhs(2)); + ret(2) = timesI(rhs(1)); + ret(3) = timesI(rhs(0)); +}; + +template +inline void lmultMinusGammaXGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesI(rhs(3, i)); + ret(1, i) = timesI(rhs(2, i)); + ret(2, i) = timesI(rhs(1, i)); + ret(3, i) = timesI(rhs(0, i)); + } +}; + +template +inline void rmultMinusGammaXGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesI(rhs(i, 3)); + ret(i, 1) = timesI(rhs(i, 2)); + ret(i, 2) = timesI(rhs(i, 1)); + ret(i, 3) = timesI(rhs(i, 0)); + } +}; + +template +inline void multGammaXGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = timesMinusI(rhs(3)); + ret(1) = timesMinusI(rhs(2)); + ret(2) = timesMinusI(rhs(1)); + ret(3) = timesMinusI(rhs(0)); +}; + +template +inline void lmultGammaXGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesMinusI(rhs(3, i)); + ret(1, i) = timesMinusI(rhs(2, i)); + ret(2, i) = timesMinusI(rhs(1, i)); + ret(3, i) = timesMinusI(rhs(0, i)); + } +}; + +template +inline void rmultGammaXGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesMinusI(rhs(i, 3)); + ret(i, 1) = timesMinusI(rhs(i, 2)); + ret(i, 2) = timesMinusI(rhs(i, 1)); + ret(i, 3) = timesMinusI(rhs(i, 0)); + } +}; + +template +inline void multMinusGammaY(iVector &ret, const iVector &rhs) +{ + ret(0) = rhs(3); + ret(1) = -rhs(2); + ret(2) = -rhs(1); + ret(3) = rhs(0); +}; + +template +inline void lmultMinusGammaY(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = rhs(3, i); + ret(1, i) = -rhs(2, i); + ret(2, i) = -rhs(1, i); + ret(3, i) = rhs(0, i); + } +}; + +template +inline void rmultMinusGammaY(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = rhs(i, 3); + ret(i, 1) = -rhs(i, 2); + ret(i, 2) = -rhs(i, 1); + ret(i, 3) = rhs(i, 0); + } +}; + +template +inline void multGammaY(iVector &ret, const iVector &rhs) +{ + ret(0) = -rhs(3); + ret(1) = rhs(2); + ret(2) = rhs(1); + ret(3) = -rhs(0); +}; + +template +inline void lmultGammaY(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = -rhs(3, i); + ret(1, i) = rhs(2, i); + ret(2, i) = rhs(1, i); + ret(3, i) = -rhs(0, i); + } +}; + +template +inline void rmultGammaY(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = -rhs(i, 3); + ret(i, 1) = rhs(i, 2); + ret(i, 2) = rhs(i, 1); + ret(i, 3) = -rhs(i, 0); + } +}; + +template +inline void multMinusGammaYGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = -rhs(3); + ret(1) = rhs(2); + ret(2) = -rhs(1); + ret(3) = rhs(0); +}; + +template +inline void lmultMinusGammaYGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = -rhs(3, i); + ret(1, i) = rhs(2, i); + ret(2, i) = -rhs(1, i); + ret(3, i) = rhs(0, i); + } +}; + +template +inline void rmultMinusGammaYGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = -rhs(i, 3); + ret(i, 1) = rhs(i, 2); + ret(i, 2) = -rhs(i, 1); + ret(i, 3) = rhs(i, 0); + } +}; + +template +inline void multGammaYGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = rhs(3); + ret(1) = -rhs(2); + ret(2) = rhs(1); + ret(3) = -rhs(0); +}; + +template +inline void lmultGammaYGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = rhs(3, i); + ret(1, i) = -rhs(2, i); + ret(2, i) = rhs(1, i); + ret(3, i) = -rhs(0, i); + } +}; + +template +inline void rmultGammaYGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = rhs(i, 3); + ret(i, 1) = -rhs(i, 2); + ret(i, 2) = rhs(i, 1); + ret(i, 3) = -rhs(i, 0); + } +}; + +template +inline void multMinusGammaZ(iVector &ret, const iVector &rhs) +{ + ret(0) = timesMinusI(rhs(2)); + ret(1) = timesI(rhs(3)); + ret(2) = timesI(rhs(0)); + ret(3) = timesMinusI(rhs(1)); +}; + +template +inline void lmultMinusGammaZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesMinusI(rhs(2, i)); + ret(1, i) = timesI(rhs(3, i)); + ret(2, i) = timesI(rhs(0, i)); + ret(3, i) = timesMinusI(rhs(1, i)); + } +}; + +template +inline void rmultMinusGammaZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesMinusI(rhs(i, 2)); + ret(i, 1) = timesI(rhs(i, 3)); + ret(i, 2) = timesI(rhs(i, 0)); + ret(i, 3) = timesMinusI(rhs(i, 1)); + } +}; + +template +inline void multGammaZ(iVector &ret, const iVector &rhs) +{ + ret(0) = timesI(rhs(2)); + ret(1) = timesMinusI(rhs(3)); + ret(2) = timesMinusI(rhs(0)); + ret(3) = timesI(rhs(1)); +}; + +template +inline void lmultGammaZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesI(rhs(2, i)); + ret(1, i) = timesMinusI(rhs(3, i)); + ret(2, i) = timesMinusI(rhs(0, i)); + ret(3, i) = timesI(rhs(1, i)); + } +}; + +template +inline void rmultGammaZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesI(rhs(i, 2)); + ret(i, 1) = timesMinusI(rhs(i, 3)); + ret(i, 2) = timesMinusI(rhs(i, 0)); + ret(i, 3) = timesI(rhs(i, 1)); + } +}; + +template +inline void multMinusGammaZGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = timesI(rhs(2)); + ret(1) = timesMinusI(rhs(3)); + ret(2) = timesI(rhs(0)); + ret(3) = timesMinusI(rhs(1)); +}; + +template +inline void lmultMinusGammaZGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesI(rhs(2, i)); + ret(1, i) = timesMinusI(rhs(3, i)); + ret(2, i) = timesI(rhs(0, i)); + ret(3, i) = timesMinusI(rhs(1, i)); + } +}; + +template +inline void rmultMinusGammaZGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesI(rhs(i, 2)); + ret(i, 1) = timesMinusI(rhs(i, 3)); + ret(i, 2) = timesI(rhs(i, 0)); + ret(i, 3) = timesMinusI(rhs(i, 1)); + } +}; + +template +inline void multGammaZGamma5(iVector &ret, const iVector &rhs) +{ + ret(0) = timesMinusI(rhs(2)); + ret(1) = timesI(rhs(3)); + ret(2) = timesMinusI(rhs(0)); + ret(3) = timesI(rhs(1)); +}; + +template +inline void lmultGammaZGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesMinusI(rhs(2, i)); + ret(1, i) = timesI(rhs(3, i)); + ret(2, i) = timesMinusI(rhs(0, i)); + ret(3, i) = timesI(rhs(1, i)); + } +}; + +template +inline void rmultGammaZGamma5(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesMinusI(rhs(i, 2)); + ret(i, 1) = timesI(rhs(i, 3)); + ret(i, 2) = timesMinusI(rhs(i, 0)); + ret(i, 3) = timesI(rhs(i, 1)); + } +}; + +template +inline void multMinusIdentity(iVector &ret, const iVector &rhs) +{ + ret(0) = -rhs(0); + ret(1) = -rhs(1); + ret(2) = -rhs(2); + ret(3) = -rhs(3); +}; + +template +inline void lmultMinusIdentity(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = -rhs(0, i); + ret(1, i) = -rhs(1, i); + ret(2, i) = -rhs(2, i); + ret(3, i) = -rhs(3, i); + } +}; + +template +inline void rmultMinusIdentity(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = -rhs(i, 0); + ret(i, 1) = -rhs(i, 1); + ret(i, 2) = -rhs(i, 2); + ret(i, 3) = -rhs(i, 3); + } +}; + +template +inline void multIdentity(iVector &ret, const iVector &rhs) +{ + ret(0) = rhs(0); + ret(1) = rhs(1); + ret(2) = rhs(2); + ret(3) = rhs(3); +}; + +template +inline void lmultIdentity(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = rhs(0, i); + ret(1, i) = rhs(1, i); + ret(2, i) = rhs(2, i); + ret(3, i) = rhs(3, i); + } +}; + +template +inline void rmultIdentity(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = rhs(i, 0); + ret(i, 1) = rhs(i, 1); + ret(i, 2) = rhs(i, 2); + ret(i, 3) = rhs(i, 3); + } +}; + +template +inline void multMinusSigmaXT(iVector &ret, const iVector &rhs) +{ + ret(0) = timesMinusI(rhs(1)); + ret(1) = timesMinusI(rhs(0)); + ret(2) = timesI(rhs(3)); + ret(3) = timesI(rhs(2)); +}; + +template +inline void lmultMinusSigmaXT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesMinusI(rhs(1, i)); + ret(1, i) = timesMinusI(rhs(0, i)); + ret(2, i) = timesI(rhs(3, i)); + ret(3, i) = timesI(rhs(2, i)); + } +}; + +template +inline void rmultMinusSigmaXT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesMinusI(rhs(i, 1)); + ret(i, 1) = timesMinusI(rhs(i, 0)); + ret(i, 2) = timesI(rhs(i, 3)); + ret(i, 3) = timesI(rhs(i, 2)); + } +}; + +template +inline void multSigmaXT(iVector &ret, const iVector &rhs) +{ + ret(0) = timesI(rhs(1)); + ret(1) = timesI(rhs(0)); + ret(2) = timesMinusI(rhs(3)); + ret(3) = timesMinusI(rhs(2)); +}; + +template +inline void lmultSigmaXT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesI(rhs(1, i)); + ret(1, i) = timesI(rhs(0, i)); + ret(2, i) = timesMinusI(rhs(3, i)); + ret(3, i) = timesMinusI(rhs(2, i)); + } +}; + +template +inline void rmultSigmaXT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesI(rhs(i, 1)); + ret(i, 1) = timesI(rhs(i, 0)); + ret(i, 2) = timesMinusI(rhs(i, 3)); + ret(i, 3) = timesMinusI(rhs(i, 2)); + } +}; + +template +inline void multMinusSigmaXY(iVector &ret, const iVector &rhs) +{ + ret(0) = timesI(rhs(0)); + ret(1) = timesMinusI(rhs(1)); + ret(2) = timesI(rhs(2)); + ret(3) = timesMinusI(rhs(3)); +}; + +template +inline void lmultMinusSigmaXY(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesI(rhs(0, i)); + ret(1, i) = timesMinusI(rhs(1, i)); + ret(2, i) = timesI(rhs(2, i)); + ret(3, i) = timesMinusI(rhs(3, i)); + } +}; + +template +inline void rmultMinusSigmaXY(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesI(rhs(i, 0)); + ret(i, 1) = timesMinusI(rhs(i, 1)); + ret(i, 2) = timesI(rhs(i, 2)); + ret(i, 3) = timesMinusI(rhs(i, 3)); + } +}; + +template +inline void multSigmaXY(iVector &ret, const iVector &rhs) +{ + ret(0) = timesMinusI(rhs(0)); + ret(1) = timesI(rhs(1)); + ret(2) = timesMinusI(rhs(2)); + ret(3) = timesI(rhs(3)); +}; + +template +inline void lmultSigmaXY(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesMinusI(rhs(0, i)); + ret(1, i) = timesI(rhs(1, i)); + ret(2, i) = timesMinusI(rhs(2, i)); + ret(3, i) = timesI(rhs(3, i)); + } +}; + +template +inline void rmultSigmaXY(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesMinusI(rhs(i, 0)); + ret(i, 1) = timesI(rhs(i, 1)); + ret(i, 2) = timesMinusI(rhs(i, 2)); + ret(i, 3) = timesI(rhs(i, 3)); + } +}; + +template +inline void multMinusSigmaXZ(iVector &ret, const iVector &rhs) +{ + ret(0) = rhs(1); + ret(1) = -rhs(0); + ret(2) = rhs(3); + ret(3) = -rhs(2); +}; + +template +inline void lmultMinusSigmaXZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = rhs(1, i); + ret(1, i) = -rhs(0, i); + ret(2, i) = rhs(3, i); + ret(3, i) = -rhs(2, i); + } +}; + +template +inline void rmultMinusSigmaXZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = rhs(i, 1); + ret(i, 1) = -rhs(i, 0); + ret(i, 2) = rhs(i, 3); + ret(i, 3) = -rhs(i, 2); + } +}; + +template +inline void multSigmaXZ(iVector &ret, const iVector &rhs) +{ + ret(0) = -rhs(1); + ret(1) = rhs(0); + ret(2) = -rhs(3); + ret(3) = rhs(2); +}; + +template +inline void lmultSigmaXZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = -rhs(1, i); + ret(1, i) = rhs(0, i); + ret(2, i) = -rhs(3, i); + ret(3, i) = rhs(2, i); + } +}; + +template +inline void rmultSigmaXZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = -rhs(i, 1); + ret(i, 1) = rhs(i, 0); + ret(i, 2) = -rhs(i, 3); + ret(i, 3) = rhs(i, 2); + } +}; + +template +inline void multMinusSigmaYT(iVector &ret, const iVector &rhs) +{ + ret(0) = rhs(1); + ret(1) = -rhs(0); + ret(2) = -rhs(3); + ret(3) = rhs(2); +}; + +template +inline void lmultMinusSigmaYT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = rhs(1, i); + ret(1, i) = -rhs(0, i); + ret(2, i) = -rhs(3, i); + ret(3, i) = rhs(2, i); + } +}; + +template +inline void rmultMinusSigmaYT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = rhs(i, 1); + ret(i, 1) = -rhs(i, 0); + ret(i, 2) = -rhs(i, 3); + ret(i, 3) = rhs(i, 2); + } +}; + +template +inline void multSigmaYT(iVector &ret, const iVector &rhs) +{ + ret(0) = -rhs(1); + ret(1) = rhs(0); + ret(2) = rhs(3); + ret(3) = -rhs(2); +}; + +template +inline void lmultSigmaYT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = -rhs(1, i); + ret(1, i) = rhs(0, i); + ret(2, i) = rhs(3, i); + ret(3, i) = -rhs(2, i); + } +}; + +template +inline void rmultSigmaYT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = -rhs(i, 1); + ret(i, 1) = rhs(i, 0); + ret(i, 2) = rhs(i, 3); + ret(i, 3) = -rhs(i, 2); + } +}; + +template +inline void multMinusSigmaYZ(iVector &ret, const iVector &rhs) +{ + ret(0) = timesI(rhs(1)); + ret(1) = timesI(rhs(0)); + ret(2) = timesI(rhs(3)); + ret(3) = timesI(rhs(2)); +}; + +template +inline void lmultMinusSigmaYZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesI(rhs(1, i)); + ret(1, i) = timesI(rhs(0, i)); + ret(2, i) = timesI(rhs(3, i)); + ret(3, i) = timesI(rhs(2, i)); + } +}; + +template +inline void rmultMinusSigmaYZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesI(rhs(i, 1)); + ret(i, 1) = timesI(rhs(i, 0)); + ret(i, 2) = timesI(rhs(i, 3)); + ret(i, 3) = timesI(rhs(i, 2)); + } +}; + +template +inline void multSigmaYZ(iVector &ret, const iVector &rhs) +{ + ret(0) = timesMinusI(rhs(1)); + ret(1) = timesMinusI(rhs(0)); + ret(2) = timesMinusI(rhs(3)); + ret(3) = timesMinusI(rhs(2)); +}; + +template +inline void lmultSigmaYZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesMinusI(rhs(1, i)); + ret(1, i) = timesMinusI(rhs(0, i)); + ret(2, i) = timesMinusI(rhs(3, i)); + ret(3, i) = timesMinusI(rhs(2, i)); + } +}; + +template +inline void rmultSigmaYZ(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesMinusI(rhs(i, 1)); + ret(i, 1) = timesMinusI(rhs(i, 0)); + ret(i, 2) = timesMinusI(rhs(i, 3)); + ret(i, 3) = timesMinusI(rhs(i, 2)); + } +}; + +template +inline void multMinusSigmaZT(iVector &ret, const iVector &rhs) +{ + ret(0) = timesMinusI(rhs(0)); + ret(1) = timesI(rhs(1)); + ret(2) = timesI(rhs(2)); + ret(3) = timesMinusI(rhs(3)); +}; + +template +inline void lmultMinusSigmaZT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesMinusI(rhs(0, i)); + ret(1, i) = timesI(rhs(1, i)); + ret(2, i) = timesI(rhs(2, i)); + ret(3, i) = timesMinusI(rhs(3, i)); + } +}; + +template +inline void rmultMinusSigmaZT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesMinusI(rhs(i, 0)); + ret(i, 1) = timesI(rhs(i, 1)); + ret(i, 2) = timesI(rhs(i, 2)); + ret(i, 3) = timesMinusI(rhs(i, 3)); + } +}; + +template +inline void multSigmaZT(iVector &ret, const iVector &rhs) +{ + ret(0) = timesI(rhs(0)); + ret(1) = timesMinusI(rhs(1)); + ret(2) = timesMinusI(rhs(2)); + ret(3) = timesI(rhs(3)); +}; + +template +inline void lmultSigmaZT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(0, i) = timesI(rhs(0, i)); + ret(1, i) = timesMinusI(rhs(1, i)); + ret(2, i) = timesMinusI(rhs(2, i)); + ret(3, i) = timesI(rhs(3, i)); + } +}; + +template +inline void rmultSigmaZT(iMatrix &ret, const iMatrix &rhs) +{ + for(unsigned int i = 0; i < Ns; ++i) + { + ret(i, 0) = timesI(rhs(i, 0)); + ret(i, 1) = timesMinusI(rhs(i, 1)); + ret(i, 2) = timesMinusI(rhs(i, 2)); + ret(i, 3) = timesI(rhs(i, 3)); + } +}; + + +// FIXME +// +// Optimisation; switch over to a "multGammaX(ret._internal,arg._internal)" style early and +// note that doing so from the lattice operator will avoid copy back and case switch overhead, as +// was done for the tensor math operator to remove operator * notation early +// + +//left multiply +template +inline auto operator*(const Gamma &G, const iScalar &arg) +->typename std::enable_if,SpinorIndex>::notvalue,iScalar>::type +{ + iScalar ret; + ret._internal=G*arg._internal; + return ret; +} + +template +inline auto operator*(const Gamma &G, const iVector &arg) +->typename std::enable_if,SpinorIndex>::notvalue,iVector>::type +{ + iVector ret; + for(int i=0;i +inline auto operator*(const Gamma &G, const iMatrix &arg) +->typename std::enable_if,SpinorIndex>::notvalue,iMatrix>::type +{ + iMatrix ret; + for(int i=0;i +inline auto operator*(const iScalar &arg, const Gamma &G) +->typename std::enable_if,SpinorIndex>::notvalue,iScalar>::type +{ + iScalar ret; + ret._internal=arg._internal*G; + return ret; +} + +template +inline auto operator * (const iMatrix &arg, const Gamma &G) +->typename std::enable_if,SpinorIndex>::notvalue,iMatrix>::type +{ + iMatrix ret; + for(int i=0;i +inline auto operator*(const Gamma &G, const iVector &arg) +->typename std::enable_if, SpinorIndex>::value, iVector>::type +{ + iVector ret; + + switch (G.g) + { + case Gamma::Algebra::MinusGamma5: + multMinusGamma5(ret, arg); break; + case Gamma::Algebra::Gamma5: + multGamma5(ret, arg); break; + case Gamma::Algebra::MinusGammaT: + multMinusGammaT(ret, arg); break; + case Gamma::Algebra::GammaT: + multGammaT(ret, arg); break; + case Gamma::Algebra::MinusGammaTGamma5: + multMinusGammaTGamma5(ret, arg); break; + case Gamma::Algebra::GammaTGamma5: + multGammaTGamma5(ret, arg); break; + case Gamma::Algebra::MinusGammaX: + multMinusGammaX(ret, arg); break; + case Gamma::Algebra::GammaX: + multGammaX(ret, arg); break; + case Gamma::Algebra::MinusGammaXGamma5: + multMinusGammaXGamma5(ret, arg); break; + case Gamma::Algebra::GammaXGamma5: + multGammaXGamma5(ret, arg); break; + case Gamma::Algebra::MinusGammaY: + multMinusGammaY(ret, arg); break; + case Gamma::Algebra::GammaY: + multGammaY(ret, arg); break; + case Gamma::Algebra::MinusGammaYGamma5: + multMinusGammaYGamma5(ret, arg); break; + case Gamma::Algebra::GammaYGamma5: + multGammaYGamma5(ret, arg); break; + case Gamma::Algebra::MinusGammaZ: + multMinusGammaZ(ret, arg); break; + case Gamma::Algebra::GammaZ: + multGammaZ(ret, arg); break; + case Gamma::Algebra::MinusGammaZGamma5: + multMinusGammaZGamma5(ret, arg); break; + case Gamma::Algebra::GammaZGamma5: + multGammaZGamma5(ret, arg); break; + case Gamma::Algebra::MinusIdentity: + multMinusIdentity(ret, arg); break; + case Gamma::Algebra::Identity: + multIdentity(ret, arg); break; + case Gamma::Algebra::MinusSigmaXT: + multMinusSigmaXT(ret, arg); break; + case Gamma::Algebra::SigmaXT: + multSigmaXT(ret, arg); break; + case Gamma::Algebra::MinusSigmaXY: + multMinusSigmaXY(ret, arg); break; + case Gamma::Algebra::SigmaXY: + multSigmaXY(ret, arg); break; + case Gamma::Algebra::MinusSigmaXZ: + multMinusSigmaXZ(ret, arg); break; + case Gamma::Algebra::SigmaXZ: + multSigmaXZ(ret, arg); break; + case Gamma::Algebra::MinusSigmaYT: + multMinusSigmaYT(ret, arg); break; + case Gamma::Algebra::SigmaYT: + multSigmaYT(ret, arg); break; + case Gamma::Algebra::MinusSigmaYZ: + multMinusSigmaYZ(ret, arg); break; + case Gamma::Algebra::SigmaYZ: + multSigmaYZ(ret, arg); break; + case Gamma::Algebra::MinusSigmaZT: + multMinusSigmaZT(ret, arg); break; + case Gamma::Algebra::SigmaZT: + multSigmaZT(ret, arg); break; + default: assert(0); + } - // Make gamma products (Chroma convention) - SpinMatrix makeGammaProd(const unsigned int i); - - /* Gx - * 0 0 0 i - * 0 0 i 0 - * 0 -i 0 0 - * -i 0 0 0 - */ - // right multiplication makes sense for matrix args, not for vector since there is - // no concept of row versus columnar indices - template inline void rmultMinusGammaX(iMatrix &ret,const iMatrix &rhs){ - for(int i=0;i inline void rmultGammaX(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multGammaX(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multMinusGammaX(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multGammaX(iVector &ret, const iVector &rhs){ - ret._internal[0] = timesI(rhs._internal[3]); - ret._internal[1] = timesI(rhs._internal[2]); - ret._internal[2] = timesMinusI(rhs._internal[1]); - ret._internal[3] = timesMinusI(rhs._internal[0]); - }; - template inline void multMinusGammaX(iVector &ret, const iVector &rhs){ - ret(0) = timesMinusI(rhs(3)); - ret(1) = timesMinusI(rhs(2)); - ret(2) = timesI(rhs(1)); - ret(3) = timesI(rhs(0)); - }; +template +inline auto operator*(const Gamma &G, const iMatrix &arg) +->typename std::enable_if, SpinorIndex>::value, iMatrix>::type +{ + iMatrix ret; + switch (G.g) + { + case Gamma::Algebra::MinusGamma5: + lmultMinusGamma5(ret, arg); break; + case Gamma::Algebra::Gamma5: + lmultGamma5(ret, arg); break; + case Gamma::Algebra::MinusGammaT: + lmultMinusGammaT(ret, arg); break; + case Gamma::Algebra::GammaT: + lmultGammaT(ret, arg); break; + case Gamma::Algebra::MinusGammaTGamma5: + lmultMinusGammaTGamma5(ret, arg); break; + case Gamma::Algebra::GammaTGamma5: + lmultGammaTGamma5(ret, arg); break; + case Gamma::Algebra::MinusGammaX: + lmultMinusGammaX(ret, arg); break; + case Gamma::Algebra::GammaX: + lmultGammaX(ret, arg); break; + case Gamma::Algebra::MinusGammaXGamma5: + lmultMinusGammaXGamma5(ret, arg); break; + case Gamma::Algebra::GammaXGamma5: + lmultGammaXGamma5(ret, arg); break; + case Gamma::Algebra::MinusGammaY: + lmultMinusGammaY(ret, arg); break; + case Gamma::Algebra::GammaY: + lmultGammaY(ret, arg); break; + case Gamma::Algebra::MinusGammaYGamma5: + lmultMinusGammaYGamma5(ret, arg); break; + case Gamma::Algebra::GammaYGamma5: + lmultGammaYGamma5(ret, arg); break; + case Gamma::Algebra::MinusGammaZ: + lmultMinusGammaZ(ret, arg); break; + case Gamma::Algebra::GammaZ: + lmultGammaZ(ret, arg); break; + case Gamma::Algebra::MinusGammaZGamma5: + lmultMinusGammaZGamma5(ret, arg); break; + case Gamma::Algebra::GammaZGamma5: + lmultGammaZGamma5(ret, arg); break; + case Gamma::Algebra::MinusIdentity: + lmultMinusIdentity(ret, arg); break; + case Gamma::Algebra::Identity: + lmultIdentity(ret, arg); break; + case Gamma::Algebra::MinusSigmaXT: + lmultMinusSigmaXT(ret, arg); break; + case Gamma::Algebra::SigmaXT: + lmultSigmaXT(ret, arg); break; + case Gamma::Algebra::MinusSigmaXY: + lmultMinusSigmaXY(ret, arg); break; + case Gamma::Algebra::SigmaXY: + lmultSigmaXY(ret, arg); break; + case Gamma::Algebra::MinusSigmaXZ: + lmultMinusSigmaXZ(ret, arg); break; + case Gamma::Algebra::SigmaXZ: + lmultSigmaXZ(ret, arg); break; + case Gamma::Algebra::MinusSigmaYT: + lmultMinusSigmaYT(ret, arg); break; + case Gamma::Algebra::SigmaYT: + lmultSigmaYT(ret, arg); break; + case Gamma::Algebra::MinusSigmaYZ: + lmultMinusSigmaYZ(ret, arg); break; + case Gamma::Algebra::SigmaYZ: + lmultSigmaYZ(ret, arg); break; + case Gamma::Algebra::MinusSigmaZT: + lmultMinusSigmaZT(ret, arg); break; + case Gamma::Algebra::SigmaZT: + lmultSigmaZT(ret, arg); break; + default: assert(0); + } + + return ret; +} - /*Gy - * 0 0 0 -1 [0] -+ [3] - * 0 0 1 0 [1] +- [2] - * 0 1 0 0 - * -1 0 0 0 - */ - template inline void rmultGammaY(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void rmultMinusGammaY(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multGammaY(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multMinusGammaY(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multGammaY(iVector &ret, const iVector &rhs){ - ret(0) = -rhs(3); - ret(1) = rhs(2); - ret(2) = rhs(1); - ret(3) = -rhs(0); - }; - template inline void multMinusGammaY(iVector &ret, const iVector &rhs){ - ret(0) = rhs(3); - ret(1) = -rhs(2); - ret(2) = -rhs(1); - ret(3) = rhs(0); - }; - /*Gz - * 0 0 i 0 [0]+-i[2] - * 0 0 0 -i [1]-+i[3] - * -i 0 0 0 - * 0 i 0 0 - */ - template inline void rmultGammaZ(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void rmultMinusGammaZ(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multGammaZ(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multMinusGammaZ(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multGammaZ(iVector &ret, const iVector &rhs){ - ret(0) = timesI(rhs(2)); - ret(1) =timesMinusI(rhs(3)); - ret(2) =timesMinusI(rhs(0)); - ret(3) = timesI(rhs(1)); - }; - template inline void multMinusGammaZ(iVector &ret, const iVector &rhs){ - ret(0) = timesMinusI(rhs(2)); - ret(1) = timesI(rhs(3)); - ret(2) = timesI(rhs(0)); - ret(3) = timesMinusI(rhs(1)); - }; - /*Gt - * 0 0 1 0 [0]+-[2] - * 0 0 0 1 [1]+-[3] - * 1 0 0 0 - * 0 1 0 0 - */ - template inline void rmultGammaT(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void rmultMinusGammaT(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multGammaT(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multMinusGammaT(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multGammaT(iVector &ret, const iVector &rhs){ - ret(0) = rhs(2); - ret(1) = rhs(3); - ret(2) = rhs(0); - ret(3) = rhs(1); - }; - template inline void multMinusGammaT(iVector &ret, const iVector &rhs){ - ret(0) =-rhs(2); - ret(1) =-rhs(3); - ret(2) =-rhs(0); - ret(3) =-rhs(1); - }; - /*G5 - * 1 0 0 0 [0]+-[2] - * 0 1 0 0 [1]+-[3] - * 0 0 -1 0 - * 0 0 0 -1 - */ - template inline void rmultGamma5(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void rmultMinusGamma5(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i +inline auto operator*(const iMatrix &arg, const Gamma &G) +->typename std::enable_if, SpinorIndex>::value, iMatrix>::type +{ + iMatrix ret; - template inline void multGamma5(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multMinusGamma5(iMatrix &ret, const iMatrix &rhs){ - for(int i=0;i inline void multGamma5(iVector &ret, const iVector &rhs){ - ret(0) = rhs(0); - ret(1) = rhs(1); - ret(2) =-rhs(2); - ret(3) =-rhs(3); - }; - template inline void multMinusGamma5(iVector &ret, const iVector &rhs){ - ret(0) =-rhs(0); - ret(1) =-rhs(1); - ret(2) = rhs(2); - ret(3) = rhs(3); - }; +inline Gamma operator*(const Gamma &g1, const Gamma &g2) +{ + return Gamma(Gamma::mul[g1.g][g2.g]); +} +}} - -#ifdef GRID_WARN_SUBOPTIMAL -#warning "Optimisation alert switch over to multGammaX early " -#endif - - /////////////////////////////////////////////////////////////////////////////////////////////////// - // Operator * : first case this is not a spin index, so recurse - /////////////////////////////////////////////////////////////////////////////////////////////////// - - // FIXME - // - // Optimisation; switch over to a "multGammaX(ret._internal,arg._internal)" style early and - // note that doing so from the lattice operator will avoid copy back and case switch overhead, as - // was done for the tensor math operator to remove operator * notation early - // - - //left multiply - template inline auto operator * ( const Gamma &G,const iScalar &arg) -> - typename std::enable_if,SpinorIndex>::notvalue,iScalar >::type - - { - iScalar ret; - ret._internal=G*arg._internal; - return ret; - } - template inline auto operator * ( const Gamma &G,const iVector &arg) -> - typename std::enable_if,SpinorIndex>::notvalue,iVector >::type - { - iVector ret; - for(int i=0;i inline auto operator * ( const Gamma &G,const iMatrix &arg) -> - typename std::enable_if,SpinorIndex>::notvalue,iMatrix >::type - { - iMatrix ret; - for(int i=0;i inline auto operator * (const iScalar &arg, const Gamma &G) -> - typename std::enable_if,SpinorIndex>::notvalue,iScalar >::type - - { - iScalar ret; - ret._internal=arg._internal*G; - return ret; - } - template inline auto operator * (const iVector &arg, const Gamma &G) -> - typename std::enable_if,SpinorIndex>::notvalue,iVector >::type - { - iVector ret; - for(int i=0;i inline auto operator * (const iMatrix &arg, const Gamma &G) -> - typename std::enable_if,SpinorIndex>::notvalue,iMatrix >::type - { - iMatrix ret; - for(int i=0;i inline auto operator * ( const Gamma &G,const iMatrix &arg) -> - typename std::enable_if,SpinorIndex>::value,iMatrix >::type - { - iMatrix ret; - switch (G._g) { - case Gamma::Identity: - ret = arg; - break; - case Gamma::MinusIdentity: - ret = -arg; - break; - case Gamma::GammaX: - multGammaX(ret,arg); - break; - case Gamma::MinusGammaX: - multMinusGammaX(ret,arg); - break; - case Gamma::GammaY: - multGammaY(ret,arg); - break; - case Gamma::MinusGammaY: - multMinusGammaY(ret,arg); - break; - case Gamma::GammaZ: - multGammaZ(ret,arg); - break; - case Gamma::MinusGammaZ: - multMinusGammaZ(ret,arg); - break; - case Gamma::GammaT: - multGammaT(ret,arg); - break; - case Gamma::MinusGammaT: - multMinusGammaT(ret,arg); - break; - case Gamma::Gamma5: - multGamma5(ret,arg); - break; - case Gamma::MinusGamma5: - multMinusGamma5(ret,arg); - break; - default: - assert(0); - break; - } - return ret; - } - // Could have used type trait for Matrix/vector and then an enable if to share code - template inline auto operator * ( const Gamma &G,const iVector &arg) -> - typename std::enable_if,SpinorIndex>::value,iVector >::type - { - iVector ret; - switch (G._g) { - case Gamma::Identity: - ret = arg; - break; - case Gamma::MinusIdentity: - ret = -arg; - break; - case Gamma::GammaX: - multGammaX(ret,arg); - break; - case Gamma::MinusGammaX: - multMinusGammaX(ret,arg); - break; - case Gamma::GammaY: - multGammaY(ret,arg); - break; - case Gamma::MinusGammaY: - multMinusGammaY(ret,arg); - break; - case Gamma::GammaZ: - multGammaZ(ret,arg); - break; - case Gamma::MinusGammaZ: - multMinusGammaZ(ret,arg); - break; - case Gamma::GammaT: - multGammaT(ret,arg); - break; - case Gamma::MinusGammaT: - multMinusGammaT(ret,arg); - break; - case Gamma::Gamma5: - multGamma5(ret,arg); - break; - case Gamma::MinusGamma5: - multMinusGamma5(ret,arg); - break; - default: - assert(0); - break; - } - return ret; - } - - template inline auto operator * (const iMatrix &arg, const Gamma &G) -> - typename std::enable_if,SpinorIndex>::value,iMatrix >::type - { - iMatrix ret; - switch (G._g) { - case Gamma::Identity: - ret = arg; - break; - case Gamma::MinusIdentity: - ret = -arg; - break; - case Gamma::GammaX: - rmultGammaX(ret,arg); - break; - case Gamma::MinusGammaX: - rmultMinusGammaX(ret,arg); - break; - case Gamma::GammaY: - rmultGammaY(ret,arg); - break; - case Gamma::MinusGammaY: - rmultMinusGammaY(ret,arg); - break; - case Gamma::GammaZ: - rmultGammaZ(ret,arg); - break; - case Gamma::MinusGammaZ: - rmultMinusGammaZ(ret,arg); - break; - case Gamma::GammaT: - rmultGammaT(ret,arg); - break; - case Gamma::MinusGammaT: - rmultMinusGammaT(ret,arg); - break; - case Gamma::Gamma5: - rmultGamma5(ret,arg); - break; - case Gamma::MinusGamma5: - rmultMinusGamma5(ret,arg); - break; - default: - assert(0); - break; - } - return ret; - } - - - /* Output from test -./Grid_gamma -Identity((1,0),(0,0),(0,0),(0,0)) - ((0,0),(1,0),(0,0),(0,0)) - ((0,0),(0,0),(1,0),(0,0)) - ((0,0),(0,0),(0,0),(1,0)) OK - -GammaX ((0,0),(0,0),(0,0),(0,1)) - ((0,0),(0,0),(0,1),(0,0)) - ((0,0),(0,-1),(0,0),(0,0)) - ((0,-1),(0,0),(0,0),(0,0)) OK - * Gx - * 0 0 0 i - * 0 0 i 0 - * 0 -i 0 0 - * -i 0 0 0 - -GammaY ((-0,-0),(-0,-0),(-0,-0),(-1,-0)) - ((0,0),(0,0),(1,0),(0,0)) - ((0,0),(1,0),(0,0),(0,0)) OK - ((-1,-0),(-0,-0),(-0,-0),(-0,-0)) - *Gy - * 0 0 0 -1 [0] -+ [3] - * 0 0 1 0 [1] +- [2] - * 0 1 0 0 - * -1 0 0 0 - -GammaZ ((0,0),(0,0),(0,1),(0,0)) - ((0,0),(0,0),(0,0),(0,-1)) - ((0,-1),(0,0),(0,0),(0,0)) - ((0,0),(0,1),(0,0),(0,0)) OK - * 0 0 i 0 [0]+-i[2] - * 0 0 0 -i [1]-+i[3] - * -i 0 0 0 - * 0 i 0 0 - -GammaT ((0,0),(0,0),(1,0),(0,0)) - ((0,0),(0,0),(0,0),(1,0)) OK - ((1,0),(0,0),(0,0),(0,0)) - ((0,0),(1,0),(0,0),(0,0)) - * 0 0 1 0 [0]+-[2] - * 0 0 0 1 [1]+-[3] - * 1 0 0 0 - * 0 1 0 0 - -Gamma5 ((1,0),(0,0),(0,0),(0,0)) - ((0,0),(1,0),(0,0),(0,0)) - ((-0,-0),(-0,-0),(-1,-0),(-0,-0)) - ((-0,-0),(-0,-0),(-0,-0),(-1,-0)) - * 1 0 0 0 [0]+-[2] - * 0 1 0 0 [1]+-[3] OK - * 0 0 -1 0 - * 0 0 0 -1 - */ - -} //namespace QCD -} // Grid #endif diff --git a/lib/qcd/spin/GammaMulTable.h b/lib/qcd/spin/GammaMulTable.h new file mode 100644 index 00000000..fd483323 --- /dev/null +++ b/lib/qcd/spin/GammaMulTable.h @@ -0,0 +1,1058 @@ +const std::array, Gamma::nGamma> +Gamma::mul = {{ + {Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY} + , + {Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY} + , + {Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ} + , + {Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ} + , + {Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5} + , + {Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5} + , + {Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5} + , + {Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5} + , + {Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY} + , + {Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY} + , + {Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5} + , + {Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5} + , + {Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX} + , + {Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX} + , + {Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT} + , + {Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT} + , + {Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5} + , + {Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5} + , + {Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT} + , + {Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT} + , + {Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ} + , + {Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ} + , + {Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5} + , + {Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5} + , + {Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT} + , + {Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT} + , + {Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ} + , + {Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ} + , + {Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT} + , + {Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT} + , + {Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaX, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity} + , + {Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::GammaY, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaT, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::MinusSigmaZT, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::Identity, + Gamma::Algebra::MinusIdentity} +}}; \ No newline at end of file diff --git a/lib/qcd/spin/gamma-gen/gamma-gen.nb b/lib/qcd/spin/gamma-gen/gamma-gen.nb new file mode 100644 index 00000000..a513e1d1 --- /dev/null +++ b/lib/qcd/spin/gamma-gen/gamma-gen.nb @@ -0,0 +1,1457 @@ +(* 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[ 55210, 1449] +NotebookOptionsPosition[ 53631, 1395] +NotebookOutlinePosition[ 53992, 1411] +CellTagsIndexPosition[ 53949, 1408] +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 \ +\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", "[", "\"\\"", "]"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"Unprotect", "[", "\"\\"", "]"}], + ";"}], "\[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}] +}, 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["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}] +}, 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}] +}, 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 \ +\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 \ + name;\n static const std::array, 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", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "gx", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "gy", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "gz", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "gt", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "g5", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "gx5", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "gy5", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "gz5", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "gt5", "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "\[Sigma]xy", "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "\[Sigma]xz", "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "\[Sigma]xt", "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "\[Sigma]yz", "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "\[Sigma]yt", "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", "\[Sigma]zt", "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "id"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "gx"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "gy"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "gz"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "gt"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "g5"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "gx5"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "gy5"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "gz5"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "gt5"}], "]"}], "=", "\"\\""}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "\[Sigma]xy"}], "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "\[Sigma]xz"}], "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "\[Sigma]xt"}], "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "\[Sigma]yz"}], "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "\[Sigma]yt"}], "]"}], "=", + "\"\\""}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"enum", "[", + RowBox[{"-", "\[Sigma]zt"}], "]"}], "=", + "\"\\""}], ";"}]}], "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", "<>", "\"\\""}]}], + ";", "\[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", "]"}], ",", "\"\\""}], + "]"}], ",", "17"}], "]"}], "<>", "\"\<, \>\"", "<>", + RowBox[{"ToString", "[", "ind", "]"}]}]}], ";", + "\[IndentingNewLine]", + RowBox[{"out", " ", "=", " ", + RowBox[{"out", "<>", + RowBox[{"If", "[", + RowBox[{ + RowBox[{"i", "\[Equal]", + RowBox[{"Last", "[", "alg", "]"}]}], ",", + RowBox[{ + "\"\<);\\n\>\"", "<>", "indent", "<>", + "\"\\"", "<>", + 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[{ + "\"\\ninline void mult\>\"", "<>", + "\[IndentingNewLine]", + RowBox[{"StringTrim", "[", + RowBox[{ + RowBox[{"enum", "[", "g", "]"}], ",", "\"\\""}], "]"}], + "<>", "\[IndentingNewLine]", + "\"\<(iVector &ret, const iVector \ +&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[{ + "\"\\ninline void lmult\>\"", "<>", + "\[IndentingNewLine]", + RowBox[{"StringTrim", "[", + RowBox[{ + RowBox[{"enum", "[", "g", "]"}], ",", "\"\\""}], "]"}], "<>", + "\[IndentingNewLine]", + "\"\<(iMatrix &ret, const iMatrix &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[{ + "\"\\ninline void rmult\>\"", "<>", + "\[IndentingNewLine]", + RowBox[{"StringTrim", "[", + RowBox[{ + RowBox[{"enum", "[", "g", "]"}], ",", "\"\\""}], "]"}], "<>", + "\[IndentingNewLine]", + "\"\<(iMatrix &ret, const iMatrix &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[{ + RowBox[{"mat", "[", "g", "]"}], ".", "rhsv"}]}], "}"}]}], "]"}], + ";", "\[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", "=", + "\"\ \ninline auto operator*(const Gamma &G, \ +const iVector &arg)\n->typename \ +std::enable_if, SpinorIndex>::value, \ +iVector>::type\n{\n iVector 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", "]"}], ",", "\"\\""}], + "]"}], "<>", "\"\<(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", "=", + "\"\ \ninline auto operator*(const Gamma &G, \ +const iMatrix &arg)\n->typename \ +std::enable_if, SpinorIndex>::value, \ +iMatrix>::type\n{\n iMatrix 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", "]"}], ",", "\"\\""}], + "]"}], "<>", "\"\<(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", "=", + "\"\ \ninline auto operator*(const iMatrix &arg, const Gamma &G)\n->typename \ +std::enable_if, SpinorIndex>::value, \ +iMatrix>::type\n{\n iMatrix 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", "]"}], ",", "\"\\""}], + "]"}], "<>", "\"\<(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 \ninline auto \ +operator*(const Gamma &G, const iScalar &arg)\n->typename \ +std::enable_if,SpinorIndex>::notvalue,\ +iScalar>::type \n{\n iScalar ret;\n \ +ret._internal=G*arg._internal;\n return ret;\n}\n\ntemplate\ninline auto operator*(const Gamma &G, const iVector &arg)\n\ +->typename \ +std::enable_if,SpinorIndex>::notvalue,\ +iVector>::type \n{\n iVector ret;\n for(int i=0;i\ninline auto operator*(const Gamma &G, const \ +iMatrix &arg) \n->typename \ +std::enable_if,SpinorIndex>::notvalue,\ +iMatrix>::type \n{\n iMatrix ret;\n for(int i=0;i\ninline auto \ +operator*(const iScalar &arg, const Gamma &G)\n->typename \ +std::enable_if,SpinorIndex>::notvalue,\ +iScalar>::type \n{\n iScalar ret;\n \ +ret._internal=arg._internal*G;\n return ret;\n}\n\ntemplate\ninline auto operator * (const iMatrix &arg, const Gamma &G) \n\ +->typename \ +std::enable_if,SpinorIndex>::notvalue,\ +iMatrix>::type \n{\n iMatrix ret;\n for(int i=0;i\"", "<>", + 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}}], + +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", "[", "\"\\"", "]"}]}], ";", + 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", " ", "=", " ", + "\"\, \ +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]", + "<>", "\"\\"", "<>", + 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", "[", "\"\\"", "]"}]}], + ";"}], "\[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 \n\nnamespace Grid {\nnamespace QCD {\n\n\ +#include \\\"GammaMulTable.h\\\"\n\nconst std::array 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[{"\"\\"", "\[Rule]", "\"\<-\>\""}]}], "]"}], + ",", "\"\\""}], "]"}], ",", "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", "[", "\"\\"", "]"}]}], ";", + 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->{{Automatic, 155}, {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, 654, 9, 32, "Output"] +}, Open ]], +Cell[CellGroupData[{ +Cell[2965, 66, 114, 1, 64, "Section"], +Cell[3082, 69, 475, 14, 54, "Input"], +Cell[3560, 85, 139, 1, 30, "Text"], +Cell[3702, 88, 5454, 168, 427, "Input"], +Cell[9159, 258, 119, 1, 30, "Text"], +Cell[9281, 261, 1295, 41, 96, "Input"], +Cell[10579, 304, 133, 1, 30, "Text"], +Cell[CellGroupData[{ +Cell[10737, 309, 479, 15, 32, "Input"], +Cell[11219, 326, 1259, 28, 96, "Output"] +}, Open ]], +Cell[12493, 357, 110, 1, 30, "Text"], +Cell[CellGroupData[{ +Cell[12628, 362, 476, 12, 32, "Input"], +Cell[13107, 376, 6313, 160, 312, "Output"] +}, Open ]] +}, Open ]], +Cell[CellGroupData[{ +Cell[19469, 542, 117, 1, 64, "Section"], +Cell[19589, 545, 128, 2, 38, "Text"], +Cell[19720, 549, 2518, 48, 747, "Input"], +Cell[22241, 599, 164, 3, 38, "Text"], +Cell[22408, 604, 4876, 148, 684, "Input"], +Cell[27287, 754, 2588, 55, 201, "Input"], +Cell[29878, 811, 149, 2, 38, "Text"], +Cell[30030, 815, 17190, 425, 3456, "Input"], +Cell[47223, 1242, 137, 2, 38, "Text"], +Cell[47363, 1246, 468, 11, 32, "Input"] +}, Open ]], +Cell[CellGroupData[{ +Cell[47868, 1262, 116, 1, 64, "Section"], +Cell[47987, 1265, 3046, 66, 285, "Input"], +Cell[51036, 1333, 2179, 48, 432, "Input"], +Cell[53218, 1383, 397, 9, 32, "Input"] +}, Open ]] +} +] +*) + diff --git a/lib/qcd/utils/LinalgUtils.h b/lib/qcd/utils/LinalgUtils.h index e7e6a794..754cdd2c 100644 --- a/lib/qcd/utils/LinalgUtils.h +++ b/lib/qcd/utils/LinalgUtils.h @@ -47,7 +47,7 @@ void axpibg5x(Lattice &z,const Lattice &x,Coeff a,Coeff b) GridBase *grid=x._grid; - Gamma G5(Gamma::Gamma5); + Gamma G5(Gamma::Algebra::Gamma5); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ vobj tmp; @@ -80,7 +80,7 @@ void ag5xpby_ssp(Lattice &z,Coeff a,const Lattice &x,Coeff b,const L conformable(x,z); GridBase *grid=x._grid; int Ls = grid->_rdimensions[0]; - Gamma G5(Gamma::Gamma5); + Gamma G5(Gamma::Algebra::Gamma5); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss+=Ls){ // adds Ls vobj tmp; @@ -98,7 +98,7 @@ void axpbg5y_ssp(Lattice &z,Coeff a,const Lattice &x,Coeff b,const L conformable(x,z); GridBase *grid=x._grid; int Ls = grid->_rdimensions[0]; - Gamma G5(Gamma::Gamma5); + Gamma G5(Gamma::Algebra::Gamma5); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss+=Ls){ // adds Ls vobj tmp; @@ -116,7 +116,7 @@ void ag5xpbg5y_ssp(Lattice &z,Coeff a,const Lattice &x,Coeff b,const conformable(x,z); GridBase *grid=x._grid; int Ls = grid->_rdimensions[0]; - Gamma G5(Gamma::Gamma5); + Gamma G5(Gamma::Algebra::Gamma5); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss+=Ls){ // adds Ls vobj tmp1; @@ -168,7 +168,7 @@ void G5R5(Lattice &z,const Lattice &x) z.checkerboard = x.checkerboard; conformable(x,z); int Ls = grid->_rdimensions[0]; - Gamma G5(Gamma::Gamma5); + Gamma G5(Gamma::Algebra::Gamma5); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss+=Ls){ // adds Ls vobj tmp; diff --git a/scripts/filelist b/scripts/filelist index 1ab95c7c..a3680d1c 100755 --- a/scripts/filelist +++ b/scripts/filelist @@ -4,9 +4,9 @@ home=`pwd` # library Make.inc cd $home/lib -HFILES=`find . -type f -name '*.h' -not -path '*/Old/*' -not -path '*/Eigen/*'` +HFILES=`find . -type f -name '*.h' -not -path '*/gamma-gen/*' -not -path '*/Old/*' -not -path '*/Eigen/*'` HFILES="$HFILES" -CCFILES=`find . -type f -name '*.cc' -not -name '*ommunicator*.cc'` +CCFILES=`find . -type f -name '*.cc' -not -path '*/gamma-gen/*' -not -name '*ommunicator*.cc'` echo HFILES=$HFILES > Make.inc echo >> Make.inc echo CCFILES=$CCFILES >> Make.inc diff --git a/tests/Test_cayley_even_odd_vec.cc b/tests/Test_cayley_even_odd_vec.cc index f8600782..f39f4ac1 100644 --- a/tests/Test_cayley_even_odd_vec.cc +++ b/tests/Test_cayley_even_odd_vec.cc @@ -36,12 +36,12 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT - }; + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT + }; typedef DomainWallFermion DomainWallVecFermionR; typedef ZMobiusFermion ZMobiusVecFermionR; @@ -339,7 +339,7 @@ void TestMoo(This & Dw, That &sDw) LatticeFermion ndiff(ngrid); LatticeFermion sdiff(sgrid); - Gamma g5( Gamma::Gamma5 ); + Gamma g5( Gamma::Algebra::Gamma5 ); std::vector seeds({1,2,3,4,5,7,8}); GridParallelRNG RNG5(ngrid); diff --git a/tests/Test_dwf_mixedcg_prec.cc b/tests/Test_dwf_mixedcg_prec.cc index 56394a5e..2601b76c 100644 --- a/tests/Test_dwf_mixedcg_prec.cc +++ b/tests/Test_dwf_mixedcg_prec.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/core/Test_cf_coarsen_support.cc b/tests/core/Test_cf_coarsen_support.cc index 325cc3a5..fab8c97c 100644 --- a/tests/core/Test_cf_coarsen_support.cc +++ b/tests/core/Test_cf_coarsen_support.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/core/Test_checker.cc b/tests/core/Test_checker.cc index a974965b..56b0eb60 100644 --- a/tests/core/Test_checker.cc +++ b/tests/core/Test_checker.cc @@ -37,11 +37,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int toint(const char* str){ diff --git a/tests/core/Test_contfrac_even_odd.cc b/tests/core/Test_contfrac_even_odd.cc index 28f56797..4698f2b9 100644 --- a/tests/core/Test_contfrac_even_odd.cc +++ b/tests/core/Test_contfrac_even_odd.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; diff --git a/tests/core/Test_dwf_even_odd.cc b/tests/core/Test_dwf_even_odd.cc index 5c60d84b..8fa3f1d1 100644 --- a/tests/core/Test_dwf_even_odd.cc +++ b/tests/core/Test_dwf_even_odd.cc @@ -37,11 +37,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; diff --git a/tests/core/Test_dwf_rb5d.cc b/tests/core/Test_dwf_rb5d.cc index ab9e4d6e..a3099c7c 100644 --- a/tests/core/Test_dwf_rb5d.cc +++ b/tests/core/Test_dwf_rb5d.cc @@ -37,11 +37,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; typedef WilsonFermion5D WilsonFermion5DR; diff --git a/tests/core/Test_fft.cc b/tests/core/Test_fft.cc index 03c8bc52..877683f0 100644 --- a/tests/core/Test_fft.cc +++ b/tests/core/Test_fft.cc @@ -177,7 +177,7 @@ int main (int argc, char ** argv) const int sdir=0; RealD mass=0.01; RealD M5 =1.0; - Gamma G5(Gamma::Gamma5); + Gamma G5(Gamma::Algebra::Gamma5); GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,&GRID); GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,&GRID); @@ -218,12 +218,12 @@ int main (int argc, char ** argv) ///////////////////////////////////////////////////////////////// // work out the predicted from Fourier ///////////////////////////////////////////////////////////////// - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT, - Gamma::Gamma5 + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT, + Gamma::Algebra::Gamma5 }; LatticeFermionD Kinetic(FGrid); Kinetic = zero; LatticeComplexD kmu(FGrid); @@ -311,7 +311,7 @@ int main (int argc, char ** argv) std::cout << " Solving by FFT and Feynman rules" < diff --git a/tests/debug/Test_cayley_coarsen_support.cc b/tests/debug/Test_cayley_coarsen_support.cc index 9c740b8b..2d503df8 100644 --- a/tests/debug/Test_cayley_coarsen_support.cc +++ b/tests/debug/Test_cayley_coarsen_support.cc @@ -38,11 +38,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/debug/Test_cayley_even_odd.cc b/tests/debug/Test_cayley_even_odd.cc index 5c15450c..7d8d2a12 100644 --- a/tests/debug/Test_cayley_even_odd.cc +++ b/tests/debug/Test_cayley_even_odd.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; diff --git a/tests/solver/Test_cf_cr_unprec.cc b/tests/solver/Test_cf_cr_unprec.cc index 59031ba8..d7d8f51a 100644 --- a/tests/solver/Test_cf_cr_unprec.cc +++ b/tests/solver/Test_cf_cr_unprec.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/solver/Test_contfrac_cg.cc b/tests/solver/Test_contfrac_cg.cc index 5e495071..13f80f69 100644 --- a/tests/solver/Test_contfrac_cg.cc +++ b/tests/solver/Test_contfrac_cg.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; diff --git a/tests/solver/Test_dwf_cg_prec.cc b/tests/solver/Test_dwf_cg_prec.cc index d248c560..30436e36 100644 --- a/tests/solver/Test_dwf_cg_prec.cc +++ b/tests/solver/Test_dwf_cg_prec.cc @@ -37,8 +37,8 @@ struct scal { d internal; }; -Gamma::GammaMatrix Gmu[] = {Gamma::GammaX, Gamma::GammaY, Gamma::GammaZ, - Gamma::GammaT}; +Gamma::Algebra Gmu[] = {Gamma::Algebra::GammaX, Gamma::Algebra::GammaY, Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT}; int main(int argc, char** argv) { Grid_init(&argc, &argv); diff --git a/tests/solver/Test_dwf_cg_schur.cc b/tests/solver/Test_dwf_cg_schur.cc index 75ca3521..62a95235 100644 --- a/tests/solver/Test_dwf_cg_schur.cc +++ b/tests/solver/Test_dwf_cg_schur.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/solver/Test_dwf_cg_unprec.cc b/tests/solver/Test_dwf_cg_unprec.cc index 41a05042..89e9088e 100644 --- a/tests/solver/Test_dwf_cg_unprec.cc +++ b/tests/solver/Test_dwf_cg_unprec.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/solver/Test_dwf_cr_unprec.cc b/tests/solver/Test_dwf_cr_unprec.cc index 9ee38d35..7549137a 100644 --- a/tests/solver/Test_dwf_cr_unprec.cc +++ b/tests/solver/Test_dwf_cr_unprec.cc @@ -37,11 +37,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/solver/Test_dwf_fpgcr.cc b/tests/solver/Test_dwf_fpgcr.cc index 3b0f99d0..aaf622b9 100644 --- a/tests/solver/Test_dwf_fpgcr.cc +++ b/tests/solver/Test_dwf_fpgcr.cc @@ -38,11 +38,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/solver/Test_dwf_hdcr.cc b/tests/solver/Test_dwf_hdcr.cc index 313b2077..64ca0b33 100644 --- a/tests/solver/Test_dwf_hdcr.cc +++ b/tests/solver/Test_dwf_hdcr.cc @@ -504,7 +504,7 @@ int main (int argc, char ** argv) GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4); GridParallelRNG CRNG(Coarse5d);CRNG.SeedFixedIntegers(cseeds); - Gamma g5(Gamma::Gamma5); + Gamma g5(Gamma::Algebra::Gamma5); LatticeFermion src(FGrid); gaussian(RNG5,src);// src=src+g5*src; LatticeFermion result(FGrid); result=zero; diff --git a/tests/solver/Test_wilson_cg_prec.cc b/tests/solver/Test_wilson_cg_prec.cc index 7cc9d574..e336161f 100644 --- a/tests/solver/Test_wilson_cg_prec.cc +++ b/tests/solver/Test_wilson_cg_prec.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/solver/Test_wilson_cg_schur.cc b/tests/solver/Test_wilson_cg_schur.cc index 1ea6a07c..8b62b040 100644 --- a/tests/solver/Test_wilson_cg_schur.cc +++ b/tests/solver/Test_wilson_cg_schur.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/solver/Test_wilson_cg_unprec.cc b/tests/solver/Test_wilson_cg_unprec.cc index 34b0a687..bb429468 100644 --- a/tests/solver/Test_wilson_cg_unprec.cc +++ b/tests/solver/Test_wilson_cg_unprec.cc @@ -37,11 +37,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) diff --git a/tests/solver/Test_wilson_cr_unprec.cc b/tests/solver/Test_wilson_cr_unprec.cc index 4a517461..add5c2ba 100644 --- a/tests/solver/Test_wilson_cr_unprec.cc +++ b/tests/solver/Test_wilson_cr_unprec.cc @@ -36,11 +36,11 @@ struct scal { d internal; }; - Gamma::GammaMatrix Gmu [] = { - Gamma::GammaX, - Gamma::GammaY, - Gamma::GammaZ, - Gamma::GammaT + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT }; int main (int argc, char ** argv) From f7db342f4987f46c101c1c47cc3f41411280d0fd Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Tue, 24 Jan 2017 17:33:26 -0800 Subject: [PATCH 02/10] Serialisable enums can be converted to int --- lib/serialisation/MacroMagic.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/serialisation/MacroMagic.h b/lib/serialisation/MacroMagic.h index c9137dfe..ae8ee086 100644 --- a/lib/serialisation/MacroMagic.h +++ b/lib/serialisation/MacroMagic.h @@ -152,14 +152,14 @@ friend inline std::ostream & operator << (std::ostream &os, const cname &obj ) { class name: public Serializable\ {\ public:\ - enum EnumType\ + enum\ {\ GRID_MACRO_EVAL(GRID_MACRO_MAP(GRID_MACRO_ENUMVAL,__VA_ARGS__))\ undefname = -1\ };\ public:\ name(void): value_(undefname) {};\ - name(EnumType value): value_(value) {};\ + name(int value): value_(value) {};\ template \ static inline void write(Writer &WR,const std::string &s, const name &obj)\ {\ @@ -179,7 +179,7 @@ public:\ GRID_MACRO_EVAL(GRID_MACRO_MAP(GRID_MACRO_ENUMTEST,__VA_ARGS__))\ else {obj = name::undefname;}\ }\ - inline operator EnumType(void) const\ + inline operator int(void) const\ {\ return value_;\ }\ @@ -192,7 +192,7 @@ public:\ return os;\ }\ private:\ - EnumType value_;\ + int value_;\ }; From 068b28af2dd9d5a1e19efb29bdcd0f4361a1092d Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Tue, 24 Jan 2017 17:35:29 -0800 Subject: [PATCH 03/10] Extensive gamma test program --- tests/core/Test_gamma.cc | 405 ++++++++++++++++++++------------------- 1 file changed, 209 insertions(+), 196 deletions(-) diff --git a/tests/core/Test_gamma.cc b/tests/core/Test_gamma.cc index a853f216..38a43a11 100644 --- a/tests/core/Test_gamma.cc +++ b/tests/core/Test_gamma.cc @@ -1,223 +1,236 @@ - /************************************************************************************* +/************************************************************************************* - Grid physics library, www.github.com/paboyle/Grid +Grid physics library, www.github.com/paboyle/Grid - Source file: ./tests/Test_gamma.cc +Source file: ./tests/Test_gamma.cc - Copyright (C) 2015 +Copyright (C) 2015-2017 Author: Azusa Yamaguchi Author: Peter Boyle +Author: Antonin Portelli - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - See the full license in the file "LICENSE" in the top level distribution directory - *************************************************************************************/ +See the full license in the file "LICENSE" in the top level distribution directory +*************************************************************************************/ /* END LEGAL */ #include using namespace std; using namespace Grid; -using namespace Grid::QCD; +using namespace QCD; -//template class is_pod< iScalar > -//{ -// -//}; +static constexpr double tolerance = 1.0e-6; +static std::array testAlgebra; -int main (int argc, char ** argv) +void print(const SpinMatrix &g) +{ + for(int i = 0; i < Ns; i++) + { + std::cout << GridLogMessage << "("; + for(int j=0;j testg; + SpinMatrix testg5; + const Complex I(0., 1.), mI(0., -1.); + + testg[0] = zero; + testg[0]()(0, 3) = I; + testg[0]()(1, 2) = I; + testg[0]()(2, 1) = mI; + testg[0]()(3, 0) = mI; + std::cout << GridLogMessage << "test GammaX= " << std::endl; + print(testg[0]); + testg[1] = zero; + testg[1]()(0, 3) = -1.; + testg[1]()(1, 2) = 1.; + testg[1]()(2, 1) = 1.; + testg[1]()(3, 0) = -1.; + std::cout << GridLogMessage << "test GammaY= " << std::endl; + print(testg[1]); + testg[2] = zero; + testg[2]()(0, 2) = I; + testg[2]()(1, 3) = mI; + testg[2]()(2, 0) = mI; + testg[2]()(3, 1) = I; + std::cout << GridLogMessage << "test GammaZ= " << std::endl; + print(testg[2]); + testg[3] = zero; + testg[3]()(0, 2) = 1.; + testg[3]()(1, 3) = 1.; + testg[3]()(2, 0) = 1.; + testg[3]()(3, 1) = 1.; + std::cout << GridLogMessage << "test GammaT= " << std::endl; + print(testg[3]); + testg5 = testg[0]*testg[1]*testg[2]*testg[3]; + +#define DEFINE_TEST_G(g, exp)\ +testAlgebra[Gamma::Algebra::g] = exp;\ +testAlgebra[Gamma::Algebra::Minus##g] = -exp;\ + + DEFINE_TEST_G(Identity , 1.); + DEFINE_TEST_G(Gamma5 , testg5); + DEFINE_TEST_G(GammaX , testg[0]); + DEFINE_TEST_G(GammaY , testg[1]); + DEFINE_TEST_G(GammaZ , testg[2]); + DEFINE_TEST_G(GammaT , testg[3]); + DEFINE_TEST_G(GammaXGamma5, testg[0]*testg5); + DEFINE_TEST_G(GammaYGamma5, testg[1]*testg5); + DEFINE_TEST_G(GammaZGamma5, testg[2]*testg5); + DEFINE_TEST_G(GammaTGamma5, testg[3]*testg5); + DEFINE_TEST_G(SigmaXY , .5*(testg[0]*testg[1] - testg[1]*testg[0])); + DEFINE_TEST_G(SigmaXZ , .5*(testg[0]*testg[2] - testg[2]*testg[0])); + DEFINE_TEST_G(SigmaXT , .5*(testg[0]*testg[3] - testg[3]*testg[0])); + DEFINE_TEST_G(SigmaYZ , .5*(testg[1]*testg[2] - testg[2]*testg[1])); + DEFINE_TEST_G(SigmaYT , .5*(testg[1]*testg[3] - testg[3]*testg[1])); + DEFINE_TEST_G(SigmaZT , .5*(testg[2]*testg[3] - testg[3]*testg[2])); + +#undef DEFINE_TEST_G +} + +template +void test(const Expr &a, const Expr &b) +{ + if (norm2(a - b) < tolerance) + { + std::cout << "[OK] "; + } + else + { + std::cout << "[fail]" << std::endl; + std::cout << GridLogError << "a= " << a << std::endl; + std::cout << GridLogError << "is different (tolerance= " << tolerance << ") from " << std::endl; + std::cout << GridLogError << "b= " << b << std::endl; + exit(EXIT_FAILURE); + } +} + +void checkMat(const Gamma::Algebra a, GridSerialRNG &rng) +{ + SpinVector v; + SpinMatrix m, &testg = testAlgebra[a]; + Gamma g(a); + bool pass = true; + + random(rng, v); + random(rng, m); + + std::cout << GridLogMessage << "Checking " << Gamma::name[a] << ": "; + std::cout << "vecmul "; + test(g*v, testg*v); + std::cout << "matlmul "; + test(g*m, testg*m); + std::cout << "matrmul "; + test(m*g, m*testg); + std::cout << std::endl; +} + +void checkProd(const Gamma::Algebra a, const Gamma::Algebra b) +{ + SpinMatrix gm, testg = testAlgebra[a]*testAlgebra[b]; + Gamma ga(a), gb(b), g = ga*gb; + bool pass = true; + + std::cout << GridLogMessage << "Checking " << Gamma::name[a] << " * " + << Gamma::name[b] << ": "; + gm = 1.0; + gm = g*gm; + test(gm, testg); + std::cout << "(= " << Gamma::name[g.g] << ")" << std::endl; +} + +void checkProject(GridSerialRNG &rng) +{ + SpinVector rv, recon, full; + HalfSpinVector hsp, hsm; + + random(rng, rv); + +#define CHECK_PROJ(dir, gamma)\ +std::cout << GridLogMessage << "Checking " << #dir << " projector: ";\ +spProj##dir(hsm,rv);\ +spRecon##dir(recon,hsm);\ +test(recon, rv + Gamma(Gamma::Algebra::gamma)*rv);\ +std::cout << std::endl; + + CHECK_PROJ(Xp, GammaX); + CHECK_PROJ(Yp, GammaY); + CHECK_PROJ(Zp, GammaZ); + CHECK_PROJ(Tp, GammaT); + CHECK_PROJ(5p, Gamma5); + CHECK_PROJ(Xm, MinusGammaX); + CHECK_PROJ(Ym, MinusGammaY); + CHECK_PROJ(Zm, MinusGammaZ); + CHECK_PROJ(Tm, MinusGammaT); + CHECK_PROJ(5m, MinusGamma5); + +#undef CHECK_PROJ +} + +int main(int argc, char *argv[]) { Grid_init(&argc,&argv); - + std::vector latt_size = GridDefaultLatt(); std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); std::vector mpi_layout = GridDefaultMpi(); - - GridCartesian Grid(latt_size,simd_layout,mpi_layout); - - GridParallelRNG pRNG(&Grid); - pRNG.SeedRandomDevice(); - - GridSerialRNG sRNG; + + GridCartesian Grid(latt_size,simd_layout,mpi_layout); + GridSerialRNG sRNG; + sRNG.SeedRandomDevice(); - - SpinMatrix ident; ident=zero; - SpinMatrix rnd ; random(sRNG,rnd); - - SpinMatrix ll; ll=zero; - SpinMatrix rr; rr=zero; - SpinMatrix result; - - SpinVector lv; random(sRNG,lv); - SpinVector rv; random(sRNG,rv); - - // std::cout<::value << std::endl; - // std::cout<::value << std::endl; - // std::cout<::value << std::endl; - // std::cout<::value << std::endl; - // std::cout<::value << std::endl; - // std::cout< " << std::is_pod >::value << std::endl; - // std::cout< " << std::is_pod >::value << std::endl; - // std::cout< " << std::is_pod >::value << std::endl; - // std::cout< " << std::is_pod >::value << std::endl; - // std::cout< " << std::is_pod >::value << std::endl; - // std::cout< " << std::is_pod >::value << std::endl; - // std::cout< " < >::value << std::endl; - // std::cout< "< >::value << std::endl; - - for(int a=0;a Date: Tue, 24 Jan 2017 17:35:42 -0800 Subject: [PATCH 04/10] .gitignore update --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5838caf7..444bcd8e 100644 --- a/.gitignore +++ b/.gitignore @@ -104,4 +104,9 @@ lib/fftw/* # libtool macros # ################## m4/lt* -m4/libtool.m4 \ No newline at end of file +m4/libtool.m4 + +# generated sources # +##################### +lib/qcd/spin/gamma-gen/*.h +lib/qcd/spin/gamma-gen/*.cc \ No newline at end of file From 0432e302565122b554a051dd664d1a245702dc18 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Tue, 24 Jan 2017 17:36:23 -0800 Subject: [PATCH 05/10] Gamma right multiply code fix (now passes consistency check) --- lib/qcd/spin/Dirac.h | 96 +++++------ lib/qcd/spin/gamma-gen/gamma-gen.nb | 254 +++++++++++++++++++++++----- 2 files changed, 263 insertions(+), 87 deletions(-) diff --git a/lib/qcd/spin/Dirac.h b/lib/qcd/spin/Dirac.h index 1dd87cfc..e28cb94c 100644 --- a/lib/qcd/spin/Dirac.h +++ b/lib/qcd/spin/Dirac.h @@ -208,10 +208,10 @@ inline void rmultMinusGammaTGamma5(iMatrix &ret, const iMatrix &ret, const iMatrix { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = -rhs(i, 2); - ret(i, 1) = -rhs(i, 3); - ret(i, 2) = rhs(i, 0); - ret(i, 3) = rhs(i, 1); + ret(i, 0) = rhs(i, 2); + ret(i, 1) = rhs(i, 3); + ret(i, 2) = -rhs(i, 0); + ret(i, 3) = -rhs(i, 1); } }; @@ -274,10 +274,10 @@ inline void rmultMinusGammaX(iMatrix &ret, const iMatrix & { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = timesMinusI(rhs(i, 3)); - ret(i, 1) = timesMinusI(rhs(i, 2)); - ret(i, 2) = timesI(rhs(i, 1)); - ret(i, 3) = timesI(rhs(i, 0)); + ret(i, 0) = timesI(rhs(i, 3)); + ret(i, 1) = timesI(rhs(i, 2)); + ret(i, 2) = timesMinusI(rhs(i, 1)); + ret(i, 3) = timesMinusI(rhs(i, 0)); } }; @@ -307,10 +307,10 @@ inline void rmultGammaX(iMatrix &ret, const iMatrix &rhs) { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = timesI(rhs(i, 3)); - ret(i, 1) = timesI(rhs(i, 2)); - ret(i, 2) = timesMinusI(rhs(i, 1)); - ret(i, 3) = timesMinusI(rhs(i, 0)); + ret(i, 0) = timesMinusI(rhs(i, 3)); + ret(i, 1) = timesMinusI(rhs(i, 2)); + ret(i, 2) = timesI(rhs(i, 1)); + ret(i, 3) = timesI(rhs(i, 0)); } }; @@ -472,10 +472,10 @@ inline void rmultMinusGammaYGamma5(iMatrix &ret, const iMatrix &ret, const iMatrix { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = rhs(i, 3); - ret(i, 1) = -rhs(i, 2); - ret(i, 2) = rhs(i, 1); - ret(i, 3) = -rhs(i, 0); + ret(i, 0) = -rhs(i, 3); + ret(i, 1) = rhs(i, 2); + ret(i, 2) = -rhs(i, 1); + ret(i, 3) = rhs(i, 0); } }; @@ -538,10 +538,10 @@ inline void rmultMinusGammaZ(iMatrix &ret, const iMatrix & { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = timesMinusI(rhs(i, 2)); - ret(i, 1) = timesI(rhs(i, 3)); - ret(i, 2) = timesI(rhs(i, 0)); - ret(i, 3) = timesMinusI(rhs(i, 1)); + ret(i, 0) = timesI(rhs(i, 2)); + ret(i, 1) = timesMinusI(rhs(i, 3)); + ret(i, 2) = timesMinusI(rhs(i, 0)); + ret(i, 3) = timesI(rhs(i, 1)); } }; @@ -571,10 +571,10 @@ inline void rmultGammaZ(iMatrix &ret, const iMatrix &rhs) { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = timesI(rhs(i, 2)); - ret(i, 1) = timesMinusI(rhs(i, 3)); - ret(i, 2) = timesMinusI(rhs(i, 0)); - ret(i, 3) = timesI(rhs(i, 1)); + ret(i, 0) = timesMinusI(rhs(i, 2)); + ret(i, 1) = timesI(rhs(i, 3)); + ret(i, 2) = timesI(rhs(i, 0)); + ret(i, 3) = timesMinusI(rhs(i, 1)); } }; @@ -868,10 +868,10 @@ inline void rmultMinusSigmaXZ(iMatrix &ret, const iMatrix { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = rhs(i, 1); - ret(i, 1) = -rhs(i, 0); - ret(i, 2) = rhs(i, 3); - ret(i, 3) = -rhs(i, 2); + ret(i, 0) = -rhs(i, 1); + ret(i, 1) = rhs(i, 0); + ret(i, 2) = -rhs(i, 3); + ret(i, 3) = rhs(i, 2); } }; @@ -901,10 +901,10 @@ inline void rmultSigmaXZ(iMatrix &ret, const iMatrix &rhs) { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = -rhs(i, 1); - ret(i, 1) = rhs(i, 0); - ret(i, 2) = -rhs(i, 3); - ret(i, 3) = rhs(i, 2); + ret(i, 0) = rhs(i, 1); + ret(i, 1) = -rhs(i, 0); + ret(i, 2) = rhs(i, 3); + ret(i, 3) = -rhs(i, 2); } }; @@ -934,10 +934,10 @@ inline void rmultMinusSigmaYT(iMatrix &ret, const iMatrix { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = rhs(i, 1); - ret(i, 1) = -rhs(i, 0); - ret(i, 2) = -rhs(i, 3); - ret(i, 3) = rhs(i, 2); + ret(i, 0) = -rhs(i, 1); + ret(i, 1) = rhs(i, 0); + ret(i, 2) = rhs(i, 3); + ret(i, 3) = -rhs(i, 2); } }; @@ -967,10 +967,10 @@ inline void rmultSigmaYT(iMatrix &ret, const iMatrix &rhs) { for(unsigned int i = 0; i < Ns; ++i) { - ret(i, 0) = -rhs(i, 1); - ret(i, 1) = rhs(i, 0); - ret(i, 2) = rhs(i, 3); - ret(i, 3) = -rhs(i, 2); + ret(i, 0) = rhs(i, 1); + ret(i, 1) = -rhs(i, 0); + ret(i, 2) = -rhs(i, 3); + ret(i, 3) = rhs(i, 2); } }; diff --git a/lib/qcd/spin/gamma-gen/gamma-gen.nb b/lib/qcd/spin/gamma-gen/gamma-gen.nb index a513e1d1..ca077654 100644 --- a/lib/qcd/spin/gamma-gen/gamma-gen.nb +++ b/lib/qcd/spin/gamma-gen/gamma-gen.nb @@ -10,10 +10,10 @@ NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] -NotebookDataLength[ 55210, 1449] -NotebookOptionsPosition[ 53631, 1395] -NotebookOutlinePosition[ 53992, 1411] -CellTagsIndexPosition[ 53949, 1408] +NotebookDataLength[ 60858, 1625] +NotebookOptionsPosition[ 58965, 1561] +NotebookOutlinePosition[ 59326, 1577] +CellTagsIndexPosition[ 59283, 1574] WindowFrame->Normal*) (* Beginning of Notebook Content *) @@ -59,7 +59,8 @@ Cell[BoxData["\<\"/Users/antonin/Development/Grid/lib/qcd/spin/gamma-gen\"\>"]\ 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.6942153028002653`*^9, 3.694215388363636*^9, 3.694215531793765*^9, + 3.694293467607703*^9}] }, Open ]], Cell[CellGroupData[{ @@ -256,6 +257,168 @@ Cell[BoxData[{ 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}}], @@ -352,7 +515,8 @@ Cell[BoxData[ 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.694215303184371*^9, 3.694215388782826*^9, 3.694215532274271*^9, + 3.694293468120837*^9}] }, Open ]], Cell["Full multiplication table:", "Text", @@ -534,7 +698,8 @@ Cell[BoxData[ 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.694215303248364*^9, 3.694215388866436*^9, 3.694215532359406*^9, + 3.694293468220346*^9}] }, Open ]] }, Open ]], @@ -1014,9 +1179,9 @@ Cell[BoxData[{ RowBox[{"ir", "+", "1"}]}]}], ",", RowBox[{"{", RowBox[{"c", ",", - RowBox[{ - RowBox[{"mat", "[", "g", "]"}], ".", "rhsv"}]}], "}"}]}], "]"}], - ";", "\[IndentingNewLine]", + RowBox[{"rhsv", ".", + RowBox[{"mat", "[", "g", "]"}]}]}], "}"}]}], "]"}], ";", + "\[IndentingNewLine]", RowBox[{"out", " ", "=", RowBox[{"out", "<>", "\"\< }\\n};\\n\>\""}]}], ";", "\[IndentingNewLine]", @@ -1238,7 +1403,8 @@ iMatrix>::type \n{\n iMatrix ret;\n for(int i=0;i{{0, 0}, {0, 0.5}}, @@ -1394,7 +1560,7 @@ Cell[BoxData[ }, Open ]] }, WindowSize->{1246, 1005}, -WindowMargins->{{Automatic, 155}, {Automatic, 0}}, +WindowMargins->{{213, Automatic}, {Automatic, 0}}, FrontEndVersion->"11.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (September \ 21, 2016)", StyleDefinitions->"Default.nb" @@ -1413,43 +1579,53 @@ Notebook[{ Cell[558, 20, 1295, 18, 502, "Text"], Cell[CellGroupData[{ Cell[1878, 42, 393, 8, 75, "Input"], -Cell[2274, 52, 654, 9, 32, "Output"] +Cell[2274, 52, 680, 10, 32, "Output"] }, Open ]], Cell[CellGroupData[{ -Cell[2965, 66, 114, 1, 64, "Section"], -Cell[3082, 69, 475, 14, 54, "Input"], -Cell[3560, 85, 139, 1, 30, "Text"], -Cell[3702, 88, 5454, 168, 427, "Input"], -Cell[9159, 258, 119, 1, 30, "Text"], -Cell[9281, 261, 1295, 41, 96, "Input"], -Cell[10579, 304, 133, 1, 30, "Text"], +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[10737, 309, 479, 15, 32, "Input"], -Cell[11219, 326, 1259, 28, 96, "Output"] +Cell[9207, 261, 547, 16, 54, "Input"], +Cell[9757, 279, 820, 23, 92, "Output"], +Cell[10580, 304, 1245, 31, 92, "Output"] }, Open ]], -Cell[12493, 357, 110, 1, 30, "Text"], Cell[CellGroupData[{ -Cell[12628, 362, 476, 12, 32, "Input"], -Cell[13107, 376, 6313, 160, 312, "Output"] +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[19469, 542, 117, 1, 64, "Section"], -Cell[19589, 545, 128, 2, 38, "Text"], -Cell[19720, 549, 2518, 48, 747, "Input"], -Cell[22241, 599, 164, 3, 38, "Text"], -Cell[22408, 604, 4876, 148, 684, "Input"], -Cell[27287, 754, 2588, 55, 201, "Input"], -Cell[29878, 811, 149, 2, 38, "Text"], -Cell[30030, 815, 17190, 425, 3456, "Input"], -Cell[47223, 1242, 137, 2, 38, "Text"], -Cell[47363, 1246, 468, 11, 32, "Input"] +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[47868, 1262, 116, 1, 64, "Section"], -Cell[47987, 1265, 3046, 66, 285, "Input"], -Cell[51036, 1333, 2179, 48, 432, "Input"], -Cell[53218, 1383, 397, 9, 32, "Input"] +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 ]] } ] From 05cb6d318a6b14ef314b6ac784e2f9886d684f41 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Tue, 24 Jan 2017 18:07:43 -0800 Subject: [PATCH 06/10] gammas: adjoint implemented as a symbolic operation --- lib/qcd/QCD.h | 8 + lib/qcd/spin/Dirac.h | 19 +- lib/qcd/spin/GammaMulTable.h | 37 ++- lib/qcd/spin/gamma-gen/gamma-gen.nb | 337 +++++++++------------------- tests/core/Test_gamma.cc | 22 +- 5 files changed, 190 insertions(+), 233 deletions(-) diff --git a/lib/qcd/QCD.h b/lib/qcd/QCD.h index f434bdd9..9321e575 100644 --- a/lib/qcd/QCD.h +++ b/lib/qcd/QCD.h @@ -51,6 +51,14 @@ namespace QCD { static const int Nhs=2; // half spinor static const int Nds=8; // double stored gauge field static const int Ngp=2; // gparity index range + + // if no adj funtion in QCD:: redirect to Grid:: + // this avoids QCD:: adj functions to screen the Grid:: ones + template + inline auto adj(T x)->decltype(Grid::adj(x)) + { + return Grid::adj(x); + } ////////////////////////////////////////////////////////////////////////////// // QCD iMatrix types diff --git a/lib/qcd/spin/Dirac.h b/lib/qcd/spin/Dirac.h index e28cb94c..a18e4b5a 100644 --- a/lib/qcd/spin/Dirac.h +++ b/lib/qcd/spin/Dirac.h @@ -44,12 +44,24 @@ class Gamma { MinusSigmaZT , 30, SigmaZT , 31); static constexpr unsigned int nGamma = 32; - static const std::array name; + static const std::array name; static const std::array, nGamma> mul; + static const std::array adj; Algebra g; public: Gamma(Algebra initg): g(initg) {} }; + +inline Gamma operator*(const Gamma &g1, const Gamma &g2) +{ + return Gamma(Gamma::mul[g1.g][g2.g]); +} + +inline Gamma adj(const Gamma &g) +{ + return Gamma(Gamma::adj[g.g]); +} + template inline void multMinusGamma5(iVector &ret, const iVector &rhs) { @@ -1403,11 +1415,6 @@ inline auto operator*(const iMatrix &arg, const Gamma &G) return ret; } -inline Gamma operator*(const Gamma &g1, const Gamma &g2) -{ - return Gamma(Gamma::mul[g1.g][g2.g]); -} - }} #endif diff --git a/lib/qcd/spin/GammaMulTable.h b/lib/qcd/spin/GammaMulTable.h index fd483323..1839ed8c 100644 --- a/lib/qcd/spin/GammaMulTable.h +++ b/lib/qcd/spin/GammaMulTable.h @@ -1055,4 +1055,39 @@ Gamma::mul = {{ Gamma::Algebra::MinusSigmaYT, Gamma::Algebra::Identity, Gamma::Algebra::MinusIdentity} -}}; \ No newline at end of file +}}; + +const std::array Gamma::adj = { + Gamma::Algebra::MinusGamma5, + Gamma::Algebra::Gamma5, + Gamma::Algebra::MinusGammaT, + Gamma::Algebra::GammaT, + Gamma::Algebra::GammaTGamma5, + Gamma::Algebra::MinusGammaTGamma5, + Gamma::Algebra::MinusGammaX, + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaXGamma5, + Gamma::Algebra::MinusGammaXGamma5, + Gamma::Algebra::MinusGammaY, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaYGamma5, + Gamma::Algebra::MinusGammaYGamma5, + Gamma::Algebra::MinusGammaZ, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaZGamma5, + Gamma::Algebra::MinusGammaZGamma5, + Gamma::Algebra::MinusIdentity, + Gamma::Algebra::Identity, + Gamma::Algebra::SigmaXT, + Gamma::Algebra::MinusSigmaXT, + Gamma::Algebra::SigmaXY, + Gamma::Algebra::MinusSigmaXY, + Gamma::Algebra::SigmaXZ, + Gamma::Algebra::MinusSigmaXZ, + Gamma::Algebra::SigmaYT, + Gamma::Algebra::MinusSigmaYT, + Gamma::Algebra::SigmaYZ, + Gamma::Algebra::MinusSigmaYZ, + Gamma::Algebra::SigmaZT, + Gamma::Algebra::MinusSigmaZT +}; diff --git a/lib/qcd/spin/gamma-gen/gamma-gen.nb b/lib/qcd/spin/gamma-gen/gamma-gen.nb index ca077654..d41b3e2e 100644 --- a/lib/qcd/spin/gamma-gen/gamma-gen.nb +++ b/lib/qcd/spin/gamma-gen/gamma-gen.nb @@ -10,10 +10,10 @@ NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] -NotebookDataLength[ 60858, 1625] -NotebookOptionsPosition[ 58965, 1561] -NotebookOutlinePosition[ 59326, 1577] -CellTagsIndexPosition[ 59283, 1574] +NotebookDataLength[ 58006, 1512] +NotebookOptionsPosition[ 56426, 1458] +NotebookOutlinePosition[ 56786, 1474] +CellTagsIndexPosition[ 56743, 1471] WindowFrame->Normal*) (* Beginning of Notebook Content *) @@ -43,12 +43,14 @@ Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{"ClearAll", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"Unprotect", "[", "\"\\"", "]"}], + RowBox[{"Unprotect", "[", "\"\\"", "]"}], ";", + RowBox[{"Unprotect", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"SetDirectory", "[", RowBox[{"NotebookDirectory", "[", "]"}], "]"}]}], "Input", CellChangeTimes->{{3.69418610909842*^9, 3.694186122331771*^9}, { - 3.694189694542165*^9, 3.6941897146300087`*^9}}], + 3.694189694542165*^9, 3.6941897146300087`*^9}, {3.694297413625847*^9, + 3.694297419003489*^9}}], Cell[BoxData["\<\"/Users/antonin/Development/Grid/lib/qcd/spin/gamma-gen\"\>"]\ , "Output", @@ -60,7 +62,9 @@ Cell[BoxData["\<\"/Users/antonin/Development/Grid/lib/qcd/spin/gamma-gen\"\>"]\ 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}] + 3.694293467607703*^9, 3.694294096138891*^9, 3.694297419616928*^9, + 3.694297655191285*^9, 3.69429782738804*^9, 3.694297901657515*^9, + 3.6942984168973837`*^9}] }, Open ]], Cell[CellGroupData[{ @@ -85,7 +89,8 @@ Cell[BoxData[{ 3.694184821238667*^9, 3.6941848260602217`*^9}}], Cell["Definition of the matrix representation of the algebra:", "Text", - CellChangeTimes->{{3.6942090405172586`*^9, 3.694209073962101*^9}}], + CellChangeTimes->{{3.6942090405172586`*^9, 3.694209073962101*^9}, { + 3.6942974330697393`*^9, 3.694297433821431*^9}}], Cell[BoxData[{ RowBox[{ @@ -257,168 +262,6 @@ Cell[BoxData[{ 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}}], @@ -460,10 +303,32 @@ Cell[BoxData[{ RowBox[{ RowBox[{"-", "i1_"}], ",", RowBox[{"-", "i2_"}]}], "]"}], ":=", - RowBox[{"i1", ".", "i2"}]}], ";"}]}], "Input", + RowBox[{"i1", ".", "i2"}]}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"Do", "[", + RowBox[{ + RowBox[{ + RowBox[{"ConjugateTranspose", "[", "i", "]"}], "=", + RowBox[{ + RowBox[{"Select", "[", + RowBox[{"alg", ",", + RowBox[{ + RowBox[{ + RowBox[{"ConjugateTranspose", "[", + RowBox[{"mat", "[", "i", "]"}], "]"}], "\[Equal]", + RowBox[{"mat", "[", "#", "]"}]}], "&"}]}], "]"}], "[", + RowBox[{"[", "1", "]"}], "]"}]}], ",", + RowBox[{"{", + RowBox[{"i", ",", "palg"}], "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"ConjugateTranspose", "[", + RowBox[{"-", "i_"}], "]"}], ":=", + RowBox[{"-", + RowBox[{"ConjugateTranspose", "[", "i", "]"}]}]}]}], "Input", CellChangeTimes->{{3.6941860329437103`*^9, 3.6941860343133917`*^9}, { 3.694186163571176*^9, 3.6941862016761427`*^9}, {3.69418700219066*^9, - 3.6941870425469627`*^9}}], + 3.6941870425469627`*^9}, {3.694297326197534*^9, 3.6942974062629423`*^9}, { + 3.694297634175386*^9, 3.6942976496897383`*^9}}], Cell["Check that we can reconstruct the Euclidean metric:", "Text", CellChangeTimes->{{3.694209080190936*^9, 3.694209096585559*^9}}], @@ -516,7 +381,8 @@ Cell[BoxData[ 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}] + 3.694293468120837*^9, 3.69429409699356*^9, 3.694297655587861*^9, + 3.694297827778974*^9, 3.694297902050129*^9, 3.694298417447421*^9}] }, Open ]], Cell["Full multiplication table:", "Text", @@ -699,7 +565,8 @@ Cell[BoxData[ 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}] + 3.694293468220346*^9, 3.694294097121203*^9, 3.694297655690278*^9, + 3.694297827858612*^9, 3.694297902125073*^9, 3.694298417530912*^9}] }, Open ]] }, Open ]], @@ -733,18 +600,18 @@ generated by the Mathematica notebook gamma-gen/gamma-gen.nb\n\n#include \ RowBox[{"out", "=", RowBox[{ "out", "<>", - "\"\< static const std::array \ - name;\n static const std::array, nGamma> \ -mul;\n Algebra g;\n \ -public:\n Gamma(Algebra initg): g(initg) {} \n};\n\>\""}]}], ";", - "\[IndentingNewLine]", + "\"\< static const std::array \ +name;\n static const std::array, nGamma> mul;\n\ + static const std::array adj;\n \ +Algebra g;\n public:\n \ + Gamma(Algebra initg): g(initg) {} \n};\n\ninline Gamma operator*(const \ +Gamma &g1, const Gamma &g2)\n{\n return Gamma(Gamma::mul[g1.g][g2.g]);\n}\n\n\ +inline Gamma adj(const Gamma &g)\n{\n return Gamma(Gamma::adj[g.g]);\n}\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\>\""}]}], ";", + RowBox[{"out", "<>", "\"\<\n}}\n\n#endif\n\>\""}]}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "out", "]"}]}]}], "]"}]}]], "Input", CellChangeTimes->{{3.69419645529875*^9, 3.694196727399803*^9}, { @@ -760,7 +627,8 @@ return Gamma(Gamma::mul[g1.g][g2.g]);\n}\n\n}}\n\n#endif\n\>\""}]}], ";", 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}}], + 3.6942155289376802`*^9}, {3.694297793776082*^9, 3.694297819122456*^9}, { + 3.694297854809973*^9, 3.694297889420939*^9}}], Cell["Gamma enum generation:", "Text", CellFrame->{{0, 0}, {0, 0.5}}, @@ -1472,7 +1340,34 @@ Gamma::nGamma> \nGamma::mul = {{\\n\>\""}], ";"}], "\[IndentingNewLine]", RowBox[{"i1", ",", "alg"}], "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"out", "=", - RowBox[{"out", "<>", "\"\<\\n}};\>\""}]}], ";"}], "\[IndentingNewLine]", + RowBox[{"out", "<>", "\"\<\\n}};\\n\\n\>\""}]}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"out", " ", "=", " ", + RowBox[{ + "out", "<>", + "\"\ Gamma::adj = \ +{\\n\>\""}]}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"Do", "[", "\[IndentingNewLine]", + RowBox[{ + RowBox[{"out", "=", + RowBox[{"out", "<>", "\"\< Gamma::\>\"", "<>", + RowBox[{"enum", "[", + RowBox[{"i", "\[ConjugateTranspose]"}], "]"}], "<>", + RowBox[{"If", "[", + RowBox[{ + RowBox[{"i", "\[Equal]", + RowBox[{"Last", "[", "alg", "]"}]}], ",", "\"\<\>\"", ",", + "\"\<,\\n\>\"", ",", "\"\<,\\n\>\""}], "]"}]}]}], ",", + "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{"i", ",", "alg"}], "}"}]}], "]"}], + ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"out", "=", + RowBox[{"out", "<>", "\"\<\\n};\\n\>\""}]}], + ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"file", "=", RowBox[{"OpenWrite", "[", "\"\\"", "]"}]}], @@ -1495,7 +1390,9 @@ Gamma::nGamma> \nGamma::mul = {{\\n\>\""}], ";"}], "\[IndentingNewLine]", 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}}], + 3.694215385261436*^9}, {3.694297237092742*^9, 3.6942972934131393`*^9}, { + 3.6942974934555683`*^9, 3.694297566898333*^9}, {3.694297598113819*^9, + 3.694297609176114*^9}, {3.694297683998802*^9, 3.694297711493322*^9}}], Cell[BoxData[ RowBox[{ @@ -1560,7 +1457,7 @@ Cell[BoxData[ }, Open ]] }, WindowSize->{1246, 1005}, -WindowMargins->{{213, Automatic}, {Automatic, 0}}, +WindowMargins->{{64, Automatic}, {Automatic, 0}}, FrontEndVersion->"11.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (September \ 21, 2016)", StyleDefinitions->"Default.nb" @@ -1578,54 +1475,44 @@ CellTagsIndex->{} Notebook[{ Cell[558, 20, 1295, 18, 502, "Text"], Cell[CellGroupData[{ -Cell[1878, 42, 393, 8, 75, "Input"], -Cell[2274, 52, 680, 10, 32, "Output"] +Cell[1878, 42, 513, 10, 75, "Input"], +Cell[2394, 54, 821, 12, 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[3252, 71, 114, 1, 64, "Section"], +Cell[3369, 74, 475, 14, 54, "Input"], +Cell[3847, 90, 190, 2, 30, "Text"], +Cell[4040, 94, 5454, 168, 427, "Input"], +Cell[9497, 264, 119, 1, 30, "Text"], +Cell[9619, 267, 2115, 63, 96, "Input"], +Cell[11737, 332, 133, 1, 30, "Text"], Cell[CellGroupData[{ -Cell[9207, 261, 547, 16, 54, "Input"], -Cell[9757, 279, 820, 23, 92, "Output"], -Cell[10580, 304, 1245, 31, 92, "Output"] +Cell[11895, 337, 479, 15, 32, "Input"], +Cell[12377, 354, 1398, 30, 96, "Output"] }, Open ]], +Cell[13790, 387, 110, 1, 30, "Text"], 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"] +Cell[13925, 392, 476, 12, 32, "Input"], +Cell[14404, 406, 6453, 162, 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"] +Cell[20906, 574, 117, 1, 64, "Section"], +Cell[21026, 577, 128, 2, 38, "Text"], +Cell[21157, 581, 2742, 49, 894, "Input"], +Cell[23902, 632, 164, 3, 38, "Text"], +Cell[24069, 637, 4876, 148, 684, "Input"], +Cell[28948, 787, 2588, 55, 201, "Input"], +Cell[31539, 844, 149, 2, 38, "Text"], +Cell[31691, 848, 17242, 426, 3456, "Input"], +Cell[48936, 1276, 137, 2, 38, "Text"], +Cell[49076, 1280, 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"] +Cell[49581, 1296, 116, 1, 64, "Section"], +Cell[49700, 1299, 4128, 95, 390, "Input"], +Cell[53831, 1396, 2179, 48, 432, "Input"], +Cell[56013, 1446, 397, 9, 32, "Input"] }, Open ]] } ] diff --git a/tests/core/Test_gamma.cc b/tests/core/Test_gamma.cc index 38a43a11..2bd6a9b2 100644 --- a/tests/core/Test_gamma.cc +++ b/tests/core/Test_gamma.cc @@ -160,7 +160,7 @@ void checkMat(const Gamma::Algebra a, GridSerialRNG &rng) void checkProd(const Gamma::Algebra a, const Gamma::Algebra b) { SpinMatrix gm, testg = testAlgebra[a]*testAlgebra[b]; - Gamma ga(a), gb(b), g = ga*gb; + Gamma g = Gamma(a)*Gamma(b); bool pass = true; std::cout << GridLogMessage << "Checking " << Gamma::name[a] << " * " @@ -171,6 +171,19 @@ void checkProd(const Gamma::Algebra a, const Gamma::Algebra b) std::cout << "(= " << Gamma::name[g.g] << ")" << std::endl; } +void checkAdj(const Gamma::Algebra a) +{ + SpinMatrix gm, testg = adj(testAlgebra[a]); + Gamma g(adj(Gamma(a))); + bool pass = true; + + std::cout << GridLogMessage << "Checking adj(" << Gamma::name[a] << "): "; + gm = 1.0; + gm = g*gm; + test(gm, testg); + std::cout << "(= " << Gamma::name[g.g] << ")" << std::endl; +} + void checkProject(GridSerialRNG &rng) { SpinVector rv, recon, full; @@ -227,8 +240,15 @@ int main(int argc, char *argv[]) checkProd(i, j); } std::cout << GridLogMessage << std::endl; + std::cout << GridLogMessage << "======== Adjoints check" << std::endl; + for (int i = 0; i < Gamma::nGamma; ++i) + { + checkAdj(i); + } + std::cout << GridLogMessage << std::endl; std::cout << GridLogMessage << "======== Spin projectors check" << std::endl; checkProject(sRNG); + std::cout << GridLogMessage << std::endl; Grid_finalize(); From 4d3787db65048040bf7219738e4eaa3d47b43ed8 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Wed, 25 Jan 2017 09:59:00 -0800 Subject: [PATCH 07/10] =?UTF-8?q?Hadrons=20fixed=20for=20new=20gammas,=20M?= =?UTF-8?q?eson=20only=20does=20one=20contraction=20but=20this=E2=80=99ll?= =?UTF-8?q?=20change=20in=20the=20future?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extras/Hadrons/Modules/MContraction/Meson.hpp | 37 +++++++------------ extras/Hadrons/Modules/MSource/SeqGamma.hpp | 15 ++++---- tests/hadrons/Test_hadrons_meson_3pt.cc | 18 +++++++-- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/extras/Hadrons/Modules/MContraction/Meson.hpp b/extras/Hadrons/Modules/MContraction/Meson.hpp index 09cb0338..c8ea3371 100644 --- a/extras/Hadrons/Modules/MContraction/Meson.hpp +++ b/extras/Hadrons/Modules/MContraction/Meson.hpp @@ -45,9 +45,11 @@ class MesonPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(MesonPar, - std::string, q1, - std::string, q2, - std::string, output); + std::string, q1, + std::string, q2, + std::string, output, + Gamma::Algebra, gammaSource, + Gamma::Algebra, gammaSink); }; template @@ -59,8 +61,7 @@ public: class Result: Serializable { public: - GRID_SERIALIZABLE_CLASS_MEMBERS(Result, - std::vector>>, corr); + GRID_SERIALIZABLE_CLASS_MEMBERS(Result, std::vector, corr); }; public: // constructor @@ -114,29 +115,17 @@ void TMeson::execute(void) PropagatorField1 &q1 = *env().template getObject(par().q1); PropagatorField2 &q2 = *env().template getObject(par().q2); LatticeComplex c(env().getGrid()); - SpinMatrix g[Ns*Ns], g5; + Gamma gSrc(par().gammaSource), gSnk(par().gammaSink); + Gamma g5(Gamma::Algebra::Gamma5); std::vector buf; Result result; - //g5 = makeGammaProd(Ns*Ns - 1); - result.corr.resize(Ns*Ns); - for (unsigned int i = 0; i < Ns*Ns; ++i) + c = trace(gSnk*q1*adj(gSrc)*g5*adj(q2)*g5); + sliceSum(c, buf, Tp); + result.corr.resize(buf.size()); + for (unsigned int t = 0; t < buf.size(); ++t) { - //g[i] = makeGammaProd(i); - } - for (unsigned int iSink = 0; iSink < Ns*Ns; ++iSink) - { - result.corr[iSink].resize(Ns*Ns); - for (unsigned int iSrc = 0; iSrc < Ns*Ns; ++iSrc) - { - c = trace(g[iSink]*q1*g[iSrc]*g5*adj(q2)*g5); - sliceSum(c, buf, Tp); - result.corr[iSink][iSrc].resize(buf.size()); - for (unsigned int t = 0; t < buf.size(); ++t) - { - result.corr[iSink][iSrc][t] = TensorRemove(buf[t]); - } - } + result.corr[t] = TensorRemove(buf[t]); } write(writer, "meson", result); } diff --git a/extras/Hadrons/Modules/MSource/SeqGamma.hpp b/extras/Hadrons/Modules/MSource/SeqGamma.hpp index f336f6ea..5cb8483f 100644 --- a/extras/Hadrons/Modules/MSource/SeqGamma.hpp +++ b/extras/Hadrons/Modules/MSource/SeqGamma.hpp @@ -60,11 +60,11 @@ class SeqGammaPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(SeqGammaPar, - std::string, q, - unsigned int, tA, - unsigned int, tB, - unsigned int, gamma, - std::string, mom); + std::string, q, + unsigned int, tA, + unsigned int, tB, + Gamma::Algebra, gamma, + std::string, mom); }; template @@ -140,11 +140,10 @@ void TSeqGamma::execute(void) PropagatorField &q = *env().template getObject(par().q); Lattice> t(env().getGrid()); LatticeComplex ph(env().getGrid()), coor(env().getGrid()); - SpinMatrix g; + Gamma g(par().gamma); std::vector p; Complex i(0.0,1.0); - //g = makeGammaProd(par().gamma); p = strToVec(par().mom); ph = zero; for(unsigned int mu = 0; mu < env().getNd(); mu++) @@ -154,7 +153,7 @@ void TSeqGamma::execute(void) } ph = exp(i*ph); LatticeCoordinate(t, Tp); - src = where((t >= par().tA) and (t <= par().tB), g*ph*q, 0.*q); + src = where((t >= par().tA) and (t <= par().tB), ph*(g*q), 0.*q); } END_MODULE_NAMESPACE diff --git a/tests/hadrons/Test_hadrons_meson_3pt.cc b/tests/hadrons/Test_hadrons_meson_3pt.cc index 56d0efa7..8011d1d0 100644 --- a/tests/hadrons/Test_hadrons_meson_3pt.cc +++ b/tests/hadrons/Test_hadrons_meson_3pt.cc @@ -30,6 +30,14 @@ using namespace Grid; using namespace Hadrons; +static Gamma::Algebra gmu[4] = +{ + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT +} + int main(int argc, char *argv[]) { // initialization ////////////////////////////////////////////////////////// @@ -102,7 +110,7 @@ int main(int argc, char *argv[]) seqName.push_back(std::vector(Nd)); for (unsigned int mu = 0; mu < Nd; ++mu) { - seqPar.gamma = 0x1 << mu; + seqPar.gamma = gmu[mu]; seqName[i][mu] = "G" + std::to_string(seqPar.gamma) + "_" + std::to_string(seqPar.tA) + "-" + qName[i]; @@ -127,9 +135,11 @@ int main(int argc, char *argv[]) for (unsigned int i = 0; i < flavour.size(); ++i) for (unsigned int j = i; j < flavour.size(); ++j) { - mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j]; - mesPar.q1 = qName[i]; - mesPar.q2 = qName[j]; + mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j]; + mesPar.q1 = qName[i]; + mesPar.q2 = qName[j]; + mesPar.gammaSource = Gamma::Algebra::Gamma5; + mesPar.gammaSink = Gamma::Algebra::Gamma5; application.createModule("meson_Z2_" + std::to_string(t) + "_" From 515a26b3c6f670516819120577c7f0087eb724ea Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 30 Jan 2017 09:07:09 -0800 Subject: [PATCH 08/10] gammas: copyright update --- lib/qcd/spin/Dirac.cc | 30 ++++++++++++++++++++++++++++++ lib/qcd/spin/Dirac.h | 31 +++++++++++++++++++++++++++++++ lib/qcd/spin/GammaMulTable.h | 28 ++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) diff --git a/lib/qcd/spin/Dirac.cc b/lib/qcd/spin/Dirac.cc index 98dff14a..3384eabd 100644 --- a/lib/qcd/spin/Dirac.cc +++ b/lib/qcd/spin/Dirac.cc @@ -1,3 +1,33 @@ +/************************************************************************************* + +Grid physics library, www.github.com/paboyle/Grid + +Source file: lib/qcd/spin/Dirac.cc + +Copyright (C) 2015 +Copyright (C) 2016 + +Author: Antonin Portelli +Author: Peter Boyle +Author: paboyle + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +See the full license in the file "LICENSE" in the top level distribution directory +*************************************************************************************/ +/* END LEGAL */ #include namespace Grid { diff --git a/lib/qcd/spin/Dirac.h b/lib/qcd/spin/Dirac.h index a18e4b5a..779866da 100644 --- a/lib/qcd/spin/Dirac.h +++ b/lib/qcd/spin/Dirac.h @@ -1,3 +1,34 @@ +/************************************************************************************* + +Grid physics library, www.github.com/paboyle/Grid + +Source file: lib/qcd/spin/Dirac.h + +Copyright (C) 2015 +Copyright (C) 2016 + +Author: Antonin Portelli +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +See the full license in the file "LICENSE" in the top level distribution directory +*************************************************************************************/ +/* END LEGAL */ #ifndef GRID_QCD_DIRAC_H #define GRID_QCD_DIRAC_H diff --git a/lib/qcd/spin/GammaMulTable.h b/lib/qcd/spin/GammaMulTable.h index 1839ed8c..a71cab5b 100644 --- a/lib/qcd/spin/GammaMulTable.h +++ b/lib/qcd/spin/GammaMulTable.h @@ -1,3 +1,31 @@ +/************************************************************************************* + +Grid physics library, www.github.com/paboyle/Grid + +Source file: lib/qcd/spin/GammaMulTable.h + +Copyright (C) 2015 +Copyright (C) 2016 + +Author: Antonin Portelli + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +See the full license in the file "LICENSE" in the top level distribution directory +*************************************************************************************/ +/* END LEGAL */ const std::array, Gamma::nGamma> Gamma::mul = {{ {Gamma::Algebra::Identity, From 1140573027a55620ac967ff0b880cac170640aa1 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 30 Jan 2017 10:53:04 -0800 Subject: [PATCH 09/10] Gamma adj fix: now in Grid namespace to avoid collisions --- lib/qcd/QCD.h | 8 -------- lib/qcd/spin/Dirac.h | 15 ++++++++------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/qcd/QCD.h b/lib/qcd/QCD.h index 9321e575..f434bdd9 100644 --- a/lib/qcd/QCD.h +++ b/lib/qcd/QCD.h @@ -51,14 +51,6 @@ namespace QCD { static const int Nhs=2; // half spinor static const int Nds=8; // double stored gauge field static const int Ngp=2; // gparity index range - - // if no adj funtion in QCD:: redirect to Grid:: - // this avoids QCD:: adj functions to screen the Grid:: ones - template - inline auto adj(T x)->decltype(Grid::adj(x)) - { - return Grid::adj(x); - } ////////////////////////////////////////////////////////////////////////////// // QCD iMatrix types diff --git a/lib/qcd/spin/Dirac.h b/lib/qcd/spin/Dirac.h index 779866da..6053f935 100644 --- a/lib/qcd/spin/Dirac.h +++ b/lib/qcd/spin/Dirac.h @@ -33,7 +33,6 @@ See the full license in the file "LICENSE" in the top level distribution directo #define GRID_QCD_DIRAC_H // code generated by the Mathematica notebook gamma-gen/gamma-gen.nb - #include namespace Grid { @@ -88,11 +87,6 @@ inline Gamma operator*(const Gamma &g1, const Gamma &g2) return Gamma(Gamma::mul[g1.g][g2.g]); } -inline Gamma adj(const Gamma &g) -{ - return Gamma(Gamma::adj[g.g]); -} - template inline void multMinusGamma5(iVector &ret, const iVector &rhs) { @@ -1446,6 +1440,13 @@ inline auto operator*(const iMatrix &arg, const Gamma &G) return ret; } -}} +} + +inline QCD::Gamma adj(const QCD::Gamma &g) +{ + return QCD::Gamma(QCD::Gamma::adj[g.g]); +} + +} #endif From 7da7d263c499a1bf9484f673ff37b8b8b5302916 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 30 Jan 2017 10:53:13 -0800 Subject: [PATCH 10/10] typo --- tests/hadrons/Test_hadrons_meson_3pt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hadrons/Test_hadrons_meson_3pt.cc b/tests/hadrons/Test_hadrons_meson_3pt.cc index 8011d1d0..da7ddb84 100644 --- a/tests/hadrons/Test_hadrons_meson_3pt.cc +++ b/tests/hadrons/Test_hadrons_meson_3pt.cc @@ -36,7 +36,7 @@ static Gamma::Algebra gmu[4] = Gamma::Algebra::GammaY, Gamma::Algebra::GammaZ, Gamma::Algebra::GammaT -} +}; int main(int argc, char *argv[]) {