TBTK
Need a break? Support the development by playing Polarity Puzzles
ForwardDifference.h
Go to the documentation of this file.
1 /* Copyright 2018 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_FORWARD_DIFFERENCE
24 #define COM_DAFER45_TBTK_FORWARD_DIFFERENCE
25 
27 
28 namespace TBTK{
29 
32 public:
41  unsigned int subindex,
42  const Index &index,
43  double dx = 1
44  );
45 };
46 
48  unsigned int subindex,
49  const Index &index,
50  double dx
51 ){
52  TBTKAssert(
53  subindex < index.getSize(),
54  "ForwardDifference::ForwardDifference()",
55  "Invalid subindex. The subindex '" << subindex << "' is larger"
56  << " than the size of the Index '" << index.getSize() << "'.",
57  ""
58  );
59  Index forward = index;
60  forward[subindex]++;
61  add(HoppingAmplitude(1/dx, index, index));
62  add(HoppingAmplitude(-1/dx, index, forward));
63 }
64 
65 }; //End of namespace TBTK
66 
67 #endif
List of HoppingAmplitudes .
Definition: HoppingAmplitudeList.h:34
HoppingAmplitudeList corresponding to a forward difference.
Definition: ForwardDifference.h:31
void add(const HoppingAmplitude &hoppingAmplitude)
Definition: HoppingAmplitudeList.h:85
ForwardDifference(unsigned int subindex, const Index &index, double dx=1)
Definition: ForwardDifference.h:47
Hopping amplitude from state &#39;from&#39; to state &#39;to&#39;.
Definition: HoppingAmplitude.h:53
unsigned int getSize() const
Definition: Index.h:482
Physical index.
Definition: Index.h:44
Definition: Boolean.h:32
List of HoppingAmplitudes .