CHROMA
lopishift.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 #ifndef __lopishift_h__
3 #define __lopishift_h__
4 
5 /*! \file A linear operator scaled by i sigma where sigma is a Real shift */
6 
7 #include "handle.h"
8 #include "linearop.h"
9 
10 namespace Chroma {
11 
12  template<typename T, typename C>
13  class lopishift : public LinearOperator<T>
14  {
15  public:
16 
17  //! Initialized from pointer
19 
21 
23 
24  //! Subset comes from underlying operator
25  inline const Subset& subset() const {return M->subset();}
26 
27  virtual unsigned long nFlops() const {
28  return M->nFlops() + 4*Nc*Ns*(M->subset()).siteTable().size();
29  }
30 
31  //! Apply the operator onto a source std::vector
32  /*! For this operator, the sign is ignored */
33  inline void operator() (T& chi, const T& psi, enum PlusMinus isign) const
34  {
35  const Subset& sub = M->subset();
36  (*M)(chi, psi, isign);
37  T tmp;
38  tmp[sub] = Gamma(15)*timesI(psi);
39  if( isign == PLUS) {
40  chi[sub] += shift_fact*tmp; // (M + i shift) psi
41  }
42  else {
43  chi[sub] -= shift_fact*tmp; // (M - i shift) psi
44  }
45  }
46 
47  private:
49  const C& shift_fact;
50  };
51 }
52 #endif
Class for counted reference semantics.
Definition: handle.h:33
Linear Operator.
Definition: linearop.h:27
void operator()(T &chi, const T &psi, enum PlusMinus isign) const
Apply the operator onto a source std::vector.
Definition: lopishift.h:33
virtual unsigned long nFlops() const
Definition: lopishift.h:27
const Subset & subset() const
Subset comes from underlying operator.
Definition: lopishift.h:25
lopishift(Handle< LinearOperator< T > > p, const C &s)
Definition: lopishift.h:20
Handle< LinearOperator< T > > M
Definition: lopishift.h:48
lopishift(LinearOperator< T > *p, const C &s)
Initialized from pointer.
Definition: lopishift.h:18
const C & shift_fact
Definition: lopishift.h:49
Class for counted reference semantics.
Linear Operators.
SpinMatrix C()
C = Gamma(10)
Definition: barspinmat_w.cc:29
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
LinOpSysSolverMGProtoClover::T T
@ PLUS
Definition: chromabase.h:45
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
multi1d< LatticeFermion > s(Ncb)