-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpath_eigen.cpp
More file actions
30 lines (26 loc) · 891 Bytes
/
path_eigen.cpp
File metadata and controls
30 lines (26 loc) · 891 Bytes
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
/*
* path_eigen.cpp
*
* Created on: 29 Sep 2016
* Author: ladislav
*/
// This function is separate in hopes that it won't need to be recompiled that often
#include "path.h"
// Not included in the header, just used for sorting
bool descending(double dFirst, double dSecond)
{
return dFirst > dSecond;
}
void Path::calculateSpectralGap()
{
//logPathEnergies();
populatekMatrix();
Eigen::EigenSolver<Eigen::MatrixXd> Solver(m_kMatrix, false); // False since we do not need eigenvectors
m_vdEigenvalues.clear();
for (unsigned int nCount = 0; nCount < m_vnSnapshots.size(); ++nCount)
// Use only real part, imaginary should be zero but not checking
m_vdEigenvalues.push_back(Solver.eigenvalues()[nCount].real());
std::sort(m_vdEigenvalues.begin(), m_vdEigenvalues.end(), descending);
//writeDataFile("eigenvalues.dat", m_vdEigenvalues);
determineSpectralGap();
}