From c7152c520aef4b0b472146635483cc08418deced Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Tue, 9 Jun 2015 22:40:58 +0100 Subject: [PATCH] g5 and g5R5 hermitian are now differentiated --- lib/qcd/action/fermion/g5HermitianLinop.h | 47 ++++++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/lib/qcd/action/fermion/g5HermitianLinop.h b/lib/qcd/action/fermion/g5HermitianLinop.h index 5b3411ec..e5b691d8 100644 --- a/lib/qcd/action/fermion/g5HermitianLinop.h +++ b/lib/qcd/action/fermion/g5HermitianLinop.h @@ -6,10 +6,10 @@ namespace Grid { // Wrap an already herm matrix //////////////////////////////////////////////////////////////////// template -class Gamma5HermitianLinearOperator : public LinearOperatorBase { +class Gamma5R5HermitianLinearOperator : public LinearOperatorBase { Matrix &_Mat; public: - Gamma5HermitianLinearOperator(Matrix &Mat): _Mat(Mat){}; + Gamma5R5HermitianLinearOperator(Matrix &Mat): _Mat(Mat){}; void Op (const Field &in, Field &out){ HermOp(in,out); } @@ -45,5 +45,48 @@ public: } }; + +template +class Gamma5HermitianLinearOperator : public LinearOperatorBase { + Matrix &_Mat; + Gamma g5; +public: + Gamma5HermitianLinearOperator(Matrix &Mat): _Mat(Mat), g5(Gamma::Gamma5) {}; + void Op (const Field &in, Field &out){ + HermOp(in,out); + } + void AdjOp (const Field &in, Field &out){ + HermOp(in,out); + } + void OpDiag (const Field &in, Field &out) { + Field tmp(in._grid); + _Mat.Mdiag(in,tmp); + out=g5*tmp; + } + void OpDir (const Field &in, Field &out,int dir,int disp) { + Field tmp(in._grid); + _Mat.Mdir(in,tmp,dir,disp); + out=g5*tmp; + } + + void HermOpAndNorm(const Field &in, Field &out,RealD &n1,RealD &n2){ + + HermOp(in,out); + + ComplexD dot; + dot= innerProduct(in,out); + n1=real(dot); + + dot = innerProduct(out,out); + n2=real(dot); + } + void HermOp(const Field &in, Field &out){ + Field tmp(in._grid); + _Mat.M(in,tmp); + out=g5*tmp; + } +}; + + }} #endif