10 #ifndef EIGEN_LAPACKE_HELPERS_H
11 #define EIGEN_LAPACKE_HELPERS_H
16 #include "mkl_lapacke.h"
27 namespace lapacke_helpers {
34 template<
typename Scalar>
35 struct translate_type_imp;
37 struct translate_type_imp<float> {
41 struct translate_type_imp<double> {
45 struct translate_type_imp<
std::complex<double>> {
49 struct translate_type_imp<
std::complex<float>> {
54 template<
typename Scalar>
55 using translated_type =
typename translate_type_imp<Scalar>::type;
59 template<
typename Source,
typename Target=translated_type<Source>>
64 template<
typename Source,
typename Target=translated_type<Source>>
70 return convert_index<lapack_int>(index);
74 template<
typename Derived>
93 template<
typename DoubleFn,
typename SingleFn,
typename DoubleCpxFn,
typename SingleCpxFn>
94 struct WrappingHelper {
98 DoubleFn double_; SingleFn single_; DoubleCpxFn double_cpx_; SingleCpxFn single_cpx_;
100 template<
typename... Args>
101 auto call(Args&&... args) -> decltype(double_(std::forward<Args>(args)...)) {
102 return double_(std::forward<Args>(args)...);
105 template<
typename... Args>
106 auto call(Args&&... args) -> decltype(single_(std::forward<Args>(args)...)){
107 return single_(std::forward<Args>(args)...);
110 template<
typename... Args>
111 auto call(Args&&... args) -> decltype(double_cpx_(std::forward<Args>(args)...)){
112 return double_cpx_(std::forward<Args>(args)...);
115 template<
typename... Args>
116 auto call(Args&&... args) -> decltype(single_cpx_(std::forward<Args>(args)...)){
117 return single_cpx_(std::forward<Args>(args)...);
125 template<
typename DoubleFn,
typename SingleFn,
typename DoubleCpxFn,
typename SingleCpxFn,
typename... Args>
126 EIGEN_ALWAYS_INLINE auto call_wrapper(DoubleFn df, SingleFn sf, DoubleCpxFn dcf, SingleCpxFn scf, Args&&... args) {
127 WrappingHelper<DoubleFn, SingleFn, DoubleCpxFn, SingleCpxFn> helper{df, sf, dcf, scf};
128 return helper.call(std::forward<Args>(args)...);
136 #define EIGEN_MAKE_LAPACKE_WRAPPER(FUNCTION) \
137 template<typename... Args> \
138 EIGEN_ALWAYS_INLINE auto FUNCTION(Args&&... args) { return call_wrapper(LAPACKE_d##FUNCTION, LAPACKE_s##FUNCTION, LAPACKE_z##FUNCTION, LAPACKE_c##FUNCTION, std::forward<Args>(args)...); }
149 #undef EIGEN_MAKE_LAPACKE_WRAPPER
#define EIGEN_ALWAYS_INLINE
#define lapack_complex_double
#define lapack_complex_float
#define EIGEN_MAKE_LAPACKE_WRAPPER(FUNCTION)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.