-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLanczos_07.h
53 lines (37 loc) · 1.11 KB
/
Lanczos_07.h
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
//Lanczos_07.h
//c++ class for performing a Lanczos diagonalization
//Roger Melko, November 2007
#ifndef LANCZOS_07
#define LANCZOS_07
#include <iostream>
#include <limits.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iomanip>
#include <vector>
using namespace std;
#include <blitz/array.h>
BZ_USING_NAMESPACE(blitz)
#include "GenHam.h"
typedef long double l_double; //precision for lanczos
class LANCZOS{
public:
//Data
int Dim; //dimension
Array<l_double,1> Psi; //eigenvector
//Methods
LANCZOS(const int);
void Diag(const GENHAM&, const int, const int);
void tred3(Array<double,2>& , Array<double,1>& , Array<double,1>& e, const int );
private:
int STARTIT;
long double CONV_PREC; //convergence precision
Array<l_double,1> V0;
Array<l_double,1> V1; //Ground state vector
Array<l_double,1> V2;
void apply(Array<l_double,1>&, const GENHAM&, const Array<l_double,1>&); //apply H to |V>
void Normalize(Array<l_double,1>& );
int tqli2(Array<l_double,1>& , Array<l_double,1>& , int , Array<l_double,2>& , const int );
}; //LANCZOS class
#endif