2015-06-05 18:16:25 +01:00
|
|
|
#ifndef G5_HERMITIAN_LINOP
|
|
|
|
#define G5_HERMITIAN_LINOP
|
2015-07-21 05:53:23 +01:00
|
|
|
|
2015-06-05 18:16:25 +01:00
|
|
|
namespace Grid {
|
|
|
|
namespace QCD {
|
2015-07-21 05:53:23 +01:00
|
|
|
|
2015-06-05 18:16:25 +01:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
// Wrap an already herm matrix
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
template<class Matrix,class Field>
|
2015-06-09 22:40:58 +01:00
|
|
|
class Gamma5R5HermitianLinearOperator : public LinearOperatorBase<Field> {
|
2015-06-05 18:16:25 +01:00
|
|
|
Matrix &_Mat;
|
|
|
|
public:
|
2015-06-09 22:40:58 +01:00
|
|
|
Gamma5R5HermitianLinearOperator(Matrix &Mat): _Mat(Mat){};
|
2015-06-05 18:16:25 +01:00
|
|
|
void Op (const Field &in, Field &out){
|
2015-06-08 12:04:59 +01:00
|
|
|
HermOp(in,out);
|
2015-06-05 18:16:25 +01:00
|
|
|
}
|
|
|
|
void AdjOp (const Field &in, Field &out){
|
2015-06-08 12:04:59 +01:00
|
|
|
HermOp(in,out);
|
|
|
|
}
|
|
|
|
void OpDiag (const Field &in, Field &out) {
|
|
|
|
Field tmp(in._grid);
|
|
|
|
_Mat.Mdiag(in,tmp);
|
|
|
|
G5R5(out,tmp);
|
2015-06-05 18:16:25 +01:00
|
|
|
}
|
2015-06-08 12:04:59 +01:00
|
|
|
void OpDir (const Field &in, Field &out,int dir,int disp) {
|
|
|
|
Field tmp(in._grid);
|
|
|
|
_Mat.Mdir(in,tmp,dir,disp);
|
|
|
|
G5R5(out,tmp);
|
|
|
|
}
|
|
|
|
|
2015-06-05 18:16:25 +01:00
|
|
|
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);
|
|
|
|
G5R5(out,tmp);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-06-09 22:40:58 +01:00
|
|
|
|
|
|
|
template<class Matrix,class Field>
|
|
|
|
class Gamma5HermitianLinearOperator : public LinearOperatorBase<Field> {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-06-05 18:16:25 +01:00
|
|
|
}}
|
|
|
|
#endif
|