25 #include "matrixlapack.hpp" 39 extern int dsyevd_(
char *jobz,
char *uplo,
int *n,
double *a,
int *lda,
double *w,
double *work,
int *lwork,
int *iwork,
int *liwork,
int *info);
40 extern int zheevd_(
char *jobz,
char *uplo,
int *n, std::complex<double> *a,
int *lda,
double *w, std::complex<double> *work,
int *lwork,
double *rwork,
int *iwork,
int *liwork,
int *info);
42 extern int zheev_(
char *jobz,
char *uplo,
int *n, std::complex<double> *a,
int *lda,
double *w, std::complex<double> *work,
int *lwork,
double *rwork,
int *info);
45 extern int dsyevx_(
char *jobz,
char *range,
char *uplo,
int *n,
double *a,
int *lda,
double *vl,
double *vu,
46 int *il,
int *iu,
double *abstol,
int *m,
double *w,
double *z__,
int *ldz,
47 double *work,
int *lwork,
int *iwork,
int *ifail,
int *info);
63 int ZHEEVall(
int xNsize, std::complex<double> **A,
double *r, std::complex<double> **vec) {
67 int n, lda, lwork, info, lrwork;
70 std::complex<double> *a, *work;
73 liwork = 5 * xNsize + 3;
74 iwork = (
int*)malloc(liwork *
sizeof(
double));
79 lwork = xNsize * xNsize + 2 * xNsize;
80 lrwork = 2 * xNsize*xNsize + 5 * xNsize + 1;
86 a = (std::complex<double>*)malloc(xNsize*xNsize *
sizeof(std::complex<double>));
87 w = (
double*)malloc(xNsize *
sizeof(
double));
88 work = (std::complex<double>*)malloc(lwork *
sizeof(std::complex<double>));
89 rwork = (
double*)malloc(lrwork *
sizeof(
double));
92 for (j = 0; j < xNsize; j++) {
93 for (i = 0; i < xNsize; i++) {
103 int zheevd_(
char *jobz,
char *uplo,
int *n, std::complex<double> *a,
int *lda,
double *w, std::complex<double> *work,
int *lwork,
double *rwork,
int *iwork,
int *liwork,
int *info);
106 zheev_(&jobz, &uplo, &n, a, &lda, w, work, &lwork, rwork, &info);
118 for (i = 0; i < xNsize; i++) {
119 for (j = 0; j < xNsize; j++) {
126 for (k = 0; k < xNsize; k++) {
int ZHEEVall(int xNsize, std::complex< double > **A, double *r, std::complex< double > **vec)
obtain eigenvalues and eigenvectors of Hermite matrix A
int zheev_(char *jobz, char *uplo, int *n, std::complex< double > *a, int *lda, double *w, std::complex< double > *work, int *lwork, double *rwork, int *info)
int dsyevx_(char *jobz, char *range, char *uplo, int *n, double *a, int *lda, double *vl, double *vu, int *il, int *iu, double *abstol, int *m, double *w, double *z__, int *ldz, double *work, int *lwork, int *iwork, int *ifail, int *info)
void zheevd_(char *jobz, char *uplo, int *n, std::complex< double > *a, int *lda, double *w, std::complex< double > *work, int *lwork, double *rwork, int *lrwork, int *iwork, int *liwork, int *info)