sftmom.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //  $Id: sftmom.h,v 3.9 2009/02/17 16:33:38 edwards Exp $
00003 /*! \file
00004  *  \brief Fourier transform phase factor support
00005  */
00006 
00007 #ifndef __sftmom_h__
00008 #define __sftmom_h__
00009 
00010 #include "chromabase.h"
00011 
00012 namespace Chroma 
00013 {
00014 
00015   //! Param struct for SftMom
00016   /*!
00017    * \ingroup ft
00018    */
00019   struct SftMomParams_t
00020   {
00021     SftMomParams_t();                 /*!< Default constructor in sftmom.cc */
00022     int           mom2_max;           /*!< (mom - mom_origin)^2 <= mom2_max */
00023     multi1d<int>  mom_offset;         /*!< Origin for the momentum */
00024     bool          avg_equiv_mom;      /*!< average over equivalent momenta */
00025     multi1d<int>  origin_offset;      /*<! Coordinate offset of the origin. Used to fix phase factor */
00026     int           decay_dir;          /*!< Decay direction */
00027   };
00028 
00029 
00030   //! Fourier transform phase factor support
00031   /*!
00032    * \ingroup ft
00033    */
00034   class SftMom
00035   {
00036   public:
00037     //! Constructor about origin
00038     SftMom(int mom2_max, bool avg_equiv_mom_=false, int j_decay=-1);
00039     
00040                 //! Constructor about origin, with a list of momenta 
00041     SftMom(const multi2d<int> & moms , int j_decay=-1);
00042 
00043     //! Construct around some fixed origin_offset
00044     SftMom(int mom2_max, multi1d<int> origin_offset_,
00045            bool avg_equiv_mom_=false, int j_decay=-1) ;
00046 
00047     //! Construct around some fixed origin_offset and mom_offset
00048     SftMom(int mom2_max, multi1d<int> origin_offset_, multi1d<int> mom_offset_,
00049            bool avg_equiv_mom_=false, int j_decay=-1) 
00050       { init(mom2_max, origin_offset_, mom_offset_, avg_equiv_mom_, j_decay); }
00051 
00052     //! General constructor
00053     SftMom(const SftMomParams_t& p)
00054       { init(p.mom2_max, p.origin_offset, p.mom_offset, p.avg_equiv_mom, p.decay_dir); }
00055 
00056     //! The set to be used in sumMulti
00057     const Set& getSet() const { return sft_set; }
00058 
00059     //! Number of momenta
00060     int numMom() const { return num_mom; }
00061 
00062     //! Number of subsets - length in decay direction
00063     int numSubsets() const { return sft_set.numSubsets(); }
00064 
00065     //! Number of sites in each subset
00066     int numSites() const;
00067 
00068     //! Decay direction
00069     int getDir() const { return decay_dir; }
00070 
00071     //! Are momenta averaged?
00072     bool getAvg() const { return avg_equiv_mom; }
00073 
00074     //! Momentum offset
00075     multi1d<int> getMomOffset() const { return mom_offset; }
00076 
00077     //! Convert momenta id to actual array of momenta
00078     multi1d<int> numToMom(int mom_num) const { return mom_list[mom_num]; }
00079 
00080     //! Convert array of momenta to momenta id
00081     /*! \return id in [0,numMom()-1] or -1 if not in list */
00082     int momToNum(const multi1d<int>& mom_in) const;
00083 
00084     //! Canonically order an array of momenta
00085     /*! \return abs(mom[0]) >= abs(mom[1]) >= ... >= abs(mom[mu]) >= ... >= 0 */
00086     multi1d<int> canonicalOrder(const multi1d<int>& mom) const;
00087 
00088     //! Return the phase for this particular momenta id
00089     const LatticeComplex& operator[](int mom_num) const
00090       { return phases[mom_num]; }
00091 
00092     //! Return the the multiplicity for this momenta id.
00093     /*! Only nonzero if momentum averaging is turned on */
00094     int multiplicity(int mom_num) const
00095       { return mom_degen[mom_num]; }
00096 
00097     //! Do a sumMulti(cf*phases,getSet())
00098     multi2d<DComplex> sft(const LatticeComplex& cf) const;
00099 
00100     //! Do a sum(cf*phases,getSet()[my_subset])
00101     multi2d<DComplex> sft(const LatticeComplex& cf, int subset_color) const;
00102 
00103     //! Do a sumMulti(cf*phases,getSet())
00104     multi2d<DComplex> sft(const LatticeReal& cf) const;
00105 
00106     //! Do a sumMulti(cf*phases,getSet()[my_subset])
00107     multi2d<DComplex> sft(const LatticeReal& cf, int subset_color) const;
00108 
00109   private:
00110     SftMom() {} // hide default constructor
00111 
00112     void init(int mom2_max, multi1d<int> origin_offset, multi1d<int> mom_offset,
00113               bool avg_mom_=false, int j_decay=-1);
00114 
00115     multi2d<int> mom_list;
00116     bool         avg_equiv_mom;
00117     int          decay_dir;
00118     int          num_mom;
00119     multi1d<int> origin_offset;
00120     multi1d<int> mom_offset;
00121     multi1d<LatticeComplex> phases;
00122     multi1d<int> mom_degen;
00123     Set sft_set;
00124   };
00125 
00126 }  // end namespace Chroma
00127 
00128 #endif

Generated on Sun Nov 22 04:34:23 2009 for CHROMA by  doxygen 1.4.7