I have tried using LAPACK + BLAS + Eigen following the instructions https://eigen.tuxfamily.org/dox/TopicUsingBlasLapack.html . However, when I define EIGEN_USE_BLAS and EIGEN_USE_LAPACKE and have the following order in the first header file: #include <boost/thread/barrier.hpp> #include <Eigen/Dense> the following compilation error appears: In file included from /usr/include/c++/7/complex.h:36:0, from /usr/local/include/Eigen/src/misc/lapacke.h:79, from /usr/local/include/Eigen/LU:34, from /usr/local/include/Eigen/Dense:2, from xxx.h:4, from xxx.cpp:5: /usr/local/include/boost/type_traits/integral_constant.hpp:34:20: error: expected identifier before ‘(’ token template <class I, I val> struct integral_c; ^ /usr/local/include/boost/type_traits/integral_constant.hpp:34:20: error: expected ‘)’ before ‘__extension__’ template <class I, I val> struct integral_c; ^ /usr/local/include/boost/type_traits/integral_constant.hpp:34:20: error: expected ‘>’ before ‘__extension__’ /usr/local/include/boost/type_traits/integral_constant.hpp:34:20: error: expected unqualified-id before ‘)’ token template <class I, I val> struct integral_c; I tracked the origin of this compiler error and it is from #include <complex.h> that defines I. (https://en.wikibooks.org/wiki/C_Programming/complex.h) I successfully circumvent the problem by adding #undef I after #include<Eigen/Dense>, but you should solve this problem for future releases of Eigen.
This seems to be rather a problem with `complex.h` and boost. AFAIK, Eigen itself completely avoids using `I` as an identifier. OTOH, we probably don't break much, if we `#undef I`. Another (probably better) approach could be to add this before including lapacke.h (thus avoiding to include "complex.h"): #ifndef lapack_complex_float #define lapack_complex_float std::complex<float> #endif #ifndef lapack_complex_double #define lapack_complex_double std::complex<double> #endif
Defining lapack_complex_* seems to be fine, at leat for my setup.
Can we just modify lapacke.h? (It looks like something auto-generated by MKL) Otherwise, we need to wrap this by another small header.
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1720.