#ifndef GRID_QCD_DIRAC_H #define GRID_QCD_DIRAC_H // code generated by the Mathematica notebook gamma-gen/gamma-gen.nb #include namespace Grid { namespace QCD { 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); }; 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); } }; 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); } }; 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) = 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 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) = 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 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) = 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 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) = 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 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); } return ret; } 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; } 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::Algebra::MinusGamma5: rmultMinusGamma5(ret, arg); break; case Gamma::Algebra::Gamma5: rmultGamma5(ret, arg); break; case Gamma::Algebra::MinusGammaT: rmultMinusGammaT(ret, arg); break; case Gamma::Algebra::GammaT: rmultGammaT(ret, arg); break; case Gamma::Algebra::MinusGammaTGamma5: rmultMinusGammaTGamma5(ret, arg); break; case Gamma::Algebra::GammaTGamma5: rmultGammaTGamma5(ret, arg); break; case Gamma::Algebra::MinusGammaX: rmultMinusGammaX(ret, arg); break; case Gamma::Algebra::GammaX: rmultGammaX(ret, arg); break; case Gamma::Algebra::MinusGammaXGamma5: rmultMinusGammaXGamma5(ret, arg); break; case Gamma::Algebra::GammaXGamma5: rmultGammaXGamma5(ret, arg); break; case Gamma::Algebra::MinusGammaY: rmultMinusGammaY(ret, arg); break; case Gamma::Algebra::GammaY: rmultGammaY(ret, arg); break; case Gamma::Algebra::MinusGammaYGamma5: rmultMinusGammaYGamma5(ret, arg); break; case Gamma::Algebra::GammaYGamma5: rmultGammaYGamma5(ret, arg); break; case Gamma::Algebra::MinusGammaZ: rmultMinusGammaZ(ret, arg); break; case Gamma::Algebra::GammaZ: rmultGammaZ(ret, arg); break; case Gamma::Algebra::MinusGammaZGamma5: rmultMinusGammaZGamma5(ret, arg); break; case Gamma::Algebra::GammaZGamma5: rmultGammaZGamma5(ret, arg); break; case Gamma::Algebra::MinusIdentity: rmultMinusIdentity(ret, arg); break; case Gamma::Algebra::Identity: rmultIdentity(ret, arg); break; case Gamma::Algebra::MinusSigmaXT: rmultMinusSigmaXT(ret, arg); break; case Gamma::Algebra::SigmaXT: rmultSigmaXT(ret, arg); break; case Gamma::Algebra::MinusSigmaXY: rmultMinusSigmaXY(ret, arg); break; case Gamma::Algebra::SigmaXY: rmultSigmaXY(ret, arg); break; case Gamma::Algebra::MinusSigmaXZ: rmultMinusSigmaXZ(ret, arg); break; case Gamma::Algebra::SigmaXZ: rmultSigmaXZ(ret, arg); break; case Gamma::Algebra::MinusSigmaYT: rmultMinusSigmaYT(ret, arg); break; case Gamma::Algebra::SigmaYT: rmultSigmaYT(ret, arg); break; case Gamma::Algebra::MinusSigmaYZ: rmultMinusSigmaYZ(ret, arg); break; case Gamma::Algebra::SigmaYZ: rmultSigmaYZ(ret, arg); break; case Gamma::Algebra::MinusSigmaZT: rmultMinusSigmaZT(ret, arg); break; case Gamma::Algebra::SigmaZT: rmultSigmaZT(ret, arg); break; default: assert(0); } return ret; } inline Gamma operator*(const Gamma &g1, const Gamma &g2) { return Gamma(Gamma::mul[g1.g][g2.g]); } }} #endif