CHROMA
spin_rep.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Sparse matrix representation of spin matrices
4  */
5 
6 #ifndef __spin_rep_h__
7 #define __spin_rep_h__
8 
9 #include "chromabase.h"
10 
11 namespace Chroma
12 {
13  //----------------------------------------------------------------------------------
14  //! The sparse representation of a spin matrix
16  {
17  int left; /*!< Spin row */
18  int right; /*!< Spin column */
19  ComplexD op; /*!< Value of data */
20  };
21 
22  //----------------------------------------------------------------------------
23  //! MatrixSpinRep reader
24  void read(XMLReader& xml, const std::string& path, MatrixSpinRep_t& param);
25 
26  //! MatrixSpinRep writer
27  void write(XMLWriter& xml, const std::string& path, const MatrixSpinRep_t& param);
28 
29  //----------------------------------------------------------------------------
30  //! MatrixSpinRep reader
31  void read(BinaryReader& bin, MatrixSpinRep_t& param);
32 
33  //! MatrixSpinRep writer
34  void write(BinaryWriter& bin, const MatrixSpinRep_t& param);
35 
36  //----------------------------------------------------------------------------------
37  //! Construct a spin matrix in the DR rep
38  SpinMatrix constructSpinDR(int gamma);
39 
40  //----------------------------------------------------------------------------------
41  //! Construct a spin matrix in the DP rep
42  SpinMatrix constructSpinDP(int gamma);
43 
44  //----------------------------------------------------------------------------------
45  //! Convert a DR gamma matrix indexed by gamma into a sparse spin representation
46  std::vector<MatrixSpinRep_t> convertTwoQuarkSpinDR(int gamma);
47 
48  //----------------------------------------------------------------------------------
49  //! Convert a DP gamma matrix indexed by gamma into a sparse spin representation
50  std::vector<MatrixSpinRep_t> convertTwoQuarkSpinDP(int gamma);
51 
52  //----------------------------------------------------------------------------------
53  //! Convert a generic spin matrix into a sparse spin representation
54  std::vector<MatrixSpinRep_t> convertTwoQuarkSpin(const SpinMatrix& in);
55 
56  //----------------------------------------------------------------------------------
57  //! Fold in gamma_4 for source ops
58  MatrixSpinRep_t foldSourceDP(const MatrixSpinRep_t& disp, bool src);
59 
60  //! Fold in gamma_4 for source ops
61  std::vector<MatrixSpinRep_t> foldSourceDP(const std::vector<MatrixSpinRep_t>& disp, bool src);
62 
63 
64  //----------------------------------------------------------------------------------
65  //----------------------------------------------------------------------------------
66  //! The sparse representation of a spin rank-3 tensor
68  {
69  int left; /*!< Spin left */
70  int middle; /*!< Spin middle */
71  int right; /*!< Spin right */
72  ComplexD op; /*!< Value of data */
73  };
74 
75  //----------------------------------------------------------------------------
76  //! Rank3SpinRep reader
77  void read(XMLReader& xml, const std::string& path, Rank3SpinRep_t& param);
78 
79  //! Rank3SpinRep writer
80  void write(XMLWriter& xml, const std::string& path, const Rank3SpinRep_t& param);
81 
82  //----------------------------------------------------------------------------
83  //! Rank3SpinRep reader
84  void read(BinaryReader& bin, Rank3SpinRep_t& param);
85 
86  //! Rank3SpinRep writer
87  void write(BinaryWriter& bin, const Rank3SpinRep_t& param);
88 
89  //----------------------------------------------------------------------------------
90  //! Convert a generic spin tensor into a sparse spin representation
91  std::vector<Rank3SpinRep_t> convertThreeQuarkSpin(const Array3dO<Complex>& in);
92 
93  //----------------------------------------------------------------------------------
94  //! Fold in gamma_4 for source ops
95  Rank3SpinRep_t foldSourceDP(const Rank3SpinRep_t& disp, bool src);
96 
97  //! Fold in gamma_4 for source ops
98  std::vector<Rank3SpinRep_t> foldSourceDP(const std::vector<Rank3SpinRep_t>& disp, bool src);
99 
100 } // namespace Chroma
101 
102 #endif
Primary include file for CHROMA library code.
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.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
SpinMatrix constructSpinDR(int gamma)
Construct a spin matrix in the DR rep.
Definition: spin_rep.cc:11
SpinMatrix constructSpinDP(int gamma)
Construct a spin matrix in the DP rep.
Definition: spin_rep.cc:18
std::vector< MatrixSpinRep_t > convertTwoQuarkSpinDP(int gamma)
Convert a DP gamma matrix indexed by gamma into a sparse spin representation.
Definition: spin_rep.cc:102
std::vector< MatrixSpinRep_t > convertTwoQuarkSpin(const SpinMatrix &in)
Convert a generic spin matrix into a sparse spin representation.
Definition: spin_rep.cc:67
MatrixSpinRep_t foldSourceDP(const MatrixSpinRep_t &spin, bool src)
Fold in gamma_4 for source ops.
Definition: spin_rep.cc:110
std::vector< Rank3SpinRep_t > convertThreeQuarkSpin(const Array3dO< Complex > &in)
Convert a generic spin tensor into a sparse spin representation.
Definition: spin_rep.cc:192
std::vector< MatrixSpinRep_t > convertTwoQuarkSpinDR(int gamma)
Convert a DR gamma matrix indexed by gamma into a sparse spin representation.
Definition: spin_rep.cc:95
static QDP_ColorVector * in
::std::string string
Definition: gtest.h:1979
The sparse representation of a spin matrix.
Definition: spin_rep.h:16
The sparse representation of a spin rank-3 tensor.
Definition: spin_rep.h:68