CHROMA
subset_vectors.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Holds of vectors and weights
3  */
4 
5 #include "chromabase.h"
7 
8 using namespace QDP;
9 
10 namespace Chroma
11 {
12 
13  // Reader
14  void read(XMLReader& xml, const std::string& path, SubsetVectorWeight_t& param)
15  {
16  XMLReader paramtop(xml, path);
17  read(paramtop, path, param.weights);
18  }
19 
20  // Writer
21  void write(XMLWriter& xml, const std::string& path, const SubsetVectorWeight_t& param)
22  {
23  //push(xml, path);
24  write(xml, path, param.weights);
25  //pop(xml);
26  }
27 
28 
29  // Extract eigenvalues from a std::map, and arrange them in a different format
30  multi1d<SubsetVectorWeight_t> getEigenValues(const MapObject<int,EVPair<LatticeColorVector> >& eigen_source, int num_vecs)
31  {
32  multi1d<SubsetVectorWeight_t> evals(num_vecs);
33 
34  // Basic sanity check
35  if (num_vecs > eigen_source.size())
36  {
37  QDPIO::cerr << __func__ << ": requesting more vectors than are in the eigenstd::vector std::map\n";
38  QDP_abort(1);
39  }
40 
41  // A straight lookup is fine - will fail if not right number of eigenvalues
42  for(int i=0; i < num_vecs; ++i)
43  {
44  EVPair<LatticeColorVector> tmpvec; eigen_source.get(i, tmpvec);
45 
46  evals[i] = tmpvec.eigenValue;
47  }
48 
49  return evals;
50  }
51 
52 } // end namespace Chroma
Primary include file for CHROMA library code.
void read(XMLReader &xml, const std::string &path, SubsetVectorWeight_t &param)
Reader.
void write(XMLWriter &xml, const std::string &path, const SubsetVectorWeight_t &param)
Writer.
MODS_t & eigen_source
Eigenvectors.
unsigned i
Definition: ldumul_w.cc:34
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
multi1d< SubsetVectorWeight_t > getEigenValues(const MapObject< int, EVPair< LatticeColorVector > > &eigen_source, int num_vecs)
::std::string string
Definition: gtest.h:1979
A Pair type.
SubsetVectorWeight_t eigenValue
Weights for subset of vectors.
Holds of vectors and weights.