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

source code of include/boost/numeric/ublas/detail/config.hpp