sisi4s
Loading...
Searching...
No Matches
CcsdPreconditioner.hpp
Go to the documentation of this file.
1#ifndef CCSD_PRE_CONDITIONER_DEFINED
2#define CCSD_PRE_CONDITIONER_DEFINED
3
4#define _DEFINE_SETTER(type, name, default) \
5 CcsdPreconditioner &set##name(type t) { \
6 name = t; \
7 return *this; \
8 } \
9 type name = default
10
11#define __DEFINE_SETTER(type, name, default) \
12 Preconditioner &set##name(type t) { \
13 name = t; \
14 return *this; \
15 } \
16 type name = default
17
19#include <math/FockVector.hpp>
20#include <vector>
21#include <math/Complex.hpp>
23
24namespace sisi4s {
25
26template <typename F, typename V>
28public:
29 virtual void calculateDiagonal() = 0;
30
31 virtual std::vector<V> getInitialBasis(int eigenVectorsCount) = 0;
32
33 virtual V getCorrection(const complex eigenValue, V &residuum) = 0;
34
46};
47
53template <typename F>
55public:
57
60
72
74 spinFlip = t;
75 return *this;
76 }
78 preconditionerRandom = t;
79 return *this;
80 }
82 preconditionerRandomSigma = t;
83 return *this;
84 }
85
90 std::vector<SDFockVector<F>> getInitialBasis(int eigenVectorsCount);
91
92 SFockVector<F> getCorrection(const complex eigenValue,
93 SFockVector<F> &residuum);
94
95 SDFockVector<F> getCorrection(const complex eigenValue,
96 SDFockVector<F> &residuum);
97
98 SDTFockVector<F> getCorrection(const complex eigenValue,
99 SDTFockVector<F> &residuum);
100
101 void calculateDiagonal();
104 return diagonalH;
105 }
106
108
109private:
113 bool preconditionerRandom = false;
114
115 // wether or not to use spin flip in the filtering
116 bool spinFlip = false;
117
122 double preconditionerRandomSigma = 1.0;
123};
124
125template <typename F>
126class IPCcsdPreconditioner : public Preconditioner<F, SDFockVector<F>> {
127public:
130
131 void calculateDiagonal();
132
133 std::vector<V> getInitialBasis(int eigenVectorsCount);
134
135 V getCorrection(const complex eigenValue, V &residuum);
136};
137
138template <typename F>
139class EACcsdPreconditioner : public Preconditioner<F, SDFockVector<F>> {
140public:
143
144 void calculateDiagonal();
145
146 std::vector<V> getInitialBasis(int eigenVectorsCount);
147
148 V getCorrection(const complex eigenValue, V &residuum);
149};
150
151template <typename F>
153public:
155
157 void calculateDiagonal();
158
159 std::vector<V> getInitialBasis(int eigenVectorsCount);
160
161 V getCorrection(const complex eigenValue, V &residuum);
162};
163
164} // namespace sisi4s
165
166#undef _DEFINE_SETTER
167
168#endif
#define _DEFINE_SETTER(type, name, default)
Definition CcsdPreconditioner.hpp:4
#define __DEFINE_SETTER(type, name, default)
Definition CcsdPreconditioner.hpp:11
#define PTR(TYPE)
Definition SharedPointer.hpp:8
Definition CcsdPreconditioner.hpp:152
std::shared_ptr< V > diagonalH
Definition CcsdPreconditioner.hpp:156
std::vector< V > getInitialBasis(int eigenVectorsCount)
Definition CcsdPreconditioner.cxx:786
void calculateDiagonal()
Definition CcsdPreconditioner.cxx:721
V getCorrection(const complex eigenValue, V &residuum)
Definition CcsdPreconditioner.cxx:747
Implements the diagonal preconditionar for the davidson method.
Definition CcsdPreconditioner.hpp:54
Tensor< F > * Fab
Definition CcsdPreconditioner.hpp:67
~CcsdPreconditioner()
Definition CcsdPreconditioner.hpp:59
Tensor< F > * Fij
Definition CcsdPreconditioner.hpp:66
void calculateDiagonal()
Definition CcsdPreconditioner.cxx:87
CcsdPreconditioner & setRandom(bool t)
Definition CcsdPreconditioner.hpp:77
Tensor< F > * Vabcd
Definition CcsdPreconditioner.hpp:68
Tensor< F > * Vijkl
Definition CcsdPreconditioner.hpp:71
SFockVector< F > getCorrection(const complex eigenValue, SFockVector< F > &residuum)
Definition CcsdPreconditioner.cxx:314
std::shared_ptr< V > getDiagonal()
Definition CcsdPreconditioner.hpp:102
SDFockVector< F > V
Definition CcsdPreconditioner.hpp:56
Tensor< F > * Tai
Definition CcsdPreconditioner.hpp:64
std::vector< SDFockVector< F > > getInitialBasis(int eigenVectorsCount)
Get initial basis.
Definition CcsdPreconditioner.cxx:149
CcsdPreconditioner()
Definition CcsdPreconditioner.hpp:58
std::shared_ptr< SDFockVector< F > > diagonalH
Definition CcsdPreconditioner.hpp:107
Tensor< F > * Vijab
Definition CcsdPreconditioner.hpp:69
Tensor< F > * Viajb
Definition CcsdPreconditioner.hpp:70
CcsdPreconditioner & setRandomSigma(double t)
Definition CcsdPreconditioner.hpp:81
CcsdPreconditioner & setSpinFlip(bool t)
Definition CcsdPreconditioner.hpp:73
Tensor< F > * Tabij
Definition CcsdPreconditioner.hpp:65
Definition CcsdPreconditioner.hpp:139
std::vector< V > getInitialBasis(int eigenVectorsCount)
Definition CcsdPreconditioner.cxx:401
void calculateDiagonal()
Definition CcsdPreconditioner.cxx:374
V getCorrection(const complex eigenValue, V &residuum)
Definition CcsdPreconditioner.cxx:503
std::shared_ptr< V > diagonalH
Definition CcsdPreconditioner.hpp:142
Definition CcsdPreconditioner.hpp:126
std::vector< V > getInitialBasis(int eigenVectorsCount)
Definition CcsdPreconditioner.cxx:575
void calculateDiagonal()
Definition CcsdPreconditioner.cxx:546
V getCorrection(const complex eigenValue, V &residuum)
Definition CcsdPreconditioner.cxx:678
std::shared_ptr< V > diagonalH
Definition CcsdPreconditioner.hpp:129
Definition CcsdPreconditioner.hpp:27
virtual std::vector< V > getInitialBasis(int eigenVectorsCount)=0
virtual void calculateDiagonal()=0
Tensor< F > * Fab
Definition CcsdPreconditioner.hpp:41
Tensor< F > * Vabcd
Definition CcsdPreconditioner.hpp:42
virtual V getCorrection(const complex eigenValue, V &residuum)=0
Tensor< F > * Fij
Definition CcsdPreconditioner.hpp:40
Tensor< F > * Tai
Definition CcsdPreconditioner.hpp:38
Tensor< F > * Vijkl
Definition CcsdPreconditioner.hpp:45
Tensor< F > * Viajb
Definition CcsdPreconditioner.hpp:44
Tensor< F > * Vijab
Definition CcsdPreconditioner.hpp:43
Tensor< F > * Tabij
Definition CcsdPreconditioner.hpp:39
Definition FockVector.hpp:631
Definition FockVector.hpp:678
Definition FockVector.hpp:589
Definition Algorithm.hpp:10
CTF::Tensor< F > Tensor
Definition Tensor.hpp:9
Complex< real > complex
Definition Complex.hpp:17