cblas_inc.hpp
Go to the documentation of this file.
1 /*!
2  *
3  *
4  * \brief -
5  *
6  * \author -
7  * \date -
8  *
9  *
10  * \par Copyright 1995-2015 Shark Development Team
11  *
12  * <BR><HR>
13  * This file is part of Shark.
14  * <http://image.diku.dk/shark/>
15  *
16  * Shark is free software: you can redistribute it and/or modify
17  * it under the terms of the GNU Lesser General Public License as published
18  * by the Free Software Foundation, either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * Shark is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public License
27  * along with Shark. If not, see <http://www.gnu.org/licenses/>.
28  *
29  */
30 
31 #ifndef REMORA_KERNELS_CBLAS_CBLAS_INC_HPP
32 #define REMORA_KERNELS_CBLAS_CBLAS_INC_HPP
33 
34 #ifdef __APPLE__
35 
36 #ifdef __ASSERTMACROS__ //is AssertMacros already included?
37 //AssertMacros automatically defines __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES as 1
38 //if not already included
39 #if __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES
40 #warning "AssertMacros.h already included by some file. Disabling macros as otherwise compilation will fail"
41 
42 //incomplete list (probably the worst offenders that will fail compilation.
43 #ifdef check
44  #undef check
45 #endif
46 #ifdef require
47  #undef require
48 #endif
49 #ifdef verify
50  #undef verify
51 #endif
52 
53 #endif
54 #else
55 //noone included it yet, so we can just prevent these macros...
56 #define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
57 #endif
58 
59 // included to make Accelerate work with boost on MacOS
60 #include <boost/intrusive/list.hpp>
61 
62 // Accelerate framework support added by TG 19.06.2015
63 extern "C" {
64 #include <Accelerate/Accelerate.h>
65 }
66 #undef nil
67 
68 #else
69 
70 extern "C" {
71 #include <cblas.h>
72 }
73 
74 #endif
75 
76 //all atlas using functions need this anyway...
77 //so we prevent multiple includes in all atlas using functions
78 //which should decrease compile time a small bit
79 #include <complex>
80 #include "../../detail/traits.hpp"
81 
82 namespace remora {namespace bindings {
83 
84 template <typename Ord> struct storage_order {};
85 template<> struct storage_order<row_major> {
86  enum ename { value = CblasRowMajor };
87 };
88 template<> struct storage_order<column_major> {
89  enum ename { value = CblasColMajor };
90 };
91 
92 template<class T>
93 struct allowed_cblas_type{
94  typedef std::false_type type;
95 };
96 
97 template<>
98 struct allowed_cblas_type<float>{
99  typedef std::true_type type;
100 };
101 template<>
102 struct allowed_cblas_type<double>{
103  typedef std::true_type type;
104 };
105 template<>
106 struct allowed_cblas_type<std::complex<float> >{
107  typedef std::true_type type;
108 };
109 template<>
110 struct allowed_cblas_type<std::complex<double> >{
111  typedef std::true_type type;
112 };
113 
114 }}
115 
116 #ifndef OPENBLAS_CONST
117 typedef void cblas_float_complex_type;
118 typedef void cblas_double_complex_type;
119 #else
120 typedef float cblas_float_complex_type;
121 typedef double cblas_double_complex_type;
122 #endif
123 
124 
125 #endif