TBTK
Need a break? Support the development by playing Polarity Puzzles
FockStateRule.h
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 
17 
24 #ifndef COM_DAFER45_TBTK_FOCK_STATE_RULE
25 #define COM_DAFER45_TBTK_FOCK_STATE_RULE
26 
27 #include "TBTK/FockState.h"
28 #include "TBTK/BitRegister.h"
30 #include "TBTK/LadderOperator.h"
31 
32 namespace TBTK{
33 
34 template<typename BIT_REGISTER>
35 class FockSpace;
36 
37 namespace FockStateRule{
38 
39 class WrapperRule;
40 
41 class FockStateRule{
42 public:
49  enum class FockStateRuleID {
50  WrapperRule = 0,
51  SumRule = 1,
52  DifferenceRule = 2
53  };
54 
56  FockStateRule(FockStateRuleID fockStateRuleID);
57 
59  virtual ~FockStateRule();
60 
62  virtual FockStateRule* clone() const = 0;
63 
66  virtual WrapperRule createNewRule(
67  const LadderOperator<BitRegister> &ladderOperator
68  ) const = 0;
69 
72  virtual WrapperRule createNewRule(
73  const LadderOperator<ExtensiveBitRegister> &ladderOperator
74  ) const = 0;
75 
78  virtual bool isSatisfied(
79  const FockSpace<BitRegister> &fockSpace,
80  const FockState<BitRegister> &fockState
81  ) const = 0;
82 
85  virtual bool isSatisfied(
86  const FockSpace<ExtensiveBitRegister> &fockSpace,
87  const FockState<ExtensiveBitRegister> &fockState
88  ) const = 0;
89 
91  virtual bool operator==(const FockStateRule &rhs) const = 0;
92 
99  friend WrapperRule operator*(
100  const LadderOperator<BitRegister> &ladderOperator,
101  const FockStateRule &fockStateRule
102  );
103 
110  friend WrapperRule operator*(
111  const LadderOperator<ExtensiveBitRegister> &ladderOperator,
112  const FockStateRule &fockStateRule
113  );
114 
116  FockStateRuleID getFockStateRuleID() const;
117 
119  virtual void print() const = 0;
120 private:
122  FockStateRuleID fockStateRuleID;
123 };
124 
125 inline FockStateRule::FockStateRuleID FockStateRule::getFockStateRuleID() const{
126  return fockStateRuleID;
127 }
128 
129 }; //End of namespace FockSpaceRule
130 }; //End of namespace TBTK
131 
132 #endif
133 
Register of bits.
Register of bits.
Definition: Boolean.h:32
const Vector2d operator*(double lhs, const Vector2d &rhs)
Definition: Vector2d.h:129