CHROMA
clover_term_ssed.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Clover term linear operator
4  */
5 
6 #ifndef __clover_term_ssed_clover_w_h__
7 #define __clover_term_ssed_clover_w_h__
8 
9 #include "qdp_precision.h"
10 #if BASE_PRECISION == 32
11 #error "This code only works in double precision"
12 #endif
13 
14 #include "state.h"
17 
18 namespace Chroma
19 {
20 
21  //! Special structure used for triangular objects
22  // Pad to cache line length
23  typedef RScalar<REAL64> PrimitiveClovDiag[2][8];
24 
25  // Of the 16 elements only 15 are used. but I want to pad
26  // to 16
27  typedef RComplex<REAL64> PrimitiveClovOffDiag[2][16];
28 
29  //! Clover term
30  /*!
31  * \ingroup linop
32  *
33  */
34  class SSEDCloverTerm : public CloverTermBase<LatticeFermionD,
35  LatticeColorMatrixD>
36  {
37  public:
38  // Typedefs to save typing
39  typedef LatticeDiracFermionD3 T;
40  typedef multi1d<LatticeColorMatrixD3> P;
41  typedef multi1d<LatticeColorMatrixD3> Q;
42 
43  //! Empty constructor. Must use create later
45  //! Free the internals
47 
48  //! Create from another
49  void create(Handle< FermState<T,P,Q> > fs,
50  const CloverFermActParams& param_,
51  const SSEDCloverTerm& from);
52 
53  //! Creation routine
54  void create(Handle< FermState<T,P,Q> > fs,
55  const CloverFermActParams& param_);
56 
57  //! Computes the inverse of the term on cb using Cholesky
58  /*!
59  * \param cb checkerboard of work (Read)
60  */
61  void choles(int cb);
62 
63  //! Computes the inverse of the term on cb using Cholesky
64  /*!
65  * \param cb checkerboard of work (Read)
66  * \return logarithm of the determinant
67  */
68  Double cholesDet(int cb) const ;
69 
70  /**
71  * Apply a dslash
72  *
73  * Performs the operation
74  *
75  * chi <- (L + D + L^dag) . psi
76  *
77  * where
78  * L is a lower triangular matrix
79  * D is the real diagonal. (stored together in type TRIANG)
80  *
81  * Arguments:
82  * \param chi result (Write)
83  * \param psi source (Read)
84  * \param isign D'^dag or D' ( MINUS | PLUS ) resp. (Read)
85  * \param cb Checkerboard of OUTPUT std::vector (Read)
86  */
87  void apply (LatticeDiracFermionD3& chi, const LatticeDiracFermionD3& psi, enum PlusMinus isign, int cb) const;
88 
89 
90  void applySite(LatticeDiracFermionD3& chi, const LatticeDiracFermionD3& psi, enum PlusMinus isign, int site) const;
91 
92  //! Calculates Tr_D ( Gamma_mat L )
93  void triacntr(LatticeColorMatrixD3& B, int mat, int cb) const;
94 
95  //! Return the fermion BC object for this linear operator
96  const FermBC<T,P,Q>& getFermBC() const {return *fbc;}
97 
98  protected:
99  //! Create the clover term on cb
100  /*!
101  * \param f field strength tensor F(mu,nu) (Read)
102  * \param cb checkerboard (Read)
103  */
104  void makeClov(const multi1d<LatticeColorMatrixD3>& f, const Real& diag_mass);
105 
106  //! Invert the clover term on cb using LDL^\dagger decomp
107  void ldagdlinv(LatticeDouble& tr_log_diag, int cb);
108 
109  //! Invert the clover term on cb using Cholesky decomp
110  void chlclovms(LatticeDouble& log_diag, int cb);
111 
112  //! Get the u field
113  const multi1d<LatticeColorMatrixD3>& getU() const {return u;}
114 
115  //! Calculates Tr_D ( Gamma_mat L )
116  Real getCloverCoeff(int mu, int nu) const;
117 
118  private:
120  multi1d<LatticeColorMatrixD3> u;
122  LatticeDouble tr_log_diag_; // Fill this out during create
123  // but save the global sum until needed.
124  multi1d<bool> choles_done; // Keep note of whether the decomposition has been done
125  // on a particular checkerboard.
128  };
129 
130 
131 
132 } // End Namespace Chroma
133 
134 
135 #endif
Base class for all fermion action boundary conditions.
Definition: fermbc.h:20
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
Double cholesDet(int cb) const
Computes the inverse of the term on cb using Cholesky.
multi1d< LatticeColorMatrixD3 > P
const multi1d< LatticeColorMatrixD3 > & getU() const
Get the u field.
multi1d< LatticeColorMatrixD3 > Q
~SSEDCloverTerm()
Free the internals.
PrimitiveClovOffDiag * tri_off_diag
void chlclovms(LatticeDouble &log_diag, int cb)
Invert the clover term on cb using Cholesky decomp.
void triacntr(LatticeColorMatrixD3 &B, int mat, int cb) const
Calculates Tr_D ( Gamma_mat L )
multi1d< bool > choles_done
void applySite(LatticeDiracFermionD3 &chi, const LatticeDiracFermionD3 &psi, enum PlusMinus isign, int site) const
PrimitiveClovDiag * tri_diag
void makeClov(const multi1d< LatticeColorMatrixD3 > &f, const Real &diag_mass)
Create the clover term on cb.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
void apply(LatticeDiracFermionD3 &chi, const LatticeDiracFermionD3 &psi, enum PlusMinus isign, int cb) const
Handle< FermBC< T, P, Q > > fbc
CloverFermActParams param
void create(Handle< FermState< T, P, Q > > fs, const CloverFermActParams &param_, const SSEDCloverTerm &from)
Create from another.
multi1d< LatticeColorMatrixD3 > u
void ldagdlinv(LatticeDouble &tr_log_diag, int cb)
Invert the clover term on cb using LDL^\dagger decomp.
Real getCloverCoeff(int mu, int nu) const
Calculates Tr_D ( Gamma_mat L )
LatticeDiracFermionD3 T
SSEDCloverTerm()
Empty constructor. Must use create later.
void choles(int cb)
Computes the inverse of the term on cb using Cholesky.
Parameters for Clover fermion action.
Clover term linear operator.
int mu
Definition: cool.cc:24
int nu
Definition: cool.cc:25
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
multi1d< LatticeFermion > chi(Ncb)
RScalar< REAL > PrimitiveClovDiag[2][8]
Special structure used for triangular objects.
LatticeFermion psi
Definition: mespbg5p_w.cc:35
RComplex< REAL > PrimitiveClovOffDiag[2][16]
int cb
Definition: invbicg.cc:120
FloatingPoint< double > Double
Definition: gtest.h:7351
Support class for fermion actions and linear operators.
Params for clover ferm acts.