Chris@16
|
1 //
|
Chris@16
|
2 // Copyright (c) 2000-2002
|
Chris@16
|
3 // Joerg Walter, Mathias Koch
|
Chris@16
|
4 //
|
Chris@16
|
5 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
6 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8 //
|
Chris@16
|
9 // The authors gratefully acknowledge the support of
|
Chris@16
|
10 // GeNeSys mbH & Co. KG in producing this work.
|
Chris@16
|
11 //
|
Chris@16
|
12
|
Chris@16
|
13 #ifndef _BOOST_UBLAS_CONFIG_
|
Chris@16
|
14 #define _BOOST_UBLAS_CONFIG_
|
Chris@16
|
15
|
Chris@16
|
16 #include <cassert>
|
Chris@16
|
17 #include <cstddef>
|
Chris@16
|
18 #include <algorithm>
|
Chris@16
|
19 #include <limits>
|
Chris@16
|
20
|
Chris@16
|
21 #include <boost/config.hpp>
|
Chris@16
|
22 #include <boost/static_assert.hpp>
|
Chris@16
|
23 #include <boost/noncopyable.hpp>
|
Chris@16
|
24 #include <boost/mpl/if.hpp>
|
Chris@16
|
25 #include <boost/mpl/and.hpp>
|
Chris@16
|
26 #include <boost/type_traits/is_same.hpp>
|
Chris@16
|
27 #include <boost/type_traits/is_convertible.hpp>
|
Chris@16
|
28 #include <boost/type_traits/is_const.hpp>
|
Chris@16
|
29 #include <boost/type_traits/remove_reference.hpp>
|
Chris@16
|
30
|
Chris@101
|
31 // C++11
|
Chris@101
|
32 #if defined(__cplusplus) && __cplusplus >= 201103L
|
Chris@101
|
33
|
Chris@101
|
34 #define BOOST_UBLAS_CPP_GE_2011
|
Chris@101
|
35
|
Chris@101
|
36 #elif BOOST_MSVC >= 1800
|
Chris@101
|
37
|
Chris@101
|
38 #define BOOST_UBLAS_CPP_GE_2011
|
Chris@101
|
39
|
Chris@101
|
40 #else
|
Chris@101
|
41
|
Chris@101
|
42 #undef BOOST_UBLAS_CPP_GE_2011 // Make sure no one defined it
|
Chris@101
|
43
|
Chris@101
|
44 #endif
|
Chris@16
|
45
|
Chris@16
|
46 // Microsoft Visual C++
|
Chris@16
|
47 #if defined (BOOST_MSVC) && ! defined (BOOST_STRICT_CONFIG)
|
Chris@16
|
48
|
Chris@16
|
49 // Version 7.1
|
Chris@16
|
50 #if BOOST_MSVC == 1310
|
Chris@16
|
51 // One of these workarounds is needed for MSVC 7.1 AFAIK
|
Chris@16
|
52 // (thanks to John Maddock and Martin Lauer).
|
Chris@16
|
53 #if !(defined(BOOST_UBLAS_NO_NESTED_CLASS_RELATION) || defined(BOOST_UBLAS_MSVC_NESTED_CLASS_RELATION))
|
Chris@16
|
54 #define BOOST_UBLAS_NO_NESTED_CLASS_RELATION
|
Chris@16
|
55 #endif
|
Chris@16
|
56
|
Chris@16
|
57 #endif
|
Chris@16
|
58
|
Chris@16
|
59 #endif
|
Chris@16
|
60
|
Chris@16
|
61
|
Chris@16
|
62 // GNU Compiler Collection
|
Chris@16
|
63 #if defined (__GNUC__) && ! defined (BOOST_STRICT_CONFIG)
|
Chris@16
|
64
|
Chris@16
|
65 #if __GNUC__ >= 4 || (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4)
|
Chris@16
|
66 // Specified by ABI definition see GCC bug id 9982
|
Chris@16
|
67 #define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW
|
Chris@16
|
68 #endif
|
Chris@16
|
69
|
Chris@16
|
70 #if __GNUC__ < 3
|
Chris@16
|
71 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1
|
Chris@16
|
72 #endif
|
Chris@16
|
73
|
Chris@16
|
74 #endif
|
Chris@16
|
75
|
Chris@16
|
76
|
Chris@16
|
77 // Intel Compiler
|
Chris@16
|
78 #if defined (BOOST_INTEL) && ! defined (BOOST_STRICT_CONFIG)
|
Chris@16
|
79
|
Chris@16
|
80 #if defined (BOOST_INTEL_LINUX) && (BOOST_INTEL_LINUX >= 800)
|
Chris@16
|
81 // By inspection of compiler results
|
Chris@16
|
82 #define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW
|
Chris@16
|
83 #endif
|
Chris@16
|
84
|
Chris@16
|
85 #if (BOOST_INTEL < 700)
|
Chris@16
|
86 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1
|
Chris@16
|
87 #endif
|
Chris@16
|
88
|
Chris@16
|
89 // Define swap for index_pair and triple.
|
Chris@16
|
90 #if (BOOST_INTEL <= 800)
|
Chris@16
|
91 namespace boost { namespace numeric { namespace ublas {
|
Chris@16
|
92 template<class C, class IC>
|
Chris@16
|
93 class indexed_iterator;
|
Chris@16
|
94
|
Chris@16
|
95 template<class V>
|
Chris@16
|
96 class index_pair;
|
Chris@16
|
97 template<class M>
|
Chris@16
|
98 class index_triple;
|
Chris@16
|
99 }}}
|
Chris@16
|
100
|
Chris@16
|
101 namespace std {
|
Chris@16
|
102 template<class V>
|
Chris@16
|
103 inline
|
Chris@16
|
104 void swap (boost::numeric::ublas::index_pair<V> i1, boost::numeric::ublas::index_pair<V> i2) {
|
Chris@16
|
105 i1.swap (i2);
|
Chris@16
|
106 }
|
Chris@16
|
107 template<class M>
|
Chris@16
|
108 inline
|
Chris@16
|
109 void swap (boost::numeric::ublas::index_triple<M> i1, boost::numeric::ublas::index_triple<M> i2) {
|
Chris@16
|
110 i1.swap (i2);
|
Chris@16
|
111 }
|
Chris@16
|
112 // iter_swap also needed for ICC on Itanium?
|
Chris@16
|
113 template<class C, class IC>
|
Chris@16
|
114 inline
|
Chris@16
|
115 void iter_swap (boost::numeric::ublas::indexed_iterator<C, IC> it1,
|
Chris@16
|
116 boost::numeric::ublas::indexed_iterator<C, IC> it2) {
|
Chris@16
|
117 swap (*it1, *it2);
|
Chris@16
|
118 }
|
Chris@16
|
119 }
|
Chris@16
|
120 #endif
|
Chris@16
|
121
|
Chris@16
|
122 #endif
|
Chris@16
|
123
|
Chris@16
|
124
|
Chris@16
|
125 // Comeau compiler - thanks to Kresimir Fresl
|
Chris@16
|
126 #if defined (__COMO__) && ! defined (BOOST_STRICT_CONFIG)
|
Chris@16
|
127
|
Chris@16
|
128 // Missing std::abs overloads for float types in <cmath> are in <cstdlib>
|
Chris@16
|
129 #if defined(__LIBCOMO__) && (__LIBCOMO_VERSION__ <= 31)
|
Chris@16
|
130 #include <cstdlib>
|
Chris@16
|
131 #endif
|
Chris@16
|
132
|
Chris@16
|
133 #endif
|
Chris@16
|
134
|
Chris@16
|
135 // PGI compiler
|
Chris@16
|
136 #ifdef __PGIC__
|
Chris@16
|
137 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 0
|
Chris@16
|
138 #endif
|
Chris@16
|
139
|
Chris@16
|
140 // HP aCC C++ compiler
|
Chris@16
|
141 #if defined (__HP_aCC) && ! defined (BOOST_STRICT_CONFIG)
|
Chris@16
|
142 # if (__HP_aCC >= 60000 )
|
Chris@16
|
143 # define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW
|
Chris@16
|
144 #endif
|
Chris@16
|
145 #endif
|
Chris@16
|
146
|
Chris@16
|
147
|
Chris@16
|
148 // SGI MIPSpro C++ compiler
|
Chris@16
|
149 #if defined (__sgi) && ! defined (BOOST_STRICT_CONFIG)
|
Chris@16
|
150
|
Chris@16
|
151 // Missing std::abs overloads for float types in <cmath> are in <cstdlib>
|
Chris@16
|
152 // This test should be library version specific.
|
Chris@16
|
153 #include <cstdlib>
|
Chris@16
|
154
|
Chris@16
|
155 #if __COMPILER_VERSION >=650
|
Chris@16
|
156 // By inspection of compiler results - thanks to Peter Schmitteckert
|
Chris@16
|
157 #define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW
|
Chris@16
|
158 #endif
|
Chris@16
|
159
|
Chris@16
|
160 #endif
|
Chris@16
|
161
|
Chris@16
|
162
|
Chris@16
|
163 // Metrowerks Codewarrior
|
Chris@16
|
164 #if defined (__MWERKS__) && ! defined (BOOST_STRICT_CONFIG)
|
Chris@16
|
165
|
Chris@16
|
166 // 8.x
|
Chris@16
|
167 #if __MWERKS__ <= 0x3003
|
Chris@16
|
168 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1
|
Chris@16
|
169 #endif
|
Chris@16
|
170
|
Chris@16
|
171 #endif
|
Chris@16
|
172
|
Chris@16
|
173
|
Chris@16
|
174 // Detect other compilers with serious defects - override by defineing BOOST_UBLAS_UNSUPPORTED_COMPILER=0
|
Chris@16
|
175 #ifndef BOOST_UBLAS_UNSUPPORTED_COMPILER
|
Chris@101
|
176 #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STDC_NAMESPACE)
|
Chris@16
|
177 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1
|
Chris@16
|
178 #endif
|
Chris@16
|
179 #endif
|
Chris@16
|
180
|
Chris@16
|
181 // Cannot continue with an unsupported compiler
|
Chris@16
|
182 #if defined(BOOST_UBLAS_UNSUPPORTED_COMPILER) && (BOOST_UBLAS_UNSUPPORTED_COMPILER != 0)
|
Chris@16
|
183 #error Your compiler and/or configuration is unsupported by this verions of uBLAS. Define BOOST_UBLAS_UNSUPPORTED_COMPILER=0 to override this message. Boost 1.32.0 includes uBLAS with support for many older compilers.
|
Chris@16
|
184 #endif
|
Chris@16
|
185
|
Chris@16
|
186
|
Chris@16
|
187
|
Chris@16
|
188 // Enable performance options in RELEASE mode
|
Chris@16
|
189 #if defined (NDEBUG) || defined (BOOST_UBLAS_NDEBUG)
|
Chris@16
|
190
|
Chris@16
|
191 #ifndef BOOST_UBLAS_INLINE
|
Chris@16
|
192 #define BOOST_UBLAS_INLINE inline
|
Chris@16
|
193 #endif
|
Chris@16
|
194
|
Chris@16
|
195 // Do not check sizes!
|
Chris@16
|
196 #define BOOST_UBLAS_USE_FAST_SAME
|
Chris@16
|
197
|
Chris@16
|
198 // NO runtime error checks with BOOST_UBLAS_CHECK macro
|
Chris@16
|
199 #ifndef BOOST_UBLAS_CHECK_ENABLE
|
Chris@16
|
200 #define BOOST_UBLAS_CHECK_ENABLE 0
|
Chris@16
|
201 #endif
|
Chris@16
|
202
|
Chris@16
|
203 // NO type compatibility numeric checks
|
Chris@16
|
204 #ifndef BOOST_UBLAS_TYPE_CHECK
|
Chris@16
|
205 #define BOOST_UBLAS_TYPE_CHECK 0
|
Chris@16
|
206 #endif
|
Chris@16
|
207
|
Chris@16
|
208
|
Chris@16
|
209 // Disable performance options in DEBUG mode
|
Chris@16
|
210 #else
|
Chris@16
|
211
|
Chris@16
|
212 #ifndef BOOST_UBLAS_INLINE
|
Chris@16
|
213 #define BOOST_UBLAS_INLINE
|
Chris@16
|
214 #endif
|
Chris@16
|
215
|
Chris@16
|
216 // Enable runtime error checks with BOOST_UBLAS_CHECK macro. Check bounds etc
|
Chris@16
|
217 #ifndef BOOST_UBLAS_CHECK_ENABLE
|
Chris@16
|
218 #define BOOST_UBLAS_CHECK_ENABLE 1
|
Chris@16
|
219 #endif
|
Chris@16
|
220
|
Chris@16
|
221 // Type compatibiltity numeric checks
|
Chris@16
|
222 #ifndef BOOST_UBLAS_TYPE_CHECK
|
Chris@16
|
223 #define BOOST_UBLAS_TYPE_CHECK 1
|
Chris@16
|
224 #endif
|
Chris@16
|
225
|
Chris@16
|
226 #endif
|
Chris@16
|
227
|
Chris@16
|
228
|
Chris@16
|
229 /*
|
Chris@16
|
230 * Type compatibility checks
|
Chris@16
|
231 * Control type compatibility numeric runtime checks for non dense matrices.
|
Chris@16
|
232 * Require additional storage and complexity
|
Chris@16
|
233 */
|
Chris@16
|
234 #if BOOST_UBLAS_TYPE_CHECK
|
Chris@16
|
235 template <class Dummy>
|
Chris@16
|
236 struct disable_type_check
|
Chris@16
|
237 {
|
Chris@16
|
238 static bool value;
|
Chris@16
|
239 };
|
Chris@16
|
240 template <class Dummy>
|
Chris@16
|
241 bool disable_type_check<Dummy>::value = false;
|
Chris@16
|
242 #endif
|
Chris@16
|
243 #ifndef BOOST_UBLAS_TYPE_CHECK_EPSILON
|
Chris@16
|
244 #define BOOST_UBLAS_TYPE_CHECK_EPSILON (type_traits<real_type>::type_sqrt (std::numeric_limits<real_type>::epsilon ()))
|
Chris@16
|
245 #endif
|
Chris@16
|
246 #ifndef BOOST_UBLAS_TYPE_CHECK_MIN
|
Chris@16
|
247 #define BOOST_UBLAS_TYPE_CHECK_MIN (type_traits<real_type>::type_sqrt ( (std::numeric_limits<real_type>::min) ()))
|
Chris@16
|
248 #endif
|
Chris@16
|
249
|
Chris@16
|
250
|
Chris@16
|
251 /*
|
Chris@16
|
252 * General Configuration
|
Chris@16
|
253 */
|
Chris@16
|
254
|
Chris@16
|
255 // Proxy shortcuts overload the alreadly heavily over used operator ()
|
Chris@16
|
256 //#define BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS
|
Chris@16
|
257
|
Chris@16
|
258 // In order to simplify debugging is is possible to simplify expression template
|
Chris@16
|
259 // so they are restricted to a single operation
|
Chris@16
|
260 // #define BOOST_UBLAS_SIMPLE_ET_DEBUG
|
Chris@16
|
261
|
Chris@16
|
262 // Use invariant hoisting.
|
Chris@16
|
263 // #define BOOST_UBLAS_USE_INVARIANT_HOISTING
|
Chris@16
|
264
|
Chris@16
|
265 // Use Duff's device in element access loops
|
Chris@16
|
266 // #define BOOST_UBLAS_USE_DUFF_DEVICE
|
Chris@16
|
267
|
Chris@16
|
268 // Choose evaluation method for dense vectors and matrices
|
Chris@16
|
269 #if !(defined(BOOST_UBLAS_USE_INDEXING) || defined(BOOST_UBLAS_USE_ITERATING))
|
Chris@16
|
270 #define BOOST_UBLAS_USE_INDEXING
|
Chris@16
|
271 #endif
|
Chris@16
|
272 // #define BOOST_UBLAS_ITERATOR_THRESHOLD 0
|
Chris@16
|
273
|
Chris@16
|
274 // Use indexed iterators - unsupported implementation experiment
|
Chris@16
|
275 // #define BOOST_UBLAS_USE_INDEXED_ITERATOR
|
Chris@16
|
276
|
Chris@16
|
277 // Alignment of bounded_array type
|
Chris@16
|
278 #ifndef BOOST_UBLAS_BOUNDED_ARRAY_ALIGN
|
Chris@16
|
279 #define BOOST_UBLAS_BOUNDED_ARRAY_ALIGN
|
Chris@16
|
280 #endif
|
Chris@16
|
281
|
Chris@16
|
282 // Enable different sparse element proxies
|
Chris@16
|
283 #ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
|
Chris@16
|
284 // Sparse proxies prevent reference invalidation problems in expressions such as:
|
Chris@16
|
285 // a [1] = a [0] = 1 Thanks to Marc Duflot for spotting this.
|
Chris@16
|
286 // #define BOOST_UBLAS_STRICT_MAP_ARRAY
|
Chris@16
|
287 #define BOOST_UBLAS_STRICT_VECTOR_SPARSE
|
Chris@16
|
288 #define BOOST_UBLAS_STRICT_MATRIX_SPARSE
|
Chris@16
|
289 // Hermitian matrices use element proxies to allow assignment to conjugate triangle
|
Chris@16
|
290 #define BOOST_UBLAS_STRICT_HERMITIAN
|
Chris@16
|
291 #endif
|
Chris@16
|
292
|
Chris@16
|
293 // Define to configure special settings for reference returning members
|
Chris@16
|
294 // #define BOOST_UBLAS_REFERENCE_CONST_MEMBER
|
Chris@16
|
295 // #define BOOST_UBLAS_PROXY_CONST_MEMBER
|
Chris@16
|
296
|
Chris@16
|
297
|
Chris@16
|
298 // Include type declerations and functions
|
Chris@16
|
299 #include <boost/numeric/ublas/fwd.hpp>
|
Chris@16
|
300 #include <boost/numeric/ublas/detail/definitions.hpp>
|
Chris@16
|
301
|
Chris@16
|
302
|
Chris@16
|
303 #endif
|
Chris@101
|
304
|