QNANO
Fermion_Double_Index.h
1 #ifndef QNANO_NEW_FERMION_DOUBLE_INDEX_DEFINED_H
2 #define QNANO_NEW_FERMION_DOUBLE_INDEX_DEFINED_H
3 
4 #include "manybody/Fermion_Index.h"
5 //#include "MPI_Distribute.h"
6 
7 
15 public:
16  //Main data: Fermion indices for electrons and holes, respectively:
17  Fermion_Index fi_e;
18  Fermion_Index fi_h;
19 
20 
21  double sort_get_sign();
22 
23  //Constructors:
25  Fermion_Double_Index(const std::vector<int> & lst_e, const std::vector<int> & lst_h) \
26  : fi_e(lst_e), fi_h(lst_h){
27  }
28  Fermion_Double_Index(const Fermion_Index & fi_e_,const Fermion_Index & fi_h_)\
29  : fi_e(fi_e_), fi_h(fi_h_){
30  }
31  Fermion_Double_Index(size_t se, size_t sh)\
32  : fi_e(se), fi_h(sh){
33  }
35  : fi_e(other.fi_e), fi_h(other.fi_h){
36  }
37  Fermion_Double_Index &operator=(const Fermion_Double_Index & other);
38 
39  //Compare operators for sorting and searching
40  bool operator==(const Fermion_Double_Index &other) const;
41  bool operator!=(const Fermion_Double_Index &other) const;
42  bool operator<(const Fermion_Double_Index &other) const;
43  bool operator>(const Fermion_Double_Index &other) const;
44 };
45 std::ostream &operator<<(std::ostream & os, const Fermion_Double_Index & fi);
46 
47 
48 
49 //Construct all possible sets of Fermion_Double_Indices for a given number
50 // and rank of electrons and holes.
51 std::vector<Fermion_Double_Index> get_all_Fermion_Double_Indices(size_t rank_e, size_t nr_e, size_t rank_h, size_t nr_h, size_t start_e=0, size_t start_h=0);
52 
53 
54 
55 
56 
57 
59 bool sort_Fermion_Double_Index( const Fermion_Double_Index &i1 ,const Fermion_Double_Index &i2 );
60 
62 bool sort_cv_Fermion_Double_Index( \
63 const std::pair<Fermion_Double_Index, std::complex<double> > &i1, \
64 const std::pair<Fermion_Double_Index, std::complex<double> > &i2 );
65 
66 
68 size_t Hash_Fermion_Double_Index(const Fermion_Double_Index &fi);
69 
70 
71 
72 /*
73 void distribute_Fermion_Index(MPI_Comm comm, Fermion_Index & fi, int tag=0){
74  size_t sz;
75  int MPI_rank;
76  MPI_Comm_rank(comm, &MPI_rank);
77  if(MPI_rank==0)sz=fi.size();
78  MPI_Distribute::distribute_size_t(comm, sz, tag);
79  if(MPI_rank!=0)fi.resize(sz);
80  for(size_t i=0; i<sz; i++){
81  MPI_Distribute::distribute_size_t(comm, fi[i], tag);
82  }
83 }
84 
85 void distribute_Fermion_Double_Index(MPI_Comm comm, Fermion_Double_Index & fi, int tag=0){
86  distribute_Fermion_Index(comm, fi.fi_e, tag);
87  distribute_Fermion_Index(comm, fi.fi_h, tag);
88 }
89 
90 void distribute_Fermion_Double_Index_vector(MPI_Comm comm, std::vector<Fermion_Double_Index> & v, int tag=0){
91  size_t sz;
92  int MPI_rank;
93  MPI_Comm_rank(comm, &MPI_rank);
94  if(MPI_rank==0)sz=v.size();
95  MPI_Distribute::distribute_size_t(comm, sz, tag);
96  if(MPI_rank!=0)v.resize(sz);
97  for(size_t i=0; i<sz; i++){
98  distribute_Fermion_Double_Index(comm, v[i], tag);
99  }
100 
101 }
102 */
103 
104 
105 #endif
Definition: Fermion_Double_Index.h:14
Definition: Fermion_Index.h:19