From 1fbab4032b9245d8687b1a2fab18eeaf507b9ca0 Mon Sep 17 00:00:00 2001 From: paboyle Date: Sun, 14 Jan 2018 21:51:19 +0000 Subject: [PATCH] Namespace changes --- lib/qcd/QCD.h | 818 ++++++++++++++++++++++++-------------------------- 1 file changed, 391 insertions(+), 427 deletions(-) diff --git a/lib/qcd/QCD.h b/lib/qcd/QCD.h index 531b71bd..945d173b 100644 --- a/lib/qcd/QCD.h +++ b/lib/qcd/QCD.h @@ -1,4 +1,4 @@ - /************************************************************************************* +/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid @@ -27,514 +27,478 @@ Author: paboyle 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 */ +*************************************************************************************/ +/* END LEGAL */ #ifndef GRID_QCD_BASE_H #define GRID_QCD_BASE_H -namespace Grid{ -namespace QCD { +NAMESPACE_BEGIN(Grid); - static const int Xdir = 0; - static const int Ydir = 1; - static const int Zdir = 2; - static const int Tdir = 3; +static const int Xdir = 0; +static const int Ydir = 1; +static const int Zdir = 2; +static const int Tdir = 3; - static const int Xp = 0; - static const int Yp = 1; - static const int Zp = 2; - static const int Tp = 3; - static const int Xm = 4; - static const int Ym = 5; - static const int Zm = 6; - static const int Tm = 7; +static const int Xp = 0; +static const int Yp = 1; +static const int Zp = 2; +static const int Tp = 3; +static const int Xm = 4; +static const int Ym = 5; +static const int Zm = 6; +static const int Tm = 7; - static const int Nc=3; - static const int Ns=4; - static const int Nd=4; - static const int Nhs=2; // half spinor - static const int Nds=8; // double stored gauge field - static const int Ngp=2; // gparity index range +static const int Nc=3; +static const int Ns=4; +static const int Nd=4; +static const int Nhs=2; // half spinor +static const int Nds=8; // double stored gauge field +static const int Ngp=2; // gparity index range - ////////////////////////////////////////////////////////////////////////////// - // QCD iMatrix types - // Index conventions: Lorentz x Spin x Colour - // note: static const int or constexpr will work for type deductions - // with the intel compiler (up to version 17) - ////////////////////////////////////////////////////////////////////////////// - #define ColourIndex 2 - #define SpinIndex 1 - #define LorentzIndex 0 +////////////////////////////////////////////////////////////////////////////// +// QCD iMatrix types +// Index conventions: Lorentz x Spin x Colour +// note: static const int or constexpr will work for type deductions +// with the intel compiler (up to version 17) +////////////////////////////////////////////////////////////////////////////// +#define ColourIndex 2 +#define SpinIndex 1 +#define LorentzIndex 0 - // Also should make these a named enum type - static const int DaggerNo=0; - static const int DaggerYes=1; - static const int InverseNo=0; - static const int InverseYes=1; +// Also should make these a named enum type +static const int DaggerNo=0; +static const int DaggerYes=1; +static const int InverseNo=0; +static const int InverseYes=1; - // Useful traits is this a spin index - //typename std::enable_if,SpinorIndex>::value,iVector >::type *SFINAE; +// Useful traits is this a spin index +//typename std::enable_if,SpinorIndex>::value,iVector >::type *SFINAE; - const int SpinorIndex = 2; - template struct isSpinor { - static const bool value = (SpinorIndex==T::TensorLevel); - }; - template using IfSpinor = Invoke::value,int> > ; - template using IfNotSpinor = Invoke::value,int> > ; +const int SpinorIndex = 2; +template struct isSpinor { + static const bool value = (SpinorIndex==T::TensorLevel); +}; +template using IfSpinor = Invoke::value,int> > ; +template using IfNotSpinor = Invoke::value,int> > ; - // ChrisK very keen to add extra space for Gparity doubling. - // - // Also add domain wall index, in a way where Wilson operator - // naturally distributes across the 5th dimensions. - // - // That probably makes for GridRedBlack4dCartesian grid. +// ChrisK very keen to add extra space for Gparity doubling. +// +// Also add domain wall index, in a way where Wilson operator +// naturally distributes across the 5th dimensions. +// +// That probably makes for GridRedBlack4dCartesian grid. - // s,sp,c,spc,lc - template using iSinglet = iScalar > >; - template using iSpinMatrix = iScalar, Ns> >; - template using iColourMatrix = iScalar > > ; - template using iSpinColourMatrix = iScalar, Ns> >; - template using iLorentzColourMatrix = iVector >, Nd > ; - template using iDoubleStoredColourMatrix = iVector >, Nds > ; - template using iSpinVector = iScalar, Ns> >; - template using iColourVector = iScalar > >; - template using iSpinColourVector = iScalar, Ns> >; - template using iHalfSpinVector = iScalar, Nhs> >; - template using iHalfSpinColourVector = iScalar, Nhs> >; +// s,sp,c,spc,lc +template using iSinglet = iScalar > >; +template using iSpinMatrix = iScalar, Ns> >; +template using iColourMatrix = iScalar > > ; +template using iSpinColourMatrix = iScalar, Ns> >; +template using iLorentzColourMatrix = iVector >, Nd > ; +template using iDoubleStoredColourMatrix = iVector >, Nds > ; +template using iSpinVector = iScalar, Ns> >; +template using iColourVector = iScalar > >; +template using iSpinColourVector = iScalar, Ns> >; +template using iHalfSpinVector = iScalar, Nhs> >; +template using iHalfSpinColourVector = iScalar, Nhs> >; - template using iGparitySpinColourVector = iVector, Ns>, Ngp >; - template using iGparityHalfSpinColourVector = iVector, Nhs>, Ngp >; +template using iGparitySpinColourVector = iVector, Ns>, Ngp >; +template using iGparityHalfSpinColourVector = iVector, Nhs>, Ngp >; - // Spin matrix - typedef iSpinMatrix SpinMatrix; - typedef iSpinMatrix SpinMatrixF; - typedef iSpinMatrix SpinMatrixD; +// Spin matrix +typedef iSpinMatrix SpinMatrix; +typedef iSpinMatrix SpinMatrixF; +typedef iSpinMatrix SpinMatrixD; - typedef iSpinMatrix vSpinMatrix; - typedef iSpinMatrix vSpinMatrixF; - typedef iSpinMatrix vSpinMatrixD; +typedef iSpinMatrix vSpinMatrix; +typedef iSpinMatrix vSpinMatrixF; +typedef iSpinMatrix vSpinMatrixD; - // Colour Matrix - typedef iColourMatrix ColourMatrix; - typedef iColourMatrix ColourMatrixF; - typedef iColourMatrix ColourMatrixD; +// Colour Matrix +typedef iColourMatrix ColourMatrix; +typedef iColourMatrix ColourMatrixF; +typedef iColourMatrix ColourMatrixD; - typedef iColourMatrix vColourMatrix; - typedef iColourMatrix vColourMatrixF; - typedef iColourMatrix vColourMatrixD; +typedef iColourMatrix vColourMatrix; +typedef iColourMatrix vColourMatrixF; +typedef iColourMatrix vColourMatrixD; - // SpinColour matrix - typedef iSpinColourMatrix SpinColourMatrix; - typedef iSpinColourMatrix SpinColourMatrixF; - typedef iSpinColourMatrix SpinColourMatrixD; +// SpinColour matrix +typedef iSpinColourMatrix SpinColourMatrix; +typedef iSpinColourMatrix SpinColourMatrixF; +typedef iSpinColourMatrix SpinColourMatrixD; - typedef iSpinColourMatrix vSpinColourMatrix; - typedef iSpinColourMatrix vSpinColourMatrixF; - typedef iSpinColourMatrix vSpinColourMatrixD; +typedef iSpinColourMatrix vSpinColourMatrix; +typedef iSpinColourMatrix vSpinColourMatrixF; +typedef iSpinColourMatrix vSpinColourMatrixD; - // LorentzColour - typedef iLorentzColourMatrix LorentzColourMatrix; - typedef iLorentzColourMatrix LorentzColourMatrixF; - typedef iLorentzColourMatrix LorentzColourMatrixD; +// LorentzColour +typedef iLorentzColourMatrix LorentzColourMatrix; +typedef iLorentzColourMatrix LorentzColourMatrixF; +typedef iLorentzColourMatrix LorentzColourMatrixD; - typedef iLorentzColourMatrix vLorentzColourMatrix; - typedef iLorentzColourMatrix vLorentzColourMatrixF; - typedef iLorentzColourMatrix vLorentzColourMatrixD; +typedef iLorentzColourMatrix vLorentzColourMatrix; +typedef iLorentzColourMatrix vLorentzColourMatrixF; +typedef iLorentzColourMatrix vLorentzColourMatrixD; - // DoubleStored gauge field - typedef iDoubleStoredColourMatrix DoubleStoredColourMatrix; - typedef iDoubleStoredColourMatrix DoubleStoredColourMatrixF; - typedef iDoubleStoredColourMatrix DoubleStoredColourMatrixD; +// DoubleStored gauge field +typedef iDoubleStoredColourMatrix DoubleStoredColourMatrix; +typedef iDoubleStoredColourMatrix DoubleStoredColourMatrixF; +typedef iDoubleStoredColourMatrix DoubleStoredColourMatrixD; - typedef iDoubleStoredColourMatrix vDoubleStoredColourMatrix; - typedef iDoubleStoredColourMatrix vDoubleStoredColourMatrixF; - typedef iDoubleStoredColourMatrix vDoubleStoredColourMatrixD; +typedef iDoubleStoredColourMatrix vDoubleStoredColourMatrix; +typedef iDoubleStoredColourMatrix vDoubleStoredColourMatrixF; +typedef iDoubleStoredColourMatrix vDoubleStoredColourMatrixD; - // Spin vector - typedef iSpinVector SpinVector; - typedef iSpinVector SpinVectorF; - typedef iSpinVector SpinVectorD; +// Spin vector +typedef iSpinVector SpinVector; +typedef iSpinVector SpinVectorF; +typedef iSpinVector SpinVectorD; - typedef iSpinVector vSpinVector; - typedef iSpinVector vSpinVectorF; - typedef iSpinVector vSpinVectorD; +typedef iSpinVector vSpinVector; +typedef iSpinVector vSpinVectorF; +typedef iSpinVector vSpinVectorD; - // Colour vector - typedef iColourVector ColourVector; - typedef iColourVector ColourVectorF; - typedef iColourVector ColourVectorD; +// Colour vector +typedef iColourVector ColourVector; +typedef iColourVector ColourVectorF; +typedef iColourVector ColourVectorD; - typedef iColourVector vColourVector; - typedef iColourVector vColourVectorF; - typedef iColourVector vColourVectorD; +typedef iColourVector vColourVector; +typedef iColourVector vColourVectorF; +typedef iColourVector vColourVectorD; - // SpinColourVector - typedef iSpinColourVector SpinColourVector; - typedef iSpinColourVector SpinColourVectorF; - typedef iSpinColourVector SpinColourVectorD; +// SpinColourVector +typedef iSpinColourVector SpinColourVector; +typedef iSpinColourVector SpinColourVectorF; +typedef iSpinColourVector SpinColourVectorD; - typedef iSpinColourVector vSpinColourVector; - typedef iSpinColourVector vSpinColourVectorF; - typedef iSpinColourVector vSpinColourVectorD; +typedef iSpinColourVector vSpinColourVector; +typedef iSpinColourVector vSpinColourVectorF; +typedef iSpinColourVector vSpinColourVectorD; - // HalfSpin vector - typedef iHalfSpinVector HalfSpinVector; - typedef iHalfSpinVector HalfSpinVectorF; - typedef iHalfSpinVector HalfSpinVectorD; +// HalfSpin vector +typedef iHalfSpinVector HalfSpinVector; +typedef iHalfSpinVector HalfSpinVectorF; +typedef iHalfSpinVector HalfSpinVectorD; - typedef iHalfSpinVector vHalfSpinVector; - typedef iHalfSpinVector vHalfSpinVectorF; - typedef iHalfSpinVector vHalfSpinVectorD; +typedef iHalfSpinVector vHalfSpinVector; +typedef iHalfSpinVector vHalfSpinVectorF; +typedef iHalfSpinVector vHalfSpinVectorD; - // HalfSpinColour vector - typedef iHalfSpinColourVector HalfSpinColourVector; - typedef iHalfSpinColourVector HalfSpinColourVectorF; - typedef iHalfSpinColourVector HalfSpinColourVectorD; +// HalfSpinColour vector +typedef iHalfSpinColourVector HalfSpinColourVector; +typedef iHalfSpinColourVector HalfSpinColourVectorF; +typedef iHalfSpinColourVector HalfSpinColourVectorD; - typedef iHalfSpinColourVector vHalfSpinColourVector; - typedef iHalfSpinColourVector vHalfSpinColourVectorF; - typedef iHalfSpinColourVector vHalfSpinColourVectorD; +typedef iHalfSpinColourVector vHalfSpinColourVector; +typedef iHalfSpinColourVector vHalfSpinColourVectorF; +typedef iHalfSpinColourVector vHalfSpinColourVectorD; - // singlets - typedef iSinglet TComplex; // FIXME This is painful. Tensor singlet complex type. - typedef iSinglet TComplexF; // FIXME This is painful. Tensor singlet complex type. - typedef iSinglet TComplexD; // FIXME This is painful. Tensor singlet complex type. +// singlets +typedef iSinglet TComplex; // FIXME This is painful. Tensor singlet complex type. +typedef iSinglet TComplexF; // FIXME This is painful. Tensor singlet complex type. +typedef iSinglet TComplexD; // FIXME This is painful. Tensor singlet complex type. - typedef iSinglet vTComplex ; // what if we don't know the tensor structure - typedef iSinglet vTComplexF; // what if we don't know the tensor structure - typedef iSinglet vTComplexD; // what if we don't know the tensor structure +typedef iSinglet vTComplex ; // what if we don't know the tensor structure +typedef iSinglet vTComplexF; // what if we don't know the tensor structure +typedef iSinglet vTComplexD; // what if we don't know the tensor structure - typedef iSinglet TReal; // Shouldn't need these; can I make it work without? - typedef iSinglet TRealF; // Shouldn't need these; can I make it work without? - typedef iSinglet TRealD; // Shouldn't need these; can I make it work without? +typedef iSinglet TReal; // Shouldn't need these; can I make it work without? +typedef iSinglet TRealF; // Shouldn't need these; can I make it work without? +typedef iSinglet TRealD; // Shouldn't need these; can I make it work without? - typedef iSinglet vTReal; - typedef iSinglet vTRealF; - typedef iSinglet vTRealD; +typedef iSinglet vTReal; +typedef iSinglet vTRealF; +typedef iSinglet vTRealD; - typedef iSinglet vTInteger; - typedef iSinglet TInteger; +typedef iSinglet vTInteger; +typedef iSinglet TInteger; - // Lattices of these - typedef Lattice LatticeColourMatrix; - typedef Lattice LatticeColourMatrixF; - typedef Lattice LatticeColourMatrixD; +// Lattices of these +typedef Lattice LatticeColourMatrix; +typedef Lattice LatticeColourMatrixF; +typedef Lattice LatticeColourMatrixD; - typedef Lattice LatticeSpinMatrix; - typedef Lattice LatticeSpinMatrixF; - typedef Lattice LatticeSpinMatrixD; +typedef Lattice LatticeSpinMatrix; +typedef Lattice LatticeSpinMatrixF; +typedef Lattice LatticeSpinMatrixD; - typedef Lattice LatticeSpinColourMatrix; - typedef Lattice LatticeSpinColourMatrixF; - typedef Lattice LatticeSpinColourMatrixD; +typedef Lattice LatticeSpinColourMatrix; +typedef Lattice LatticeSpinColourMatrixF; +typedef Lattice LatticeSpinColourMatrixD; - typedef Lattice LatticeLorentzColourMatrix; - typedef Lattice LatticeLorentzColourMatrixF; - typedef Lattice LatticeLorentzColourMatrixD; +typedef Lattice LatticeLorentzColourMatrix; +typedef Lattice LatticeLorentzColourMatrixF; +typedef Lattice LatticeLorentzColourMatrixD; - // DoubleStored gauge field - typedef Lattice LatticeDoubleStoredColourMatrix; - typedef Lattice LatticeDoubleStoredColourMatrixF; - typedef Lattice LatticeDoubleStoredColourMatrixD; +// DoubleStored gauge field +typedef Lattice LatticeDoubleStoredColourMatrix; +typedef Lattice LatticeDoubleStoredColourMatrixF; +typedef Lattice LatticeDoubleStoredColourMatrixD; - typedef Lattice LatticeSpinVector; - typedef Lattice LatticeSpinVectorF; - typedef Lattice LatticeSpinVectorD; +typedef Lattice LatticeSpinVector; +typedef Lattice LatticeSpinVectorF; +typedef Lattice LatticeSpinVectorD; - typedef Lattice LatticeColourVector; - typedef Lattice LatticeColourVectorF; - typedef Lattice LatticeColourVectorD; +typedef Lattice LatticeColourVector; +typedef Lattice LatticeColourVectorF; +typedef Lattice LatticeColourVectorD; - typedef Lattice LatticeSpinColourVector; - typedef Lattice LatticeSpinColourVectorF; - typedef Lattice LatticeSpinColourVectorD; +typedef Lattice LatticeSpinColourVector; +typedef Lattice LatticeSpinColourVectorF; +typedef Lattice LatticeSpinColourVectorD; - typedef Lattice LatticeHalfSpinVector; - typedef Lattice LatticeHalfSpinVectorF; - typedef Lattice LatticeHalfSpinVectorD; +typedef Lattice LatticeHalfSpinVector; +typedef Lattice LatticeHalfSpinVectorF; +typedef Lattice LatticeHalfSpinVectorD; - typedef Lattice LatticeHalfSpinColourVector; - typedef Lattice LatticeHalfSpinColourVectorF; - typedef Lattice LatticeHalfSpinColourVectorD; +typedef Lattice LatticeHalfSpinColourVector; +typedef Lattice LatticeHalfSpinColourVectorF; +typedef Lattice LatticeHalfSpinColourVectorD; - typedef Lattice LatticeReal; - typedef Lattice LatticeRealF; - typedef Lattice LatticeRealD; +typedef Lattice LatticeReal; +typedef Lattice LatticeRealF; +typedef Lattice LatticeRealD; - typedef Lattice LatticeComplex; - typedef Lattice LatticeComplexF; - typedef Lattice LatticeComplexD; +typedef Lattice LatticeComplex; +typedef Lattice LatticeComplexF; +typedef Lattice LatticeComplexD; - typedef Lattice LatticeInteger; // Predicates for "where" +typedef Lattice LatticeInteger; // Predicates for "where" - /////////////////////////////////////////// - // Physical names for things - /////////////////////////////////////////// - typedef LatticeHalfSpinColourVector LatticeHalfFermion; - typedef LatticeHalfSpinColourVectorF LatticeHalfFermionF; - typedef LatticeHalfSpinColourVectorF LatticeHalfFermionD; +/////////////////////////////////////////// +// Physical names for things +/////////////////////////////////////////// +typedef LatticeHalfSpinColourVector LatticeHalfFermion; +typedef LatticeHalfSpinColourVectorF LatticeHalfFermionF; +typedef LatticeHalfSpinColourVectorF LatticeHalfFermionD; - typedef LatticeSpinColourVector LatticeFermion; - typedef LatticeSpinColourVectorF LatticeFermionF; - typedef LatticeSpinColourVectorD LatticeFermionD; +typedef LatticeSpinColourVector LatticeFermion; +typedef LatticeSpinColourVectorF LatticeFermionF; +typedef LatticeSpinColourVectorD LatticeFermionD; - typedef LatticeSpinColourMatrix LatticePropagator; - typedef LatticeSpinColourMatrixF LatticePropagatorF; - typedef LatticeSpinColourMatrixD LatticePropagatorD; +typedef LatticeSpinColourMatrix LatticePropagator; +typedef LatticeSpinColourMatrixF LatticePropagatorF; +typedef LatticeSpinColourMatrixD LatticePropagatorD; - typedef LatticeLorentzColourMatrix LatticeGaugeField; - typedef LatticeLorentzColourMatrixF LatticeGaugeFieldF; - typedef LatticeLorentzColourMatrixD LatticeGaugeFieldD; +typedef LatticeLorentzColourMatrix LatticeGaugeField; +typedef LatticeLorentzColourMatrixF LatticeGaugeFieldF; +typedef LatticeLorentzColourMatrixD LatticeGaugeFieldD; - typedef LatticeDoubleStoredColourMatrix LatticeDoubledGaugeField; - typedef LatticeDoubleStoredColourMatrixF LatticeDoubledGaugeFieldF; - typedef LatticeDoubleStoredColourMatrixD LatticeDoubledGaugeFieldD; +typedef LatticeDoubleStoredColourMatrix LatticeDoubledGaugeField; +typedef LatticeDoubleStoredColourMatrixF LatticeDoubledGaugeFieldF; +typedef LatticeDoubleStoredColourMatrixD LatticeDoubledGaugeFieldD; - template using LorentzScalar = Lattice >; +template using LorentzScalar = Lattice >; - // Uhgg... typing this hurt ;) - // (my keyboard got burning hot when I typed this, must be the anti-Fermion) - typedef Lattice LatticeStaggeredFermion; - typedef Lattice LatticeStaggeredFermionF; - typedef Lattice LatticeStaggeredFermionD; +// Uhgg... typing this hurt ;) +// (my keyboard got burning hot when I typed this, must be the anti-Fermion) +typedef Lattice LatticeStaggeredFermion; +typedef Lattice LatticeStaggeredFermionF; +typedef Lattice LatticeStaggeredFermionD; - typedef Lattice LatticeStaggeredPropagator; - typedef Lattice LatticeStaggeredPropagatorF; - typedef Lattice LatticeStaggeredPropagatorD; +typedef Lattice LatticeStaggeredPropagator; +typedef Lattice LatticeStaggeredPropagatorF; +typedef Lattice LatticeStaggeredPropagatorD; - ////////////////////////////////////////////////////////////////////////////// - // Peek and Poke named after physics attributes - ////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +// Peek and Poke named after physics attributes +////////////////////////////////////////////////////////////////////////////// - //spin - template auto peekSpin(const vobj &rhs,int i) -> decltype(PeekIndex(rhs,0)) - { - return PeekIndex(rhs,i); - } - template auto peekSpin(const vobj &rhs,int i,int j) -> decltype(PeekIndex(rhs,0,0)) - { - return PeekIndex(rhs,i,j); - } - template auto peekSpin(const Lattice &rhs,int i) -> decltype(PeekIndex(rhs,0)) - { - return PeekIndex(rhs,i); - } - template auto peekSpin(const Lattice &rhs,int i,int j) -> decltype(PeekIndex(rhs,0,0)) - { - return PeekIndex(rhs,i,j); - } - //colour - template auto peekColour(const vobj &rhs,int i) -> decltype(PeekIndex(rhs,0)) - { - return PeekIndex(rhs,i); - } - template auto peekColour(const vobj &rhs,int i,int j) -> decltype(PeekIndex(rhs,0,0)) - { - return PeekIndex(rhs,i,j); - } - template auto peekColour(const Lattice &rhs,int i) -> decltype(PeekIndex(rhs,0)) - { - return PeekIndex(rhs,i); - } - template auto peekColour(const Lattice &rhs,int i,int j) -> decltype(PeekIndex(rhs,0,0)) - { - return PeekIndex(rhs,i,j); - } - //lorentz - template auto peekLorentz(const vobj &rhs,int i) -> decltype(PeekIndex(rhs,0)) - { - return PeekIndex(rhs,i); - } - template auto peekLorentz(const Lattice &rhs,int i) -> decltype(PeekIndex(rhs,0)) - { - return PeekIndex(rhs,i); - } +//spin +template auto peekSpin(const vobj &rhs,int i) -> decltype(PeekIndex(rhs,0)) +{ + return PeekIndex(rhs,i); +} +template auto peekSpin(const vobj &rhs,int i,int j) -> decltype(PeekIndex(rhs,0,0)) +{ + return PeekIndex(rhs,i,j); +} +template auto peekSpin(const Lattice &rhs,int i) -> decltype(PeekIndex(rhs,0)) +{ + return PeekIndex(rhs,i); +} +template auto peekSpin(const Lattice &rhs,int i,int j) -> decltype(PeekIndex(rhs,0,0)) +{ + return PeekIndex(rhs,i,j); +} +//colour +template auto peekColour(const vobj &rhs,int i) -> decltype(PeekIndex(rhs,0)) +{ + return PeekIndex(rhs,i); +} +template auto peekColour(const vobj &rhs,int i,int j) -> decltype(PeekIndex(rhs,0,0)) +{ + return PeekIndex(rhs,i,j); +} +template auto peekColour(const Lattice &rhs,int i) -> decltype(PeekIndex(rhs,0)) +{ + return PeekIndex(rhs,i); +} +template auto peekColour(const Lattice &rhs,int i,int j) -> decltype(PeekIndex(rhs,0,0)) +{ + return PeekIndex(rhs,i,j); +} +//lorentz +template auto peekLorentz(const vobj &rhs,int i) -> decltype(PeekIndex(rhs,0)) +{ + return PeekIndex(rhs,i); +} +template auto peekLorentz(const Lattice &rhs,int i) -> decltype(PeekIndex(rhs,0)) +{ + return PeekIndex(rhs,i); +} - ////////////////////////////////////////////// - // Poke lattice - ////////////////////////////////////////////// - template - void pokeColour(Lattice &lhs, - const Lattice(lhs._odata[0],0))> & rhs, - int i) - { - PokeIndex(lhs,rhs,i); - } - template - void pokeColour(Lattice &lhs, - const Lattice(lhs._odata[0],0,0))> & rhs, - int i,int j) - { - PokeIndex(lhs,rhs,i,j); - } - template - void pokeSpin(Lattice &lhs, +////////////////////////////////////////////// +// Poke lattice +////////////////////////////////////////////// +template +void pokeColour(Lattice &lhs, + const Lattice(lhs._odata[0],0))> & rhs, + int i) +{ + PokeIndex(lhs,rhs,i); +} +template +void pokeColour(Lattice &lhs, + const Lattice(lhs._odata[0],0,0))> & rhs, + int i,int j) +{ + PokeIndex(lhs,rhs,i,j); +} +template +void pokeSpin(Lattice &lhs, const Lattice(lhs._odata[0],0))> & rhs, int i) - { - PokeIndex(lhs,rhs,i); - } - template - void pokeSpin(Lattice &lhs, +{ + PokeIndex(lhs,rhs,i); +} +template +void pokeSpin(Lattice &lhs, const Lattice(lhs._odata[0],0,0))> & rhs, int i,int j) - { - PokeIndex(lhs,rhs,i,j); - } - template - void pokeLorentz(Lattice &lhs, - const Lattice(lhs._odata[0],0))> & rhs, - int i) - { - PokeIndex(lhs,rhs,i); - } +{ + PokeIndex(lhs,rhs,i,j); +} +template +void pokeLorentz(Lattice &lhs, + const Lattice(lhs._odata[0],0))> & rhs, + int i) +{ + PokeIndex(lhs,rhs,i); +} - ////////////////////////////////////////////// - // Poke scalars - ////////////////////////////////////////////// - template void pokeSpin(vobj &lhs,const decltype(peekIndex(lhs,0)) & rhs,int i) - { - pokeIndex(lhs,rhs,i); - } - template void pokeSpin(vobj &lhs,const decltype(peekIndex(lhs,0,0)) & rhs,int i,int j) - { - pokeIndex(lhs,rhs,i,j); - } +////////////////////////////////////////////// +// Poke scalars +////////////////////////////////////////////// +template void pokeSpin(vobj &lhs,const decltype(peekIndex(lhs,0)) & rhs,int i) +{ + pokeIndex(lhs,rhs,i); +} +template void pokeSpin(vobj &lhs,const decltype(peekIndex(lhs,0,0)) & rhs,int i,int j) +{ + pokeIndex(lhs,rhs,i,j); +} - template void pokeColour(vobj &lhs,const decltype(peekIndex(lhs,0)) & rhs,int i) - { - pokeIndex(lhs,rhs,i); - } - template void pokeColour(vobj &lhs,const decltype(peekIndex(lhs,0,0)) & rhs,int i,int j) - { - pokeIndex(lhs,rhs,i,j); - } +template void pokeColour(vobj &lhs,const decltype(peekIndex(lhs,0)) & rhs,int i) +{ + pokeIndex(lhs,rhs,i); +} +template void pokeColour(vobj &lhs,const decltype(peekIndex(lhs,0,0)) & rhs,int i,int j) +{ + pokeIndex(lhs,rhs,i,j); +} - template void pokeLorentz(vobj &lhs,const decltype(peekIndex(lhs,0)) & rhs,int i) - { - pokeIndex(lhs,rhs,i); - } +template void pokeLorentz(vobj &lhs,const decltype(peekIndex(lhs,0)) & rhs,int i) +{ + pokeIndex(lhs,rhs,i); +} - ////////////////////////////////////////////// - // Fermion <-> propagator assignements - ////////////////////////////////////////////// - template - void FermToProp(Prop &p, const Ferm &f, const int s, const int c) +////////////////////////////////////////////// +// Fermion <-> propagator assignements +////////////////////////////////////////////// +template +void FermToProp(Prop &p, const Ferm &f, const int s, const int c) +{ + for(int j = 0; j < Ns; ++j) { - for(int j = 0; j < Ns; ++j) - { - auto pjs = peekSpin(p, j, s); - auto fj = peekSpin(f, j); + auto pjs = peekSpin(p, j, s); + auto fj = peekSpin(f, j); - for(int i = 0; i < Nc; ++i) - { - pokeColour(pjs, peekColour(fj, i), i, c); - } - pokeSpin(p, pjs, j, s); - } + for(int i = 0; i < Nc; ++i) + { + pokeColour(pjs, peekColour(fj, i), i, c); + } + pokeSpin(p, pjs, j, s); } +} - template - void PropToFerm(Ferm &f, const Prop &p, const int s, const int c) +template +void PropToFerm(Ferm &f, const Prop &p, const int s, const int c) +{ + for(int j = 0; j < Ns; ++j) { - for(int j = 0; j < Ns; ++j) - { - auto pjs = peekSpin(p, j, s); - auto fj = peekSpin(f, j); + auto pjs = peekSpin(p, j, s); + auto fj = peekSpin(f, j); - for(int i = 0; i < Nc; ++i) - { - pokeColour(fj, peekColour(pjs, i, c), i); - } - pokeSpin(f, fj, j); - } + for(int i = 0; i < Nc; ++i) + { + pokeColour(fj, peekColour(pjs, i, c), i); + } + pokeSpin(f, fj, j); } +} - ////////////////////////////////////////////// - // transpose array and scalar - ////////////////////////////////////////////// - template inline Lattice transposeSpin(const Lattice &lhs){ - return transposeIndex(lhs); - } - template inline Lattice transposeColour(const Lattice &lhs){ - return transposeIndex(lhs); - } - template inline vobj transposeSpin(const vobj &lhs){ - return transposeIndex(lhs); - } - template inline vobj transposeColour(const vobj &lhs){ - return transposeIndex(lhs); - } +////////////////////////////////////////////// +// transpose array and scalar +////////////////////////////////////////////// +template inline Lattice transposeSpin(const Lattice &lhs){ + return transposeIndex(lhs); +} +template inline Lattice transposeColour(const Lattice &lhs){ + return transposeIndex(lhs); +} +template inline vobj transposeSpin(const vobj &lhs){ + return transposeIndex(lhs); +} +template inline vobj transposeColour(const vobj &lhs){ + return transposeIndex(lhs); +} - ////////////////////////////////////////// - // Trace lattice and non-lattice - ////////////////////////////////////////// - template - inline auto traceSpin(const Lattice &lhs) -> Lattice(lhs._odata[0]))> - { - return traceIndex(lhs); - } - template - inline auto traceColour(const Lattice &lhs) -> Lattice(lhs._odata[0]))> - { - return traceIndex(lhs); - } - template - inline auto traceSpin(const vobj &lhs) -> Lattice(lhs))> - { - return traceIndex(lhs); - } - template - inline auto traceColour(const vobj &lhs) -> Lattice(lhs))> - { - return traceIndex(lhs); - } +////////////////////////////////////////// +// Trace lattice and non-lattice +////////////////////////////////////////// +template +inline auto traceSpin(const Lattice &lhs) -> Lattice(lhs._odata[0]))> +{ + return traceIndex(lhs); +} +template +inline auto traceColour(const Lattice &lhs) -> Lattice(lhs._odata[0]))> +{ + return traceIndex(lhs); +} +template +inline auto traceSpin(const vobj &lhs) -> Lattice(lhs))> +{ + return traceIndex(lhs); +} +template +inline auto traceColour(const vobj &lhs) -> Lattice(lhs))> +{ + return traceIndex(lhs); +} - ////////////////////////////////////////// - // Current types - ////////////////////////////////////////// - GRID_SERIALIZABLE_ENUM(Current, undef, - Vector, 0, - Axial, 1, - Tadpole, 2); - -} //namespace QCD -} // Grid - -/* -<<<<<<< HEAD -#include -#include -#include -#include -#include - -// Include representations -#include -#include -#include -#include - -// Scalar field -#include - -#include - -#include - -#include -#include -#include -#include - - -//#include -======= - ->>>>>>> develop -*/ +////////////////////////////////////////// +// Current types +////////////////////////////////////////// +GRID_SERIALIZABLE_ENUM(Current, undef, + Vector, 0, + Axial, 1, + Tadpole, 2); +NAMESPACE_END(Grid); #endif