MKL_support.h
Go to the documentation of this file.
00001 /*
00002  Copyright (c) 2011, Intel Corporation. All rights reserved.
00003 
00004  Redistribution and use in source and binary forms, with or without modification,
00005  are permitted provided that the following conditions are met:
00006 
00007  * Redistributions of source code must retain the above copyright notice, this
00008    list of conditions and the following disclaimer.
00009  * Redistributions in binary form must reproduce the above copyright notice,
00010    this list of conditions and the following disclaimer in the documentation
00011    and/or other materials provided with the distribution.
00012  * Neither the name of Intel Corporation nor the names of its contributors may
00013    be used to endorse or promote products derived from this software without
00014    specific prior written permission.
00015 
00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
00020  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00023  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027  ********************************************************************************
00028  *   Content : Eigen bindings to Intel(R) MKL
00029  *   Include file with common MKL declarations
00030  ********************************************************************************
00031 */
00032 
00033 #ifndef EIGEN_MKL_SUPPORT_H
00034 #define EIGEN_MKL_SUPPORT_H
00035 
00036 #ifdef EIGEN_USE_MKL_ALL
00037   #ifndef EIGEN_USE_BLAS
00038     #define EIGEN_USE_BLAS
00039   #endif
00040   #ifndef EIGEN_USE_LAPACKE
00041     #define EIGEN_USE_LAPACKE
00042   #endif
00043   #ifndef EIGEN_USE_MKL_VML
00044     #define EIGEN_USE_MKL_VML
00045   #endif
00046 #endif
00047 
00048 #ifdef EIGEN_USE_LAPACKE_STRICT
00049   #define EIGEN_USE_LAPACKE
00050 #endif
00051 
00052 #if defined(EIGEN_USE_BLAS) || defined(EIGEN_USE_LAPACKE) || defined(EIGEN_USE_MKL_VML)
00053   #define EIGEN_USE_MKL
00054 #endif
00055 
00056 #if defined EIGEN_USE_MKL
00057 
00058 #include <mkl.h>
00059 #include <mkl_lapacke.h>
00060 #define EIGEN_MKL_VML_THRESHOLD 128
00061 
00062 namespace Eigen {
00063 
00064 typedef std::complex<double> dcomplex;
00065 typedef std::complex<float>  scomplex;
00066 
00067 namespace internal {
00068 
00069 template<typename MKLType, typename EigenType>
00070 static inline void assign_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) {
00071   mklScalar=eigenScalar;
00072 }
00073 
00074 template<typename MKLType, typename EigenType>
00075 static inline void assign_conj_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) {
00076   mklScalar=eigenScalar;
00077 }
00078 
00079 template <>
00080 inline void assign_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) {
00081   mklScalar.real=eigenScalar.real();
00082   mklScalar.imag=eigenScalar.imag();
00083 }
00084 
00085 template <>
00086 inline void assign_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) {
00087   mklScalar.real=eigenScalar.real();
00088   mklScalar.imag=eigenScalar.imag();
00089 }
00090 
00091 template <>
00092 inline void assign_conj_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) {
00093   mklScalar.real=eigenScalar.real();
00094   mklScalar.imag=-eigenScalar.imag();
00095 }
00096 
00097 template <>
00098 inline void assign_conj_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) {
00099   mklScalar.real=eigenScalar.real();
00100   mklScalar.imag=-eigenScalar.imag();
00101 }
00102 
00103 } // end namespace internal
00104 
00105 } // end namespace Eigen
00106 
00107 #endif
00108 
00109 #endif // EIGEN_MKL_SUPPORT_H


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:59:22