CHROMA
lgherm_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 #ifndef __lgherm_h__
4 #define __lgherm_h__
5 
6 #include "handle.h"
7 #include "linearop.h"
8 
9 
10 namespace Chroma
11 {
12  //! Gamma(5) hermitian linear operator
13  /*!
14  * \ingroup linop
15  *
16  * This routine is specific to Wilson fermions!
17  *
18  * This operator scales its input operator
19  */
20  template<typename T>
21  class lgherm : public LinearOperator<T>
22  {
23  public:
24  //! Initialize pointer with existing pointer
25  /*! Requires that the pointer p is a return value of new */
27 
28  //! Copy pointer (one more owner)
30 
31  //! Destructor
32  ~lgherm() {}
33 
34  //! Subset comes from underlying operator
35  inline const Subset& subset() const {return A->subset();}
36 
37  //! Apply the operator onto a source std::vector
38  /*! For this operator, the sign is ignored */
39  inline void operator() (T& chi, const T& psi, enum PlusMinus isign) const
40  {
41  const int G5=Ns*Ns-1;
42 
43  T tmp;
44  const Subset& sub = A->subset();
45 
46  // [ Gamma(5) D ]^{dag} = Gamma(5) D
47  // using D = gamma_5 D^{dag} gamma_5
48 
49  (*A)(tmp, psi, PLUS);
50  chi[sub] = Gamma(G5)*tmp;
51  }
52 
53  private:
55  };
56 
57 
58 
59  //! Partial specialization of scaled M operator over arrays
60  /*!
61  * \ingroup linop
62  *
63  * This routine is specific to Wilson fermions!
64  *
65  * Linear operator forming M^dag.M from an operator M
66  */
67  template<typename T>
68  class lghermArray : public LinearOperatorArray<T>
69  {
70  public:
71  //! Initialize pointer with existing pointer
72  /*! Requires that the pointer p is a return value of new */
74 
75  //! Copy pointer (one more owner)
77 
78  //! Destructor
80 
81  //! Length of array index
82  int size() const {return A->size();}
83 
84  //! Subset comes from underlying operator
85  inline const Subset& subset() const {return A->subset();}
86 
87  //! Apply the operator onto a source std::vector
88  /*! For this operator, the sign is ignored */
89  inline void operator() (multi1d<T>& chi, const multi1d<T>& psi, enum PlusMinus isign) const
90  {
91  const int G5=Ns*Ns-1;
92 
93  multi1d<T> tmp(size());
94  const Subset& sub = A->subset();
95 
96  // [ Gamma_5 D ]^{dag} = Gamma_5 D
97  // using D = gamma_5 D^{dag} gamma_5
98  (*A)(tmp, psi, PLUS);
99  for(int i = 0; i < size(); i++) {
100  chi[i][sub] = Gamma(G5)*tmp[i];
101  }
102  }
103 
104  private:
106  };
107 
108 
109 } // End Namespace Chroma
110 
111 
112 #endif
Class for counted reference semantics.
Definition: handle.h:33
Linear Operator to arrays.
Definition: linearop.h:61
Linear Operator.
Definition: linearop.h:27
Partial specialization of scaled M operator over arrays.
Definition: lgherm_w.h:69
lghermArray(LinearOperatorArray< T > *p)
Initialize pointer with existing pointer.
Definition: lgherm_w.h:73
int size() const
Length of array index.
Definition: lgherm_w.h:82
lghermArray(Handle< LinearOperatorArray< T > > p)
Copy pointer (one more owner)
Definition: lgherm_w.h:76
Handle< LinearOperatorArray< T > > A
Definition: lgherm_w.h:105
~lghermArray()
Destructor.
Definition: lgherm_w.h:79
void operator()(multi1d< T > &chi, const multi1d< T > &psi, enum PlusMinus isign) const
Apply the operator onto a source std::vector.
Definition: lgherm_w.h:89
const Subset & subset() const
Subset comes from underlying operator.
Definition: lgherm_w.h:85
Gamma(5) hermitian linear operator.
Definition: lgherm_w.h:22
void operator()(T &chi, const T &psi, enum PlusMinus isign) const
Apply the operator onto a source std::vector.
Definition: lgherm_w.h:39
lgherm(Handle< LinearOperator< T > > p)
Copy pointer (one more owner)
Definition: lgherm_w.h:29
const Subset & subset() const
Subset comes from underlying operator.
Definition: lgherm_w.h:35
~lgherm()
Destructor.
Definition: lgherm_w.h:32
Handle< LinearOperator< T > > A
Definition: lgherm_w.h:54
lgherm(LinearOperator< T > *p)
Initialize pointer with existing pointer.
Definition: lgherm_w.h:26
Class for counted reference semantics.
Linear Operators.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int G5
Definition: pbg5p_w.cc:57
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
LinOpSysSolverMGProtoClover::T T
int i
Definition: pbg5p_w.cc:55
@ PLUS
Definition: chromabase.h:45
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35