StatMech
Loading...
Searching...
No Matches
statmech.cpp File Reference

Functions

Integer_t EigenValues (std::vector< double > &Eigenvalue, Integer_t const dim, matrix< Complex_t< double > > &Hamiltonian)
 
double SpectralRange (double &OpMin, Integer_t const dim, matrix< Complex_t< double > > &Operator)
 
Integer_t Diagonalize (Integer_t const dim, matrix< Complex_t< double > > &Hamiltonian, std::vector< double > &Eigenvalue)
 
Integer_t EigenMatrixElements (std::vector< double > &Eigenvalue, Integer_t const dim, matrix< Complex_t< double > > &Hamiltonian, matrix< Complex_t< double > > &Operator, void *GPUconf)
 
Integer_t EigenExpValue (std::vector< double > &EXPvalue, std::vector< double > &Eigenvalue, Integer_t const dim, matrix< Complex_t< double > > &Hamiltonian, const matrix< Complex_t< double > > &Operator, void *GPUconf)
 
void DensityOfStates (std::vector< double > &res, std::vector< double > const &Position, std::vector< double > const &Eigenvalue, std::function< double(double)> Kernel)
 
void KernelAverage (std::vector< double > &res, std::vector< double > const &Position, std::vector< double > const &RawData, std::vector< double > const &Eigenvalue, std::function< double(double)> Kernel)
 
double MicroCanonicalAverage (Integer_t &NdataInShell, double const Energy, double const shellWidth, Integer_t const dim, std::vector< double > const &Eigenvalue, std::vector< double > const &EXPvalue, Integer_t const initId)
 
void MicroCanonicalAverage (std::vector< double > &MCAverage, std::vector< Integer_t > &NdataInShell, double const shellWidth, const std::vector< std::tuple< double, double > > Data)
 
void MicroCanonicalAverage (std::vector< double > &MCAverage, std::vector< Integer_t > &NdataInShell, double const shellWidth, const std::vector< std::tuple< double, double, Integer_t > > Data)
 
Integer_t MeasureOfETH (double &Fluc_2, double &Fluc_inf, double &MaxPos, double const Emin, double const Emax, Integer_t const dim, const std::vector< double > &eigenEnergy, const std::vector< double > &EXPvalue, const std::vector< double > &MCAverage)
 
std::tuple< double, double, double, Integer_tMeasureOfETH (double const Emin, double const Emax, Integer_t const dim, const std::vector< double > &eigenEnergy, const std::vector< double > &EXPvalue, const std::vector< double > &MCAverage)
 
template<class... Args>
Integer_t MeasureOfETH (double &Fluc_2, double &Fluc_inf, double &MaxPos, double const Emin, double const Emax, const std::vector< double > &MCAverage, const std::vector< std::tuple< double, double, Args... > > Data)
 
template Integer_t MeasureOfETH (double &Fluc_2, double &Fluc_inf, double &MaxPos, double const Emin, double const Emax, const std::vector< double > &MCAverage, const std::vector< std::tuple< double, double > > Data)
 
template Integer_t MeasureOfETH< Integer_t > (double &Fluc_2, double &Fluc_inf, double &MaxPos, double const Emin, double const Emax, const std::vector< double > &MCAverage, const std::vector< std::tuple< double, double, Integer_t > > Data)
 
void LevelSpacingRatio (std::vector< double > &result, double const Emin, double const Emax, Integer_t const dim, const std::vector< double > &eigenEnergy)
 
template<typename Type >
std::tuple< std::vector< double >, std::vector< double >, std::vector< double > > OverlapSqVsEnergy (Integer_t const NDIV, Integer_t const dim, std::vector< double > const &Energy1, std::vector< double > const &Energy2, matrix< Type > const &OverlapSq)
 
template std::tuple< std::vector< double >, std::vector< double >, std::vector< double > > OverlapSqVsEnergy (Integer_t const NDIV, Integer_t const dim, std::vector< double > const &Energy1, std::vector< double > const &EnergyRange2, matrix< double > const &OverlapSq)
 
template std::tuple< std::vector< double >, std::vector< double >, std::vector< double > > OverlapSqVsEnergy (Integer_t const NDIV, Integer_t const dim, std::vector< double > const &Energy1, std::vector< double > const &EnergyRange2, matrix< Complex_t< float > > const &OverlapSq)
 
template std::tuple< std::vector< double >, std::vector< double >, std::vector< double > > OverlapSqVsEnergy (Integer_t const NDIV, Integer_t const dim, std::vector< double > const &Energy1, std::vector< double > const &EnergyRange2, matrix< Complex_t< double > > const &OverlapSq)
 

Function Documentation

◆ DensityOfStates()

void DensityOfStates ( std::vector< double > &  res,
std::vector< double > const &  Position,
std::vector< double > const &  Eigenvalue,
std::function< double(double)>  Kernel 
)
139 {
140 res.resize(Position.size());
141 std::fill(res.begin(), res.end(), 0.0);
142 for(size_t j = 0; j < Position.size(); ++j) {
143 for(size_t alpha = 0; alpha < Eigenvalue.size(); ++alpha)
144 res[j] += Kernel(Position[alpha] - Eigenvalue[alpha]);
145 }
146}

◆ Diagonalize()

Integer_t Diagonalize ( Integer_t const  dim,
matrix< Complex_t< double > > &  Hamiltonian,
std::vector< double > &  Eigenvalue 
)
57 {
58 debug_print("# " << __func__ << "(CPU)");
59 //********** Variables for LAPACK and BLASS **********//
60 Integer_t DIM = dim, LD = Hamiltonian.LD();
61 std::vector<Complex_t<double>> work(1);
62 std::vector<double> rwork(1);
63 std::vector<Integer_t> iwork(1);
64 Integer_t lwork = -1, lrwork = -1, liwork = -1;
65 char JOBS = 'V', UPLO = 'U';
66 Integer_t info;
67 //********** (END)Variables for LAPACK and BLASS **********//
68 //********** Query for work space sizes (lwork, lrwork, liwork) **********//
69 zheevd_(&JOBS, &UPLO, &DIM, &*Hamiltonian.begin(), &LD, nullptr, &*work.begin(), &lwork,
70 &*rwork.begin(), &lrwork, &liwork, &liwork, &info);
71 lwork = (Integer_t)real(work[0]);
72 lrwork = (Integer_t)rwork[0];
73 //********** (END)Query for work space sizes (lwork, lrwork, liwork) **********//
74 //********** Allocation **********//
75 work.resize(lwork);
76 rwork.resize(lrwork);
77 iwork.resize(liwork);
78 //********** (END)Allocation **********//
79 zheevd_(&JOBS, &UPLO, &DIM, &*Hamiltonian.begin(), &LD, &*Eigenvalue.begin(), &*work.begin(),
80 &lwork, &*rwork.begin(), &lrwork, &*iwork.begin(), &liwork, &info);
81 if(info != 0) std::cerr << "Error: LAPACK::zheevd failed." << std::endl;
82 return info;
83}
debug_print("# Determining GPU configuration.")
MKL_INT Integer_t
Definition mytypes.hpp:359

◆ EigenExpValue()

Integer_t EigenExpValue ( std::vector< double > &  EXPvalue,
std::vector< double > &  Eigenvalue,
Integer_t const  dim,
matrix< Complex_t< double > > &  Hamiltonian,
const matrix< Complex_t< double > > &  Operator,
void *  GPUconf 
)
122 {
123 debug_print("# " << __func__ << "(CPU)");
124 Integer_t info = Diagonalize(dim, Hamiltonian, Eigenvalue);
125 if(info != 0) std::exit(EX_SOFTWARE);
126
127 Integer_t LD = Hamiltonian.LD();
128 std::vector<Complex_t<double>> intermediate(dim);
129 for(Integer_t i = 0; i < dim; ++i) {
130 EXPvalue[i] = QuantumExpValue_he(dim, Hamiltonian.begin() + LD * i, Operator, intermediate);
131 }
132 return info;
133}
Integer_t Diagonalize(Integer_t const dim, matrix< Complex_t< double > > &Hamiltonian, std::vector< double > &Eigenvalue)
Definition statmech.cpp:56

◆ EigenMatrixElements()

Integer_t EigenMatrixElements ( std::vector< double > &  Eigenvalue,
Integer_t const  dim,
matrix< Complex_t< double > > &  Hamiltonian,
matrix< Complex_t< double > > &  Operator,
void *  GPUconf 
)
91 {
92 debug_print("# " << __func__ << "(CPU)");
93 Eigenvalue.resize(dim);
94 std::fill(Eigenvalue.begin(), Eigenvalue.end(), 0);
95 Integer_t info = Diagonalize(dim, Hamiltonian, Eigenvalue);
96 if(info != 0) std::exit(info);
97
98 //********** Variables for BLAS
99 Integer_t DIM = dim;
100 Integer_t HmLD = Hamiltonian.LD();
101 Integer_t OpLD = Operator.LD();
102 char sideL = 'L', uploU = 'U';
103 char ntrans = 'N', ctrans = 'C';
104 Complex_t<double> alpha = DoubleComplexOne, beta = DoubleComplexZero;
105 matrix<Complex_t<double>> intermediate(dim, dim);
106 //********** (END) Variables for BLAS
107
108 zhemm_(&sideL, &uploU, &DIM, &DIM, &alpha, &*Operator.begin(), &OpLD, &*Hamiltonian.begin(),
109 &HmLD, &beta, &*intermediate.begin(), &DIM);
110 zgemm_(&ctrans, &ntrans, &DIM, &DIM, &DIM, &alpha, &*Hamiltonian.begin(), &HmLD,
111 &*intermediate.begin(), &DIM, &beta, &*Operator.begin(), &OpLD);
112 return info;
113}
Definition mytypes.hpp:147
void zgemm_(char *TRANSA, char *TRANSB, int *M, int *N, int *K, double complex *ALPHA, double complex *A, int *LDA, double complex *B, int *LDB, double complex *BETA, double complex *C, int *LDC)

◆ EigenValues()

Integer_t EigenValues ( std::vector< double > &  Eigenvalue,
Integer_t const  dim,
matrix< Complex_t< double > > &  Hamiltonian 
)
20 {
21 debug_print("# " << __func__ << "(CPU)");
22 Eigenvalue.resize(dim);
23 //********** Variables for LAPACK and BLASS **********//
24 Integer_t DIM = dim, LD = Hamiltonian.LD();
25 std::vector<Complex_t<double>> work(1);
26 std::vector<double> rwork(1);
27 std::vector<Integer_t> iwork(1);
28 Integer_t lwork = -1, lrwork = -1, liwork = -1;
29 char JOBS = 'N', UPLO = 'U';
30 Integer_t info;
31 //********** (END)Variables for LAPACK and BLASS **********//
32 //********** Query for work space sizes (lwork, lrwork, liwork) **********//
33 zheevd_(&JOBS, &UPLO, &DIM, &*Hamiltonian.begin(), &LD, nullptr, &*work.begin(), &lwork,
34 &*rwork.begin(), &lrwork, &liwork, &liwork, &info);
35 lwork = (Integer_t)real(work[0]);
36 lrwork = (Integer_t)rwork[0];
37 //********** (END)Query for work space sizes (lwork, lrwork, liwork) **********//
38 //********** Allocation **********//
39 work.resize(lwork);
40 rwork.resize(lrwork);
41 iwork.resize(liwork);
42 //********** (END)Allocation **********//
43 zheevd_(&JOBS, &UPLO, &DIM, &*Hamiltonian.begin(), &LD, &*Eigenvalue.begin(), &*work.begin(),
44 &lwork, &*rwork.begin(), &lrwork, &*iwork.begin(), &liwork, &info);
45 if(info != 0) std::cerr << "Error: LAPACK::zheevd failed." << std::endl;
46 return info;
47}

◆ KernelAverage()

void KernelAverage ( std::vector< double > &  res,
std::vector< double > const &  Position,
std::vector< double > const &  RawData,
std::vector< double > const &  Eigenvalue,
std::function< double(double)>  Kernel 
)
150 {
151 res.resize(Position.size());
152 std::fill(res.begin(), res.end(), 0.0);
153 for(size_t j = 0; j < Position.size(); ++j) {
154 for(size_t alpha = 0; alpha < Eigenvalue.size(); ++alpha)
155 res[j] += RawData.at(alpha) * Kernel(Position[alpha] - Eigenvalue[alpha]);
156 }
157}

◆ LevelSpacingRatio()

void LevelSpacingRatio ( std::vector< double > &  result,
double const  Emin,
double const  Emax,
Integer_t const  dim,
const std::vector< double > &  eigenEnergy 
)
329 {
330 Integer_t idMin, idMax;
331 for(idMin = 0; eigenEnergy[idMin] < Emin && idMin < dim; ++idMin) {};
332 for(idMax = dim - 1; eigenEnergy[idMax] > Emax && idMax >= 0; --idMax) {};
333 Integer_t Ndata = idMax - idMin + 1;
334 double s;
335 std::fill(result.begin(), result.end(), 0);
336 if(Ndata < 2) return;
337 result.resize(Ndata - 2);
338 for(Integer_t j = 0; j < Ndata - 2; ++j) {
339 s = (eigenEnergy[idMin + j + 2] - eigenEnergy[idMin + j + 1])
340 / (eigenEnergy[idMin + j + 1] - eigenEnergy[idMin + j]);
341 if(s > 1) result[j] = 1.0 / s;
342 else result[j] = s;
343 }
344}
constexpr double Emin
Definition setVariablesForMCAverage.cpp:4
constexpr double Emax
Definition setVariablesForMCAverage.cpp:5

◆ MeasureOfETH() [1/4]

template Integer_t MeasureOfETH ( double &  Fluc_2,
double &  Fluc_inf,
double &  MaxPos,
double const  Emin,
double const  Emax,
const std::vector< double > &  MCAverage,
const std::vector< std::tuple< double, double > >  Data 
)

◆ MeasureOfETH() [2/4]

template<class... Args>
Integer_t MeasureOfETH ( double &  Fluc_2,
double &  Fluc_inf,
double &  MaxPos,
double const  Emin,
double const  Emax,
const std::vector< double > &  MCAverage,
const std::vector< std::tuple< double, double, Args... > >  Data 
)
282 {
283 Integer_t Ndata = 0, dim = Data.size();
284 double fluc;
285 Fluc_2 = 0;
286 Fluc_inf = 0;
287 MaxPos = 0;
288 for(Integer_t i = 0; i < dim && std::get<0>(Data[i]) <= Emax; ++i) {
289 if(std::get<0>(Data[i]) < Emin) continue;
290 fluc = std::get<1>(Data[i]) - MCAverage[i];
291 if(isnan(fluc)) continue;
292 Fluc_2 += fluc * fluc;
293 Ndata += 1;
294 if(fabs(fluc) > Fluc_inf) {
295 Fluc_inf = fabs(fluc);
296 MaxPos = std::get<0>(Data[i]);
297 }
298 }
299 Fluc_2 = sqrt(Fluc_2 / (double)(Ndata - 1));
300 return Ndata;
301}

◆ MeasureOfETH() [3/4]

Integer_t MeasureOfETH ( double &  Fluc_2,
double &  Fluc_inf,
double &  MaxPos,
double const  Emin,
double const  Emax,
Integer_t const  dim,
const std::vector< double > &  eigenEnergy,
const std::vector< double > &  EXPvalue,
const std::vector< double > &  MCAverage 
)
247 {
248 Integer_t Ndata = 0;
249 double fluc;
250 Fluc_2 = 0;
251 Fluc_inf = 0;
252 MaxPos = 0;
253 for(Integer_t i = 0; i < dim && eigenEnergy[i] <= Emax; ++i) {
254 if(eigenEnergy[i] < Emin) continue;
255 fluc = EXPvalue[i] - MCAverage[i];
256 if(isnan(fluc)) continue;
257 Fluc_2 += fluc * fluc;
258 Ndata += 1;
259 if(fabs(fluc) > Fluc_inf) {
260 Fluc_inf = fabs(fluc);
261 MaxPos = eigenEnergy[i];
262 }
263 }
264 Fluc_2 = sqrt(Fluc_2 / (double)(Ndata - 1));
265 return Ndata;
266}

◆ MeasureOfETH() [4/4]

std::tuple< double, double, double, Integer_t > MeasureOfETH ( double const  Emin,
double const  Emax,
Integer_t const  dim,
const std::vector< double > &  eigenEnergy,
const std::vector< double > &  EXPvalue,
const std::vector< double > &  MCAverage 
)
272 {
273 double Fluc_2, Fluc_inf, MaxPos;
274 Integer_t Ndata
275 = MeasureOfETH(Fluc_2, Fluc_inf, MaxPos, Emin, Emax, dim, eigenEnergy, EXPvalue, MCAverage);
276 return {Fluc_2, Fluc_inf, MaxPos, Ndata};
277}
Integer_t MeasureOfETH(double &Fluc_2, double &Fluc_inf, double &MaxPos, double const Emin, double const Emax, Integer_t const dim, const std::vector< double > &eigenEnergy, const std::vector< double > &EXPvalue, const std::vector< double > &MCAverage)
Definition statmech.cpp:244

◆ MeasureOfETH< Integer_t >()

template Integer_t MeasureOfETH< Integer_t > ( double &  Fluc_2,
double &  Fluc_inf,
double &  MaxPos,
double const  Emin,
double const  Emax,
const std::vector< double > &  MCAverage,
const std::vector< std::tuple< double, double, Integer_t > >  Data 
)

◆ MicroCanonicalAverage() [1/3]

double MicroCanonicalAverage ( Integer_t NdataInShell,
double const  Energy,
double const  shellWidth,
Integer_t const  dim,
std::vector< double > const &  Eigenvalue,
std::vector< double > const &  EXPvalue,
Integer_t const  initId 
)
161 {
162 Integer_t idMin, idMax;
163 for(idMin = initId; Eigenvalue[idMin] < Energy - shellWidth && idMin >= 0; ++idMin) {};
164 for(; Eigenvalue[idMin] >= Energy - shellWidth && idMin >= 0; --idMin) {};
165 ++idMin;
166 for(idMax = idMin; Eigenvalue[idMax] <= Energy + shellWidth && idMax < dim; ++idMax) {};
167 --idMax;
168 double MCAverage = 0;
169 NdataInShell = 0;
170 if(dim < idMax) {
171 std::cout << "idMin = " << idMin << ", idMax = " << idMax << ", dim = " << dim << std::endl;
172 }
173 for(Integer_t j = idMin; j <= idMax; ++j) {
174 if(isnan(EXPvalue[j])) continue;
175 MCAverage += EXPvalue[j];
176 NdataInShell += 1;
177 }
178 MCAverage /= (double)NdataInShell;
179 return MCAverage;
180}

◆ MicroCanonicalAverage() [2/3]

void MicroCanonicalAverage ( std::vector< double > &  MCAverage,
std::vector< Integer_t > &  NdataInShell,
double const  shellWidth,
const std::vector< std::tuple< double, double > >  Data 
)
184 {
185 Integer_t const dim = Data.size();
186 double shellEnergy;
187 //******************** Initialization ********************
188 MCAverage.resize(dim);
189 std::fill(MCAverage.begin(), MCAverage.end(), 0);
190 NdataInShell.resize(dim);
191 std::fill(NdataInShell.begin(), NdataInShell.end(), 0);
192 //******************** (END)Initialization ********************
193 Integer_t Ndata, idMin, idMax;
194 for(Integer_t i = 0; i < dim; ++i) {
195 shellEnergy = std::get<0>(Data[i]);
196 for(idMin = i; std::get<0>(Data[idMin]) >= shellEnergy - shellWidth && idMin >= 0;
197 --idMin) {};
198 ++idMin;
199 for(idMax = i; std::get<0>(Data[idMax]) <= shellEnergy + shellWidth && idMax < dim;
200 ++idMax) {};
201 --idMax;
202 Ndata = 0;
203 for(Integer_t j = idMin; j <= idMax; ++j) {
204 if(isnan(std::get<1>(Data[j]))) continue;
205 MCAverage[i] += std::get<1>(Data[j]);
206 Ndata += 1;
207 }
208 NdataInShell[i] = Ndata;
209 MCAverage[i] /= (double)Ndata;
210 }
211}

◆ MicroCanonicalAverage() [3/3]

void MicroCanonicalAverage ( std::vector< double > &  MCAverage,
std::vector< Integer_t > &  NdataInShell,
double const  shellWidth,
const std::vector< std::tuple< double, double, Integer_t > >  Data 
)
215 {
216 Integer_t const dim = Data.size();
217 double shellEnergy;
218 //******************** Initialization ********************
219 MCAverage.resize(dim);
220 std::fill(MCAverage.begin(), MCAverage.end(), 0);
221 NdataInShell.resize(dim);
222 std::fill(NdataInShell.begin(), NdataInShell.end(), 0);
223 //******************** (END)Initialization ********************
224 Integer_t Ndata, idMin, idMax;
225 for(Integer_t i = 0; i < dim; ++i) {
226 shellEnergy = std::get<0>(Data[i]);
227 for(idMin = i; std::get<0>(Data[idMin]) >= shellEnergy - shellWidth && idMin >= 0;
228 --idMin) {};
229 ++idMin;
230 for(idMax = i; std::get<0>(Data[idMax]) <= shellEnergy + shellWidth && idMax < dim;
231 ++idMax) {};
232 --idMax;
233 Ndata = 0;
234 for(Integer_t j = idMin; j <= idMax; ++j) {
235 if(isnan(std::get<1>(Data[j]))) continue;
236 MCAverage[i] += std::get<1>(Data[j]) * std::get<2>(Data[j]);
237 Ndata += std::get<2>(Data[j]);
238 }
239 NdataInShell[i] = Ndata;
240 MCAverage[i] /= (double)Ndata;
241 }
242}

◆ OverlapSqVsEnergy() [1/4]

template<typename Type >
std::tuple< std::vector< double >, std::vector< double >, std::vector< double > > OverlapSqVsEnergy ( Integer_t const  NDIV,
Integer_t const  dim,
std::vector< double > const &  Energy1,
std::vector< double > const &  Energy2,
matrix< Type > const &  OverlapSq 
)
349 { // Calculate Energy dependence of overlaps
350 debug_print("# " << __func__);
351 double const Emin1 = *std::min_element(Energy1.begin(), Energy1.end());
352 double const Emax1 = *std::max_element(Energy1.begin(), Energy1.end());
353 double const Emin2 = *std::min_element(Energy2.begin(), Energy2.end());
354 double const Emax2 = *std::max_element(Energy2.begin(), Energy2.end());
355 double const EnergyRange1 = Emax1 - Emin1;
356 double const EnergyRange2 = Emax2 - Emin2;
357 debug_print("Emax1=" << Emax1 << ", Emax2=" << Emax2 << ", NDIV=" << NDIV
358 << ", EnergyRange1=" << EnergyRange1 << ", EnergyRange2=" << EnergyRange2);
359 auto Bin1 = [&](double x) {
360 return (x == Emax1 ? NDIV - 1 : (Integer_t)(NDIV * (x - Emin1) / EnergyRange1));
361 };
362 auto Bin2 = [&](double x) {
363 return (x == Emax2 ? NDIV - 1 : (Integer_t)(NDIV * (x - Emin2) / EnergyRange2));
364 };
365
366 std::vector<std::vector<Integer_t>> binElem1(NDIV);
367 std::vector<std::vector<Integer_t>> binElem2(NDIV);
368 for(size_t j = 0; j < dim; ++j) {
369 binElem1.at(Bin1(Energy1[j])).push_back(j);
370 binElem2.at(Bin2(Energy2[j])).push_back(j);
371 }
372 double norm, meanNorm, prob, probOld, dtemp;
373
374 std::vector<double> mean(NDIV, 0), sigma(NDIV, 0), DOS(NDIV);
375 std::vector<double> aveOverlapSq(NDIV);
376#pragma omp parallel for
377 for(size_t bin1 = 0; bin1 < NDIV; ++bin1)
378 DOS[bin1] = binElem2[bin1].size() * NDIV / (double)dim;
379 for(size_t bin1 = 0; bin1 < NDIV; ++bin1) {
380 if(binElem2[bin1].size() == 0) {
381 mean[bin1] = sigma[bin1] = NAN;
382 continue;
383 }
384 std::fill(aveOverlapSq.begin(), aveOverlapSq.end(), 0.0);
385 norm = 0;
386 for(size_t bin0 = 0; bin0 < NDIV; ++bin0) {
387 if(binElem1[bin0].size() == 0) continue;
388 for(const auto& j: binElem2[bin1])
389 for(const auto& i: binElem1[bin0]) {
390 aveOverlapSq[bin0] += real(OverlapSq.at(i, j));
391 }
392 if(binElem2[bin1].size() * binElem1[bin0].size() != 0) {
393 aveOverlapSq[bin0] /= binElem2[bin1].size() * binElem1[bin0].size();
394 norm += aveOverlapSq[bin0];
395 }
396 }
397 prob = 0;
398 meanNorm = 0;
399 for(size_t bin0 = 0; bin0 < NDIV; ++bin0) {
400 if(binElem1[bin0].size() == 0) continue;
401 probOld = prob;
402 dtemp = aveOverlapSq[bin0] / norm;
403 prob += dtemp;
404 if(0.5 - 0.12 <= prob && prob <= 0.5 + 0.12) {
405 meanNorm += dtemp;
406 mean[bin1] += dtemp * bin0 / (double)NDIV;
407 }
408 else if(probOld < 0.5 - 0.12 && 0.5 + 0.12 < prob) { mean[bin1] = bin0 / (double)NDIV; }
409 if(prob > 0.25 && probOld < 0.25) sigma[bin1] = bin0 / (double)NDIV;
410 if(prob > 0.75 && probOld < 0.75)
411 sigma[bin1] = std::fmax(((bin0 - 0.5) / (double)NDIV - sigma[bin1]) / 2.0, 0.0);
412 if(probOld < 0.25 && 0.75 < prob) sigma[bin1] = -1.0 / (double)NDIV;
413 }
414 if(meanNorm > 0) mean[bin1] /= meanNorm;
415 if(isnan(mean[bin1])) sigma[bin1] = NAN;
416 }
417
418 return {mean, sigma, DOS};
419}
for(Integer_t n=n_min;n<=n_max;++n)
Definition MeasureOfETH_CreateOutputFiles.cpp:4
__constant__ int size
Definition testEigenOnGPU.cu:4

◆ OverlapSqVsEnergy() [2/4]

template std::tuple< std::vector< double >, std::vector< double >, std::vector< double > > OverlapSqVsEnergy ( Integer_t const  NDIV,
Integer_t const  dim,
std::vector< double > const &  Energy1,
std::vector< double > const &  EnergyRange2,
matrix< Complex_t< double > > const &  OverlapSq 
)

◆ OverlapSqVsEnergy() [3/4]

template std::tuple< std::vector< double >, std::vector< double >, std::vector< double > > OverlapSqVsEnergy ( Integer_t const  NDIV,
Integer_t const  dim,
std::vector< double > const &  Energy1,
std::vector< double > const &  EnergyRange2,
matrix< Complex_t< float > > const &  OverlapSq 
)

◆ OverlapSqVsEnergy() [4/4]

template std::tuple< std::vector< double >, std::vector< double >, std::vector< double > > OverlapSqVsEnergy ( Integer_t const  NDIV,
Integer_t const  dim,
std::vector< double > const &  Energy1,
std::vector< double > const &  EnergyRange2,
matrix< double > const &  OverlapSq 
)

◆ SpectralRange()

double SpectralRange ( double &  OpMin,
Integer_t const  dim,
matrix< Complex_t< double > > &  Operator 
)
49 {
50 std::vector<double> Eigenvalue(dim);
51 EigenValues(Eigenvalue, dim, Operator);
52 OpMin = Eigenvalue[0];
53 return Eigenvalue[dim - 1] - Eigenvalue[0];
54}
Integer_t EigenValues(std::vector< double > &Eigenvalue, Integer_t const dim, matrix< Complex_t< double > > &Hamiltonian)
Definition statmech.cpp:19