- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am currently trying to solve the eigenproblem Av = λv where A is a complex hermitian matrix using the MKL feast implementation. For testing purposes I constructed the following example (using C++):
#include <mkl.h>
#include <iostream>
#include <vector>
#include <complex>
int main() {
using namespace std;
int fpm[128]{ };
::feastinit(fpm);
/* A =
0 2-i 1
2+i 0 0
1 0 0
*/
vector<complex<double>> entries = { complex<double>(2, -1), 1, complex<double>(2, +1), 1 };
vector<int> cols = { 2, 3, 1, 1 };
vector<int> rows = { 1, 3, 4, 5 };
char uplo = 'F';
double eps = 0;
int loop = 0;
double emin = -4;
double emax = 4;
int m0 = 3;
vector<complex<double>> eigenvectors(m0 * m0);
vector<double> eigenvalues(m0);
vector<double> res(m0);
int mode = 0;
int info = 0;
zfeast_hcsrev(&uplo, &m0, reinterpret_cast<MKL_Complex16*>(&entries[0]), &rows[0], &cols[0],
fpm, &eps, &loop, &emin, &emax, &m0, &eigenvalues[0], reinterpret_cast<MKL_Complex16*>(&eigenvectors[0]), &mode, &res[0], &info);
}
The eigenvalues of the matrix are 0 and ±square root 6 ≈ ±2.44948.
MKL produces this exact eigenvalues. However, the eigenvectos are strange. For example, the corresponding eigenvector for +sqrt(6) is (already normalized):
1/sqrt(2), 1/sqrt(2) + i/(2*sqrt(3)), 1/(2*sqrt(3))
or alternatively
0.707106, 0.577350 + i*0.28867, 0.28867
However, MKL produces:
0.48890728596802574+i*0.51085190195141617
0.19063671173166902+i*0.61670439499553087
0.19959556369177356+i*0.20855441565187854
What's the matter with these? What am I doing wrong?
Thank you.
Link Copied
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page