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