mpimd-csc / flexiblas

FlexiBLAS - A BLAS and LAPACK wrapper library with runtime exchangeable backends. This is only a mirror of https://gitlab.mpi-magdeburg.mpg.de/software/flexiblas-release
https://www.mpi-magdeburg.mpg.de/projects/flexiblas
GNU Lesser General Public License v3.0
36 stars 7 forks source link

Interoperability of complex types used in LAPACK and (GNU/Intel) BLAS headers with C++ code #58

Open julianh-siemens opened 1 month ago

julianh-siemens commented 1 month ago

The LAPACK and (GNU/Intel) BLAS headers in FlexiBLAS use the complex data types in the C style, like "float/double complex". When using these headers in C++ code this can lead to issues since the C++ \<complex> header undefines the complex macro:

// Get rid of a macro possibly defined in <complex.h>
#undef complex

The reference LAPACK implementation works around this issue by including different headers depending on which language is used and then defines its own lapack_complex_float and lapack_complex_double types https://github.com/Reference-LAPACK/lapack/blob/master/LAPACKE/include/lapack.h#L43-L77