TBTK
FockStateRuleSet.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_RULE_SET
24 #define COM_DAFER45_TBTK_FOCK_STATE_RULE_SET
25 
26 #include "TBTK/FockStateRule.h"
27 #include "TBTK/WrapperRule.h"
28 
29 #include <vector>
30 
31 namespace TBTK{
32 
34 public:
37 
40 
43  bool isSatisfied(
44  const FockSpace<BitRegister> &fockSpace,
45  const FockState<BitRegister> &fockState
46  ) const;
47 
50  bool isSatisfied(
51  const FockSpace<ExtensiveBitRegister> &fockSpace,
52  const FockState<ExtensiveBitRegister> &fockState
53  ) const;
54 
56  void addFockStateRule(const FockStateRule::WrapperRule &fockStateRule);
57 
59  unsigned int getSize() const;
60 
62  bool operator==(const FockStateRuleSet &rhs) const;
63 
69  const LadderOperator<BitRegister> &ladderOperator,
70  const FockStateRuleSet &fockStateRuleSet
71  );
72 
78  const LadderOperator<ExtensiveBitRegister> &ladderOperator,
79  const FockStateRuleSet &fockStateRuleSet
80  );
81 
83  void print() const;
84 private:
86  std::vector<FockStateRule::WrapperRule> fockStateRules;
87 };
88 
90  const FockStateRule::WrapperRule &fockStateRule
91 ){
92  for(unsigned int n = 0; n < fockStateRules.size(); n++)
93  if(fockStateRules.at(n) == fockStateRule)
94  return;
95 
96  fockStateRules.push_back(fockStateRule);
97 }
98 
99 inline unsigned int FockStateRuleSet::getSize() const{
100  return fockStateRules.size();
101 }
102 
104  const LadderOperator<BitRegister> &ladderOperator,
105  const FockStateRuleSet &fockStateRuleSet
106 ){
107  FockStateRuleSet newRuleSet;
108  for(unsigned int n = 0; n < fockStateRuleSet.fockStateRules.size(); n++)
109  newRuleSet.addFockStateRule(ladderOperator*fockStateRuleSet.fockStateRules.at(n));
110 
111  return newRuleSet;
112 }
113 
115  const LadderOperator<ExtensiveBitRegister> &ladderOperator,
116  const FockStateRuleSet &fockStateRuleSet
117 ){
118  FockStateRuleSet newRuleSet;
119  for(unsigned int n = 0; n < fockStateRuleSet.fockStateRules.size(); n++)
120  newRuleSet.addFockStateRule(ladderOperator*fockStateRuleSet.fockStateRules.at(n));
121 
122  return newRuleSet;
123 }
124 
125 inline void FockStateRuleSet::print() const{
126  Streams::out << "FockStateRuleSet{\n";
127  for(unsigned int n = 0; n < fockStateRules.size(); n++){
128  if(n > 0)
129  Streams::out << ",\n";
130  Streams::out << "\t";
131  fockStateRules.at(n).print();
132  }
133  Streams::out << "\n}\n";
134 }
135 
136 }; //End of namespace TBTK
137 
138 #endif
Definition: FockSpace.h:44
bool operator==(const FockStateRuleSet &rhs) const
friend FockStateRuleSet operator*(const LadderOperator< BitRegister > &ladderOperator, const FockStateRuleSet &fockStateRuleSet)
Definition: FockStateRuleSet.h:103
void addFockStateRule(const FockStateRule::WrapperRule &fockStateRule)
Definition: FockStateRuleSet.h:89
Definition: FockState.h:34
void print() const
Definition: FockStateRuleSet.h:125
static std::ostream out
Definition: Streams.h:36
FockStateRule.
Definition: WrapperRule.h:31
unsigned int getSize() const
Definition: FockStateRuleSet.h:99
Definition: ModelFactory.h:35
bool isSatisfied(const FockSpace< BitRegister > &fockSpace, const FockState< BitRegister > &fockState) const
Definition: FockState.h:37
WrapperRule.
Definition: FockStateRuleSet.h:33