-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsolver.h
More file actions
81 lines (70 loc) · 1.94 KB
/
solver.h
File metadata and controls
81 lines (70 loc) · 1.94 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
// solver.h
// ED_solver
//
// Created by Bin Xu on 12/19/14.
// Copyright (c) 2014 Bin Xu. All rights reserved.
//
#ifndef __ED_solver__solver__
#define __ED_solver__solver__
#include <algorithm>
#include "interaction.h"
#include "lanczos.h"
#include "diag_wrapper.h"
class Measurement;
class Solver
{
friend class Measurement;
Interaction &interaction;
bool ch, lapack;
size_t Nev;
public:
Solver(Interaction &o_interaction, Orbital o_orb): interaction(o_interaction), orb_sector(o_orb)
{
Nev = std::min((size_t)interaction.hilbert_space.ham.lanczos_ne, interaction.state_list.size());
}
Orbital orb_sector;
vector<ch_eigenvector> ch_result;
vector<rs_eigenvector> rs_result;
vector<double> eigenvalues;
void diagonalize()
{
if (interaction.hilbert_space.ham.vf == -100)
{
ch = false;
if (interaction.state_list.size() < interaction.hilbert_space.ham.MaxLapackSize)
{
rsLapackDiagonalize();
lapack = true;
}
else
{
rsLanczosDiagonalize();
lapack = false;
}
}
else
{
ch = true;
if (interaction.state_list.size() < interaction.hilbert_space.ham.MaxLapackSize)
{
chLapackDiagonalize();
lapack = true;
}
else
{
chLanczosDiagonalize();
lapack = false;
}
}
}
void rsLanczosDiagonalize(){};
void chLanczosDiagonalize();
void rsLapackDiagonalize(){};
void chLapackDiagonalize();
void testEvec(int num);
void testNormalization(int num);
};
ostream& operator<<(ostream &os, ch_eigenvector &ch_result);
void matvec(int *size, complex<double> *vec_in, complex<double> *vec_out, bool *add);
#endif /* defined(__ED_solver__solver__) */