Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Using zgeev and complex matrices

gatts
Beginner
665 Views

Well after a "rough landing" with dsyevr, I moved to zgeev, to get the eigenvalues and eigenvectors of a matrix, for this I use the following commands...

[cpp]
#include

//Input values for zgeev
char jobvl= 'V';
char jobvr= 'N';

int n = 500;
int n2 = 2*n;

int lda = n;

complex *H = new complex[lda*n];

int ldvl = n;
int ldvr = n;

int lwork = 2*n-1 ;

complex *work = new complex[lwork];

double *rwork = new double[n2];

//Output values of zgeev

double *wr = new double;
double *wi = new double;


complex *w = new complex;

complex *vl = new complex[ldvl*n];
complex *vr = new complex[ldvr*n];

zgeev(&jobvl, &jobvr, &n, H, &lda, w, vl, &ldvl, vr, &ldvr, work, &lwork, rwork, &info);
[/cpp]

But it was strange beacuse send me this error, when compiling with the instruction "icc file.cpp -lmkl_em64t -openmp "

error: argument of type "std::complex *" is incompatible with parameter of type "MKL_Complex16 *"
zgeev(&jobvl, &jobvr, &n, H, &lda, w, vl, &ldvl, vr, &ldvr, work, &lwork, rwork, &info);

For H, work, vl,vr, in summary all the arrays of the system, wich I was expecting to work smoothly... I don't know what's happening, "googled" the error but didn't find anything useful... so i wish to ask how to declare the matrix of the system...

thanks in advances...

0 Kudos
3 Replies
TimP
Honored Contributor III
665 Views

According to my understanding, C99 _Complex is supported by MKL, but not C++ std::complex. I couldn't see how you were using the MKL headers or how you invoked icpc.

0 Kudos
gatts
Beginner
665 Views
Quoting - tim18

According to my understanding, C99 _Complex is supported by MKL, but not C++ std::complex. I couldn't see how you were using the MKL headers or how you invoked icpc.

Sure, I didn't post that part of the program but is included... in the include section: #include

0 Kudos
Andrey_Bespalov
New Contributor I
665 Views

Some parameters of zgeev should be MKL_Complex* type. See below citations from the header files.

void zgeev( char *jobvl, char *jobvr, MKL_INT *n, MKL_Complex16 *a, MKL_INT *lda, MKL_Complex16 *w, MKL_Complex16 *vl, MKL_INT *ldvl, MKL_Complex16 *vr, MKL_INT *ldvr, MKL_Complex16 *work, MKL_INT *lwork, double *rwork, MKL_INT *info );

/* Complex type (double precision). */
#ifndef MKL_Complex16
typedef
struct _MKL_Complex16 {
double real;
double imag;
} MKL_Complex16;
#endif

0 Kudos
Reply