TBTK
FockState.h
Go to the documentation of this file.
1 /* Copyright 2016 Kristofer Bj√∂rnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
23 #ifndef COM_DAFER45_TBTK_FOCK_STATE
24 #define COM_DAFER45_TBTK_FOCK_STATE
25 
26 #include "TBTK/Streams.h"
27 
28 namespace TBTK{
29 
30 template<typename BIT_REGISTER>
31 class FockSpace;
32 
33 template<typename BIT_REGISTER>
35 
36 template<typename BIT_REGISTER>
37 class FockState{
38 public:
40  FockState(unsigned int exponentialDimension);
41 
43  FockState(const FockState &fockState);
44 
46  ~FockState();
47 
49  bool isNull() const;
50 
52  const BIT_REGISTER& getBitRegister() const;
53 
55  BIT_REGISTER& getBitRegister();
56 
58  int getPrefactor() const;
59 
61 // unsigned int getNumFermions() const;
62 
64  void print() const;
65 private:
67  friend class FockSpace<BIT_REGISTER>;
68 
70  friend class LadderOperator<BIT_REGISTER>;
71 
73  BIT_REGISTER bitRegister;
74 
77  int prefactor;
78 };
79 
80 template<typename BIT_REGISTER>
81 FockState<BIT_REGISTER>::FockState(unsigned int exponentialDimension
82 ) :
83  bitRegister(exponentialDimension+1)
84 {
85  bitRegister.clear();
86  prefactor = 1;
87 }
88 
89 template<typename BIT_REGISTER>
91 ) :
92  bitRegister(fockState.bitRegister)
93 {
94  prefactor = fockState.prefactor;
95 }
96 
97 template<typename BIT_REGISTER>
99 }
100 
101 template<typename BIT_REGISTER>
103  return bitRegister.getMostSignificantBit();
104 }
105 
106 template<typename BIT_REGISTER>
107 const BIT_REGISTER& FockState<BIT_REGISTER>::getBitRegister() const{
108  return bitRegister;
109 }
110 
111 template<typename BIT_REGISTER>
113  return bitRegister;
114 }
115 
116 template<typename BIT_REGISTER>
118  return prefactor;
119 }
120 
121 /*template<typename BIT_REGISTER>
122 unsigned int FockState<BIT_REGISTER>::getNumFermions() const{
123  return bitRegister.getNumOneBits();
124 }*/
125 
126 template<typename BIT_REGISTER>
128  Streams::out << prefactor << "|";
129  for(int n = bitRegister.getNumBits()-1; n >= 0; n--){
130  Streams::out << bitRegister.getBit(n);
131  if(n%8 == 0 && n != 0)
132  Streams::out << " ";
133  }
134  Streams::out << ">\n";
135 }
136 
137 }; //End of namespace TBTK
138 
139 #endif
bool isNull() const
Definition: FockState.h:102
Definition: FockSpace.h:44
~FockState()
Definition: FockState.h:98
const BIT_REGISTER & getBitRegister() const
Definition: FockState.h:107
Definition: FockState.h:34
static std::ostream out
Definition: Streams.h:36
Definition: ModelFactory.h:35
FockState(unsigned int exponentialDimension)
Definition: FockState.h:81
Definition: FockState.h:37
Streams for TBTK output.
void print() const
Definition: FockState.h:127
int getPrefactor() const
Definition: FockState.h:117