![]() |
Boost.uBlas 1.49
Linear Algebra in C++: matrices, vectors and numeric algorithms
|
00001 // 00002 // Copyright (c) 2000-2002 00003 // Joerg Walter, Mathias Koch 00004 // 00005 // Distributed under the Boost Software License, Version 1.0. (See 00006 // accompanying file LICENSE_1_0.txt or copy at 00007 // http://www.boost.org/LICENSE_1_0.txt) 00008 // 00009 // The authors gratefully acknowledge the support of 00010 // GeNeSys mbH & Co. KG in producing this work. 00011 // 00012 00013 #ifndef _BOOST_UBLAS_CONFIG_ 00014 #define _BOOST_UBLAS_CONFIG_ 00015 00016 #include <cassert> 00017 #include <cstddef> 00018 #include <algorithm> 00019 #include <limits> 00020 00021 #include <boost/config.hpp> 00022 #include <boost/static_assert.hpp> 00023 #include <boost/noncopyable.hpp> 00024 #include <boost/mpl/if.hpp> 00025 #include <boost/mpl/and.hpp> 00026 #include <boost/type_traits/is_same.hpp> 00027 #include <boost/type_traits/is_convertible.hpp> 00028 #include <boost/type_traits/is_const.hpp> 00029 #include <boost/type_traits/remove_reference.hpp> 00030 00031 00032 // Microsoft Visual C++ 00033 #if defined (BOOST_MSVC) && ! defined (BOOST_STRICT_CONFIG) 00034 00035 // Version 6.0 and 7.0 00036 #if BOOST_MSVC <= 1300 00037 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1 00038 #endif 00039 00040 // Version 7.1 00041 #if BOOST_MSVC == 1310 00042 // One of these workarounds is needed for MSVC 7.1 AFAIK 00043 // (thanks to John Maddock and Martin Lauer). 00044 #if !(defined(BOOST_UBLAS_NO_NESTED_CLASS_RELATION) || defined(BOOST_UBLAS_MSVC_NESTED_CLASS_RELATION)) 00045 #define BOOST_UBLAS_NO_NESTED_CLASS_RELATION 00046 #endif 00047 00048 #endif 00049 00050 #endif 00051 00052 00053 // GNU Compiler Collection 00054 #if defined (__GNUC__) && ! defined (BOOST_STRICT_CONFIG) 00055 00056 #if __GNUC__ >= 4 || (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4) 00057 // Specified by ABI definition see GCC bug id 9982 00058 #define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW 00059 #endif 00060 00061 #if __GNUC__ < 3 00062 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1 00063 #endif 00064 00065 #endif 00066 00067 00068 // Intel Compiler 00069 #if defined (BOOST_INTEL) && ! defined (BOOST_STRICT_CONFIG) 00070 00071 #if defined (BOOST_INTEL_LINUX) && (BOOST_INTEL_LINUX >= 800) 00072 // By inspection of compiler results 00073 #define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW 00074 #endif 00075 00076 #if (BOOST_INTEL < 700) 00077 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1 00078 #endif 00079 00080 // Define swap for index_pair and triple. 00081 #if (BOOST_INTEL <= 800) 00082 namespace boost { namespace numeric { namespace ublas { 00083 template<class C, class IC> 00084 class indexed_iterator; 00085 00086 template<class V> 00087 class index_pair; 00088 template<class M> 00089 class index_triple; 00090 }}} 00091 00092 namespace std { 00093 template<class V> 00094 inline 00095 void swap (boost::numeric::ublas::index_pair<V> i1, boost::numeric::ublas::index_pair<V> i2) { 00096 i1.swap (i2); 00097 } 00098 template<class M> 00099 inline 00100 void swap (boost::numeric::ublas::index_triple<M> i1, boost::numeric::ublas::index_triple<M> i2) { 00101 i1.swap (i2); 00102 } 00103 // iter_swap also needed for ICC on Itanium? 00104 template<class C, class IC> 00105 inline 00106 void iter_swap (boost::numeric::ublas::indexed_iterator<C, IC> it1, 00107 boost::numeric::ublas::indexed_iterator<C, IC> it2) { 00108 swap (*it1, *it2); 00109 } 00110 } 00111 #endif 00112 00113 #endif 00114 00115 00116 // Comeau compiler - thanks to Kresimir Fresl 00117 #if defined (__COMO__) && ! defined (BOOST_STRICT_CONFIG) 00118 00119 // Missing std::abs overloads for float types in <cmath> are in <cstdlib> 00120 #if defined(__LIBCOMO__) && (__LIBCOMO_VERSION__ <= 31) 00121 #include <cstdlib> 00122 #endif 00123 00124 #endif 00125 00126 00127 // HP aCC C++ compiler 00128 #if defined (__HP_aCC) && ! defined (BOOST_STRICT_CONFIG) 00129 # if (__HP_aCC >= 60000 ) 00130 # define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW 00131 #endif 00132 #endif 00133 00134 00135 // SGI MIPSpro C++ compiler 00136 #if defined (__sgi) && ! defined (BOOST_STRICT_CONFIG) 00137 00138 // Missing std::abs overloads for float types in <cmath> are in <cstdlib> 00139 // This test should be library version specific. 00140 #include <cstdlib> 00141 00142 #if __COMPILER_VERSION >=650 00143 // By inspection of compiler results - thanks to Peter Schmitteckert 00144 #define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW 00145 #endif 00146 00147 #endif 00148 00149 00150 // Metrowerks Codewarrior 00151 #if defined (__MWERKS__) && ! defined (BOOST_STRICT_CONFIG) 00152 00153 // 8.x 00154 #if __MWERKS__ <= 0x3003 00155 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1 00156 #endif 00157 00158 #endif 00159 00160 00161 // Detect other compilers with serious defects - override by defineing BOOST_UBLAS_UNSUPPORTED_COMPILER=0 00162 #ifndef BOOST_UBLAS_UNSUPPORTED_COMPILER 00163 #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STDC_NAMESPACE) 00164 #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1 00165 #endif 00166 #endif 00167 00168 // Cannot continue with an unsupported compiler 00169 #if defined(BOOST_UBLAS_UNSUPPORTED_COMPILER) && (BOOST_UBLAS_UNSUPPORTED_COMPILER != 0) 00170 #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. 00171 #endif 00172 00173 00174 00175 // Enable performance options in RELEASE mode 00176 #if defined (NDEBUG) || defined (BOOST_UBLAS_NDEBUG) 00177 00178 #ifndef BOOST_UBLAS_INLINE 00179 #define BOOST_UBLAS_INLINE inline 00180 #endif 00181 00182 // Do not check sizes! 00183 #define BOOST_UBLAS_USE_FAST_SAME 00184 00185 // NO runtime error checks with BOOST_UBLAS_CHECK macro 00186 #ifndef BOOST_UBLAS_CHECK_ENABLE 00187 #define BOOST_UBLAS_CHECK_ENABLE 0 00188 #endif 00189 00190 // NO type compatibility numeric checks 00191 #ifndef BOOST_UBLAS_TYPE_CHECK 00192 #define BOOST_UBLAS_TYPE_CHECK 0 00193 #endif 00194 00195 00196 // Disable performance options in DEBUG mode 00197 #else 00198 00199 #ifndef BOOST_UBLAS_INLINE 00200 #define BOOST_UBLAS_INLINE 00201 #endif 00202 00203 // Enable runtime error checks with BOOST_UBLAS_CHECK macro. Check bounds etc 00204 #ifndef BOOST_UBLAS_CHECK_ENABLE 00205 #define BOOST_UBLAS_CHECK_ENABLE 1 00206 #endif 00207 00208 // Type compatibiltity numeric checks 00209 #ifndef BOOST_UBLAS_TYPE_CHECK 00210 #define BOOST_UBLAS_TYPE_CHECK 1 00211 #endif 00212 00213 #endif 00214 00215 00216 /* 00217 * Type compatibility checks 00218 * Control type compatibility numeric runtime checks for non dense matrices. 00219 * Require additional storage and complexity 00220 */ 00221 #if BOOST_UBLAS_TYPE_CHECK 00222 template <class Dummy> 00223 struct disable_type_check 00224 { 00225 static bool value; 00226 }; 00227 template <class Dummy> 00228 bool disable_type_check<Dummy>::value = false; 00229 #endif 00230 #ifndef BOOST_UBLAS_TYPE_CHECK_EPSILON 00231 #define BOOST_UBLAS_TYPE_CHECK_EPSILON (type_traits<real_type>::type_sqrt (std::numeric_limits<real_type>::epsilon ())) 00232 #endif 00233 #ifndef BOOST_UBLAS_TYPE_CHECK_MIN 00234 #define BOOST_UBLAS_TYPE_CHECK_MIN (type_traits<real_type>::type_sqrt ( (std::numeric_limits<real_type>::min) ())) 00235 #endif 00236 00237 00238 /* 00239 * General Configuration 00240 */ 00241 00242 // Proxy shortcuts overload the alreadly heavily over used operator () 00243 //#define BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS 00244 00245 // In order to simplify debugging is is possible to simplify expression template 00246 // so they are restricted to a single operation 00247 // #define BOOST_UBLAS_SIMPLE_ET_DEBUG 00248 00249 // Use invariant hoisting. 00250 // #define BOOST_UBLAS_USE_INVARIANT_HOISTING 00251 00252 // Use Duff's device in element access loops 00253 // #define BOOST_UBLAS_USE_DUFF_DEVICE 00254 00255 // Choose evaluation method for dense vectors and matrices 00256 #if !(defined(BOOST_UBLAS_USE_INDEXING) || defined(BOOST_UBLAS_USE_ITERATING)) 00257 #define BOOST_UBLAS_USE_INDEXING 00258 #endif 00259 // #define BOOST_UBLAS_ITERATOR_THRESHOLD 0 00260 00261 // Use indexed iterators - unsupported implementation experiment 00262 // #define BOOST_UBLAS_USE_INDEXED_ITERATOR 00263 00264 // Alignment of bounded_array type 00265 #ifndef BOOST_UBLAS_BOUNDED_ARRAY_ALIGN 00266 #define BOOST_UBLAS_BOUNDED_ARRAY_ALIGN 00267 #endif 00268 00269 // Enable different sparse element proxies 00270 #ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES 00271 // Sparse proxies prevent reference invalidation problems in expressions such as: 00272 // a [1] = a [0] = 1 Thanks to Marc Duflot for spotting this. 00273 // #define BOOST_UBLAS_STRICT_MAP_ARRAY 00274 #define BOOST_UBLAS_STRICT_VECTOR_SPARSE 00275 #define BOOST_UBLAS_STRICT_MATRIX_SPARSE 00276 // Hermitian matrices use element proxies to allow assignment to conjugate triangle 00277 #define BOOST_UBLAS_STRICT_HERMITIAN 00278 #endif 00279 00280 // Define to configure special settings for reference returning members 00281 // #define BOOST_UBLAS_REFERENCE_CONST_MEMBER 00282 // #define BOOST_UBLAS_PROXY_CONST_MEMBER 00283 00284 00285 // Include type declerations and functions 00286 #include <boost/numeric/ublas/fwd.hpp> 00287 #include <boost/numeric/ublas/detail/definitions.hpp> 00288 00289 00290 #endif