00001 // -*- C++ -*- 00002 // $Id: subset_vectors.h,v 1.2 2009/05/21 02:39:13 jbulava Exp $ 00003 /*! \file 00004 * \brief Holds of vectors and weights 00005 */ 00006 00007 #ifndef __subset_vectors_h__ 00008 #define __subset_vectors_h__ 00009 00010 #include "chromabase.h" 00011 00012 namespace Chroma 00013 { 00014 //! Weights for subset of vectors 00015 /*! \ingroup ferm */ 00016 struct SubsetVectorWeight_t 00017 { 00018 multi1d<Real> weights; 00019 }; 00020 00021 //! Reader 00022 /*! \ingroup ferm */ 00023 void read(XMLReader& xml, const std::string& path, SubsetVectorWeight_t& param); 00024 00025 //! Writer 00026 /*! \ingroup ferm */ 00027 void write(XMLWriter& xml, const std::string& path, const SubsetVectorWeight_t& param); 00028 00029 00030 //! Holds of vectors and weights 00031 /*! 00032 * \ingroup ferm 00033 */ 00034 template<typename T> 00035 class SubsetVectors 00036 { 00037 public: 00038 //! Partial constructor 00039 SubsetVectors() {} 00040 00041 //! Full constructor 00042 SubsetVectors(const multi1d<SubsetVectorWeight_t>& eval, int decay_dir_, const multi1d<T>& evec) 00043 : evalues(eval), decay_dir(decay_dir_), evectors(evec) { 00044 if (eval.size() != evec.size() ) { 00045 QDPIO::cout << "Eval array size not equal to evec array size" << endl; 00046 QDP_abort(1); 00047 } 00048 } 00049 00050 //! Destructor 00051 ~SubsetVectors() {} 00052 00053 //! Number of vectors 00054 int getNumVectors() const {return evectors.size();} 00055 00056 //! Extent of decay direction 00057 int getDecayExtent() const {return QDP::Layout::lattSize()[decay_dir];} 00058 00059 //! Get decay direction 00060 int getDecayDir() const {return decay_dir;} 00061 00062 //! Set decay direction 00063 int& getDecayDir() {return decay_dir;} 00064 00065 //! Getter 00066 const multi1d<SubsetVectorWeight_t>& getEvalues() const {return evalues;} 00067 //! Setter 00068 multi1d<SubsetVectorWeight_t>& getEvalues() {return evalues;} 00069 00070 //! Getter 00071 const multi1d<T>& getEvectors() const {return evectors;} 00072 //! Setter 00073 multi1d<T>& getEvectors() {return evectors;} 00074 00075 private: 00076 int decay_dir; 00077 multi1d<SubsetVectorWeight_t> evalues; 00078 multi1d<T> evectors; 00079 }; 00080 } 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 #endif
1.4.7