source: NonGTP/Boost/boost/numeric/ublas/detail/config.hpp @ 857

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