-
Notifications
You must be signed in to change notification settings - Fork 0
/
BiFermionic.hpp
90 lines (80 loc) · 2.72 KB
/
BiFermionic.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef DEF_BIFERMIONIC
#define DEF_BIFERMIONIC
#include "System.hpp"
/*!Class that contains the information on the state*/
template<typename Type>
class BiFermionic : public virtual System{
public:
/*!Constructor*/
BiFermionic(Fermionic<Type> const& F0, Fermionic<Type> const& F1);
/*!Copy constructor*/
BiFermionic(BiFermionic<Type> const& BF);
/*!Constructor that reads from file*/
BiFermionic(IOFiles& r);
/*!Destructor*/
virtual ~BiFermionic();
/*{Forbidden*/
BiFermionic(BiFermionic<Type>&&) = delete;
BiFermionic<Type>& operator=(BiFermionic<Type>) = delete;
/*}*/
BiFermionic<Type> const& get_bifermionic() const { return (*this); }
protected:
/*!Constructor*/
BiFermionic();
bool same_wf_[2]; //!< true if the same wavefunction is used for all colors
Matrix<Type>* EVec_[2]; //!< eigenvectors matrix (transfer matrix)
};
/*constructors and destructor and initialization*/
/*{*/
template<typename Type>
BiFermionic<Type>::BiFermionic(Fermionic<Type> const& F0, Fermionic<Type> const& F1):
System(F1),
same_wf_{F0.use_same_wf(),F1.use_same_wf()},
EVec_{new Matrix<Type>[N_],new Matrix<Type>[N_]}
{
if(F0.get_EVec() || F1.get_EVec()){
if(same_wf_[0]){ for(unsigned int c(0);c<N_;c++){ EVec_[0][c] = F0.get_EVec(0); } }
else { for(unsigned int c(0);c<N_;c++){ EVec_[0][c] = F0.get_EVec(c); } }
if(same_wf_[1]){ for(unsigned int c(0);c<N_;c++){ EVec_[1][c] = F1.get_EVec(0); } }
else { for(unsigned int c(0);c<N_;c++){ EVec_[1][c] = F1.get_EVec(c); } }
} else { std::cerr<<__PRETTY_FUNCTION__<<" : EVec_ == NULL"<<std::endl; }
}
template<typename Type>
BiFermionic<Type>::BiFermionic(BiFermionic<Type> const& BF):
System(BF),
same_wf_{BF.same_wf_[0],BF.same_wf_[1]},
EVec_{new Matrix<Type>[N_],new Matrix<Type>[N_]}
{
if(BF.EVec_){
for(unsigned int i(0);i<2;i++){
if(same_wf_[i]){ for(unsigned int c(0);c<N_;c++){ EVec_[i][c] = BF.EVec_[i][0]; } }
else { for(unsigned int c(0);c<N_;c++){ EVec_[i][c] = BF.EVec_[i][c]; } }
}
} else { std::cerr<<__PRETTY_FUNCTION__<<" : EVec_ == NULL"<<std::endl; }
}
template<typename Type>
BiFermionic<Type>::BiFermionic(IOFiles& r):
System(r),
same_wf_{r.read<bool>(),r.read<bool>()},
EVec_{new Matrix<Type>[N_],new Matrix<Type>[N_]}
{
if(N_){
for(unsigned int i(0);i<2;i++){
r>>EVec_[i][0];
if(same_wf_[i]){ for(unsigned int c(1);c<N_;c++){ EVec_[i][c] = EVec_[i][0]; } }
else { for(unsigned int c(1);c<N_;c++){ r>>EVec_[i][c]; } }
}
} else { std::cerr<<__PRETTY_FUNCTION__<<" : N_ == 0"<<std::endl; }
}
template<typename Type>
BiFermionic<Type>::BiFermionic():
same_wf_{true,true},
EVec_{NULL,NULL}
{}
template<typename Type>
BiFermionic<Type>::~BiFermionic(){
if(EVec_[0]){ delete[] EVec_[0]; }
if(EVec_[1]){ delete[] EVec_[1]; }
}
/*}*/
#endif