I am writing a program, which uses routines from the linear algebra package LAPACK. I am calling one of the complex functions (namely zgeev), which needs a pointer to an array of complex values. According to LAPACK documentation the data type should be an array of Complex*16. I am using complex<double> and call zgeev with this array. When compiling, I get
error: cannot convert ‘std::complex<double>*’ to ‘__complex__ double*’ for argument ‘5’ to ‘int LAPACKE_zgeev(int, char, char, int, __complex__ double*, int, __complex__ double*, __complex__ double*, int, __complex__ double*, int)’
My question is: how can I recast the complex<double> to a __complex__ double*?
C++ guarantees that an array of std::complex<double> can be reinterpreted as an array of double, with reals at positions 0,2,4,... and imags at positions 1,3,5,...
C guarantees the same for an array of double complex (which your gcc, I am guessing, is displaying as "__complex__ double ")