CHROMA
sftmom.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: sftmom.h,v 3.9 2009-02-17 16:33:38 edwards Exp $
3 /*! \file
4  * \brief Fourier transform phase factor support
5  */
6 
7 #ifndef __sftmom_h__
8 #define __sftmom_h__
9 
10 #include "chromabase.h"
11 
12 namespace Chroma
13 {
14 
15  //! Param struct for SftMom
16  /*!
17  * \ingroup ft
18  */
20  {
21  SftMomParams_t(); /*!< Default constructor in sftmom.cc */
22  int mom2_max; /*!< (mom - mom_origin)^2 <= mom2_max */
23  multi1d<int> mom_offset; /*!< Origin for the momentum */
24  bool avg_equiv_mom; /*!< average over equivalent momenta */
25  multi1d<int> origin_offset; /*<! Coordinate offset of the origin. Used to fix phase factor */
26  int decay_dir; /*!< Decay direction */
27  };
28 
29 
30  //! Fourier transform phase factor support
31  /*!
32  * \ingroup ft
33  */
34  class SftMom
35  {
36  public:
37  //! Constructor about origin
38  SftMom(int mom2_max, bool avg_equiv_mom_=false, int j_decay=-1);
39 
40  //! Constructor about origin, with a list of momenta
41  SftMom(const multi2d<int> & moms , int j_decay=-1);
42 
43  //! Construct around some fixed origin_offset
44  SftMom(int mom2_max, multi1d<int> origin_offset_,
45  bool avg_equiv_mom_=false, int j_decay=-1) ;
46 
47  //! Construct around some fixed origin_offset and mom_offset
48  SftMom(int mom2_max, multi1d<int> origin_offset_, multi1d<int> mom_offset_,
49  bool avg_equiv_mom_=false, int j_decay=-1)
50  { init(mom2_max, origin_offset_, mom_offset_, avg_equiv_mom_, j_decay); }
51 
52  //! General constructor
54  { init(p.mom2_max, p.origin_offset, p.mom_offset, p.avg_equiv_mom, p.decay_dir); }
55 
56  //! The set to be used in sumMulti
57  const Set& getSet() const { return sft_set; }
58 
59  //! Number of momenta
60  int numMom() const { return num_mom; }
61 
62  //! Number of subsets - length in decay direction
63  int numSubsets() const { return sft_set.numSubsets(); }
64 
65  //! Number of sites in each subset
66  int numSites() const;
67 
68  //! Decay direction
69  int getDir() const { return decay_dir; }
70 
71  //! Are momenta averaged?
72  bool getAvg() const { return avg_equiv_mom; }
73 
74  //! Momentum offset
75  multi1d<int> getMomOffset() const { return mom_offset; }
76 
77  //! Convert momenta id to actual array of momenta
78  multi1d<int> numToMom(int mom_num) const { return mom_list[mom_num]; }
79 
80  //! Convert array of momenta to momenta id
81  /*! \return id in [0,numMom()-1] or -1 if not in list */
82  int momToNum(const multi1d<int>& mom_in) const;
83 
84  //! Canonically order an array of momenta
85  /*! \return abs(mom[0]) >= abs(mom[1]) >= ... >= abs(mom[mu]) >= ... >= 0 */
86  multi1d<int> canonicalOrder(const multi1d<int>& mom) const;
87 
88  //! Return the phase for this particular momenta id
89  const LatticeComplex& operator[](int mom_num) const
90  { return phases[mom_num]; }
91 
92  //! Return the the multiplicity for this momenta id.
93  /*! Only nonzero if momentum averaging is turned on */
94  int multiplicity(int mom_num) const
95  { return mom_degen[mom_num]; }
96 
97  //! Do a sumMulti(cf*phases,getSet())
98  multi2d<DComplex> sft(const LatticeComplex& cf) const;
99 
100  //! Do a sum(cf*phases,getSet()[my_subset])
101  multi2d<DComplex> sft(const LatticeComplex& cf, int subset_color) const;
102 
103  //! Do a sumMulti(cf*phases,getSet())
104  multi2d<DComplex> sft(const LatticeReal& cf) const;
105 
106  //! Do a sumMulti(cf*phases,getSet()[my_subset])
107  multi2d<DComplex> sft(const LatticeReal& cf, int subset_color) const;
108 
109 #if BASE_PRECISION==32
110  multi2d<DComplex> sft(const LatticeComplexD& cf) const;
111  //! Do a sum(cf*phases,getSet()[my_subset])
112  multi2d<DComplex> sft(const LatticeComplexD& cf, int subset_color) const;
113 #endif
114 
115  private:
116  SftMom() {} // hide default constructor
117 
118  void init(int mom2_max, multi1d<int> origin_offset, multi1d<int> mom_offset,
119  bool avg_mom_=false, int j_decay=-1);
120 
121  multi2d<int> mom_list;
124  int num_mom;
125  multi1d<int> origin_offset;
126  multi1d<int> mom_offset;
127  multi1d<LatticeComplex> phases;
128  multi1d<int> mom_degen;
129  Set sft_set;
130  };
131 
132 } // end namespace Chroma
133 
134 #endif
Primary include file for CHROMA library code.
Fourier transform phase factor support.
Definition: sftmom.h:35
multi2d< int > mom_list
Definition: sftmom.h:121
multi1d< int > getMomOffset() const
Momentum offset.
Definition: sftmom.h:75
int numSites() const
Number of sites in each subset.
Definition: sftmom.cc:219
int numSubsets() const
Number of subsets - length in decay direction.
Definition: sftmom.h:63
multi1d< int > canonicalOrder(const multi1d< int > &mom) const
Canonically order an array of momenta.
Definition: sftmom.cc:464
int decay_dir
Definition: sftmom.h:123
multi1d< int > origin_offset
Definition: sftmom.h:125
SftMom(const SftMomParams_t &p)
General constructor.
Definition: sftmom.h:53
SftMom(int mom2_max, multi1d< int > origin_offset_, multi1d< int > mom_offset_, bool avg_equiv_mom_=false, int j_decay=-1)
Construct around some fixed origin_offset and mom_offset.
Definition: sftmom.h:48
multi1d< int > mom_offset
Definition: sftmom.h:126
const LatticeComplex & operator[](int mom_num) const
Return the phase for this particular momenta id.
Definition: sftmom.h:89
multi1d< int > numToMom(int mom_num) const
Convert momenta id to actual array of momenta.
Definition: sftmom.h:78
int getDir() const
Decay direction.
Definition: sftmom.h:69
int momToNum(const multi1d< int > &mom_in) const
Convert array of momenta to momenta id.
Definition: sftmom.cc:496
bool getAvg() const
Are momenta averaged?
Definition: sftmom.h:72
multi2d< DComplex > sft(const LatticeComplex &cf) const
Do a sumMulti(cf*phases,getSet())
Definition: sftmom.cc:524
bool avg_equiv_mom
Definition: sftmom.h:122
int numMom() const
Number of momenta.
Definition: sftmom.h:60
multi1d< LatticeComplex > phases
Definition: sftmom.h:127
void init(int mom2_max, multi1d< int > origin_offset, multi1d< int > mom_offset, bool avg_mom_=false, int j_decay=-1)
Definition: sftmom.cc:236
multi1d< int > mom_degen
Definition: sftmom.h:128
int multiplicity(int mom_num) const
Return the the multiplicity for this momenta id.
Definition: sftmom.h:94
const Set & getSet() const
The set to be used in sumMulti.
Definition: sftmom.h:57
int j_decay
Definition: meslate.cc:22
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
Param struct for SftMom.
Definition: sftmom.h:20
multi1d< int > mom_offset
Definition: sftmom.h:23
multi1d< int > origin_offset
Definition: sftmom.h:25