$treeview $search $mathjax
Eigen
3.2.5
$projectbrief
|
$projectbrief
|
$searchbox |
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 # include <mkl.h> 00058 /*Check IMKL version for compatibility: < 10.3 is not usable with Eigen*/ 00059 # ifndef INTEL_MKL_VERSION 00060 # undef EIGEN_USE_MKL /* INTEL_MKL_VERSION is not even defined on older versions */ 00061 # elif INTEL_MKL_VERSION < 100305 /* the intel-mkl-103-release-notes say this was when the lapacke.h interface was added*/ 00062 # undef EIGEN_USE_MKL 00063 # endif 00064 # ifndef EIGEN_USE_MKL 00065 /*If the MKL version is too old, undef everything*/ 00066 # undef EIGEN_USE_MKL_ALL 00067 # undef EIGEN_USE_BLAS 00068 # undef EIGEN_USE_LAPACKE 00069 # undef EIGEN_USE_MKL_VML 00070 # undef EIGEN_USE_LAPACKE_STRICT 00071 # undef EIGEN_USE_LAPACKE 00072 # endif 00073 #endif 00074 00075 #if defined EIGEN_USE_MKL 00076 #include <mkl_lapacke.h> 00077 #define EIGEN_MKL_VML_THRESHOLD 128 00078 00079 namespace Eigen { 00080 00081 typedef std::complex<double> dcomplex; 00082 typedef std::complex<float> scomplex; 00083 00084 namespace internal { 00085 00086 template<typename MKLType, typename EigenType> 00087 static inline void assign_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) { 00088 mklScalar=eigenScalar; 00089 } 00090 00091 template<typename MKLType, typename EigenType> 00092 static inline void assign_conj_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) { 00093 mklScalar=eigenScalar; 00094 } 00095 00096 template <> 00097 inline void assign_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) { 00098 mklScalar.real=eigenScalar.real(); 00099 mklScalar.imag=eigenScalar.imag(); 00100 } 00101 00102 template <> 00103 inline void assign_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) { 00104 mklScalar.real=eigenScalar.real(); 00105 mklScalar.imag=eigenScalar.imag(); 00106 } 00107 00108 template <> 00109 inline void assign_conj_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) { 00110 mklScalar.real=eigenScalar.real(); 00111 mklScalar.imag=-eigenScalar.imag(); 00112 } 00113 00114 template <> 00115 inline void assign_conj_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) { 00116 mklScalar.real=eigenScalar.real(); 00117 mklScalar.imag=-eigenScalar.imag(); 00118 } 00119 00120 } // end namespace internal 00121 00122 } // end namespace Eigen 00123 00124 #endif 00125 00126 #endif // EIGEN_MKL_SUPPORT_H