diff --git a/lib/qcd/spin/Dirac.h b/lib/qcd/spin/Dirac.h index ed22ec97..bedd6a40 100644 --- a/lib/qcd/spin/Dirac.h +++ b/lib/qcd/spin/Dirac.h @@ -28,35 +28,35 @@ with this program; if not, write to the Free Software Foundation, Inc., See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ -/* END LEGAL */ + /* END LEGAL */ #ifndef GRID_QCD_DIRAC_H #define GRID_QCD_DIRAC_H -// Gamma matrices using the code generated by the Mathematica notebook -// gamma-gen/gamma-gen.nb in Gamma.cc & Gamma.h -//////////////////////////////////////////////////////////////////////////////// + // Gamma matrices using the code generated by the Mathematica notebook + // gamma-gen/gamma-gen.nb in Gamma.cc & Gamma.h + //////////////////////////////////////////////////////////////////////////////// #include -namespace Grid { +NAMESPACE_BEGIN(Grid); // Dirac algebra adjoint operator (not in QCD:: to overload other adj) inline QCD::Gamma adj(const QCD::Gamma &g) { - return QCD::Gamma (QCD::Gamma::adj[g.g]); + return QCD::Gamma (QCD::Gamma::adj[g.g]); } -namespace QCD { + // Dirac algebra mutliplication operator inline Gamma operator*(const Gamma &g1, const Gamma &g2) { - return Gamma (Gamma::mul[g1.g][g2.g]); + return Gamma (Gamma::mul[g1.g][g2.g]); } // general left multiply template inline auto operator*(const Gamma &G, const iScalar &arg) -->typename std::enable_if,SpinorIndex>::notvalue,iScalar>::type + ->typename std::enable_if,SpinorIndex>::notvalue,iScalar>::type { iScalar ret; ret._internal=G*arg._internal; @@ -65,7 +65,7 @@ inline auto operator*(const Gamma &G, const iScalar &arg) template inline auto operator*(const Gamma &G, const iVector &arg) -->typename std::enable_if,SpinorIndex>::notvalue,iVector>::type + ->typename std::enable_if,SpinorIndex>::notvalue,iVector>::type { iVector ret; for(int i=0;i &arg) template inline auto operator*(const Gamma &G, const iMatrix &arg) -->typename std::enable_if,SpinorIndex>::notvalue,iMatrix>::type + ->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 + ->typename std::enable_if,SpinorIndex>::notvalue,iScalar>::type { iScalar ret; ret._internal=arg._internal*G; @@ -98,13 +98,13 @@ inline auto operator*(const iScalar &arg, const Gamma &G) template inline auto operator * (const iMatrix &arg, const Gamma &G) -->typename std::enable_if,SpinorIndex>::notvalue,iMatrix>::type + ->typename std::enable_if,SpinorIndex>::notvalue,iMatrix>::type { iMatrix ret; for(int i=0;i inline auto operator*(const GammaL &gl, const iVector &arg) -->typename std::enable_if, SpinorIndex>::value, iVector>::type + ->typename std::enable_if, SpinorIndex>::value, iVector>::type { iVector buf; @@ -138,17 +138,17 @@ inline auto operator*(const GammaL &gl, const iVector &arg) // matrix left multiply template inline auto operator*(const GammaL &gl, const iMatrix &arg) -->typename std::enable_if, SpinorIndex>::value, iMatrix>::type + ->typename std::enable_if, SpinorIndex>::value, iMatrix>::type { iMatrix buf; for(unsigned int i = 0; i < Ns; ++i) - { - buf(0, i) = 0.; - buf(1, i) = 0.; - buf(2, i) = 2.*arg(2, i); - buf(3, i) = 2.*arg(3, i); - } + { + buf(0, i) = 0.; + buf(1, i) = 0.; + buf(2, i) = 2.*arg(2, i); + buf(3, i) = 2.*arg(3, i); + } return gl.gamma*buf; }; @@ -156,18 +156,18 @@ inline auto operator*(const GammaL &gl, const iMatrix &arg) // matrix right multiply template inline auto operator*(const iMatrix &arg, const GammaL &gl) -->typename std::enable_if, SpinorIndex>::value, iMatrix>::type + ->typename std::enable_if, SpinorIndex>::value, iMatrix>::type { iMatrix buf; buf = arg*gl.gamma; for(unsigned int i = 0; i < Ns; ++i) - { - buf(i, 0) = 0.; - buf(i, 1) = 0.; - buf(i, 2) = 2.*buf(i, 2); - buf(i, 3) = 2.*buf(i, 3); - } + { + buf(i, 0) = 0.; + buf(i, 1) = 0.; + buf(i, 2) = 2.*buf(i, 2); + buf(i, 3) = 2.*buf(i, 3); + } return buf; }; @@ -175,7 +175,7 @@ inline auto operator*(const iMatrix &arg, const GammaL &gl) //general left multiply template inline auto operator*(const GammaL &gl, const iScalar &arg) -->typename std::enable_if,SpinorIndex>::notvalue,iScalar>::type + ->typename std::enable_if,SpinorIndex>::notvalue,iScalar>::type { iScalar ret; ret._internal=gl*arg._internal; @@ -184,7 +184,7 @@ inline auto operator*(const GammaL &gl, const iScalar &arg) template inline auto operator*(const GammaL &gl, const iVector &arg) -->typename std::enable_if,SpinorIndex>::notvalue,iVector>::type + ->typename std::enable_if,SpinorIndex>::notvalue,iVector>::type { iVector ret; for(int i=0;i &arg) template inline auto operator*(const GammaL &gl, const iMatrix &arg) -->typename std::enable_if,SpinorIndex>::notvalue,iMatrix>::type + ->typename std::enable_if,SpinorIndex>::notvalue,iMatrix>::type { iMatrix ret; for(int i=0;i inline auto operator*(const iScalar &arg, const GammaL &gl) -->typename std::enable_if,SpinorIndex>::notvalue,iScalar>::type + ->typename std::enable_if,SpinorIndex>::notvalue,iScalar>::type { iScalar ret; ret._internal=arg._internal*gl; @@ -217,16 +217,16 @@ inline auto operator*(const iScalar &arg, const GammaL &gl) template inline auto operator * (const iMatrix &arg, const GammaL &gl) -->typename std::enable_if,SpinorIndex>::notvalue,iMatrix>::type + ->typename std::enable_if,SpinorIndex>::notvalue,iMatrix>::type { iMatrix ret; for(int i=0;i