Search code examples
c++castingstllapackaccelerate-framework

Use std::complex in complex LAPACK routines


I would like to be able to call my Lapack functions from my C++-program with std::complex<double>-data types. I realize that the complex data type in clapack is declared (at least on my Mac in the <Accelerate>-Framework as

typedef struct { __CLPK_real r, i; } __CLPK_complex;

but I cannot come up with a way to use/cast the std::complex variables so that they can be processed by lapack. Thanks!


Solution

  • Turns out that __CLPK_doublecomplexcorresponds to std::complex<double>, so I can cast the STL-type to the <accelerate> (i.e. Lapack) data-type.