MKL_support.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2011, Intel Corporation. All rights reserved.
3 
4  Redistribution and use in source and binary forms, with or without modification,
5  are permitted provided that the following conditions are met:
6 
7  * Redistributions of source code must retain the above copyright notice, this
8  list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright notice,
10  this list of conditions and the following disclaimer in the documentation
11  and/or other materials provided with the distribution.
12  * Neither the name of Intel Corporation nor the names of its contributors may
13  be used to endorse or promote products derived from this software without
14  specific prior written permission.
15 
16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27  ********************************************************************************
28  * Content : Eigen bindings to Intel(R) MKL
29  * Include file with common MKL declarations
30  ********************************************************************************
31 */
32 
33 #ifndef EIGEN_MKL_SUPPORT_H
34 #define EIGEN_MKL_SUPPORT_H
35 
36 #ifdef EIGEN_USE_MKL_ALL
37  #ifndef EIGEN_USE_BLAS
38  #define EIGEN_USE_BLAS
39  #endif
40  #ifndef EIGEN_USE_LAPACKE
41  #define EIGEN_USE_LAPACKE
42  #endif
43  #ifndef EIGEN_USE_MKL_VML
44  #define EIGEN_USE_MKL_VML
45  #endif
46 #endif
47 
48 #ifdef EIGEN_USE_LAPACKE_STRICT
49  #define EIGEN_USE_LAPACKE
50 #endif
51 
52 #if defined(EIGEN_USE_BLAS) || defined(EIGEN_USE_LAPACKE) || defined(EIGEN_USE_MKL_VML)
53  #define EIGEN_USE_MKL
54 #endif
55 
56 #if defined EIGEN_USE_MKL
57 
58 #include <mkl.h>
59 #include <mkl_lapacke.h>
60 #define EIGEN_MKL_VML_THRESHOLD 128
61 
62 namespace Eigen {
63 
64 typedef std::complex<double> dcomplex;
65 typedef std::complex<float> scomplex;
66 
67 namespace internal {
68 
69 template<typename MKLType, typename EigenType>
70 static inline void assign_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) {
71  mklScalar=eigenScalar;
72 }
73 
74 template<typename MKLType, typename EigenType>
75 static inline void assign_conj_scalar_eig2mkl(MKLType& mklScalar, const EigenType& eigenScalar) {
76  mklScalar=eigenScalar;
77 }
78 
79 template <>
80 inline void assign_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) {
81  mklScalar.real=eigenScalar.real();
82  mklScalar.imag=eigenScalar.imag();
83 }
84 
85 template <>
86 inline void assign_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) {
87  mklScalar.real=eigenScalar.real();
88  mklScalar.imag=eigenScalar.imag();
89 }
90 
91 template <>
92 inline void assign_conj_scalar_eig2mkl<MKL_Complex16,dcomplex>(MKL_Complex16& mklScalar, const dcomplex& eigenScalar) {
93  mklScalar.real=eigenScalar.real();
94  mklScalar.imag=-eigenScalar.imag();
95 }
96 
97 template <>
98 inline void assign_conj_scalar_eig2mkl<MKL_Complex8,scomplex>(MKL_Complex8& mklScalar, const scomplex& eigenScalar) {
99  mklScalar.real=eigenScalar.real();
100  mklScalar.imag=-eigenScalar.imag();
101 }
102 
103 } // end namespace internal
104 
105 } // end namespace Eigen
106 
107 #endif
108 
109 #endif // EIGEN_MKL_SUPPORT_H
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: matrix.hpp:471


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:54