Chris@16: // Chris@16: // Copyright (c) 2000-2002 Chris@16: // Joerg Walter, Mathias Koch Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // The authors gratefully acknowledge the support of Chris@16: // GeNeSys mbH & Co. KG in producing this work. Chris@16: // Chris@16: Chris@16: #ifndef _BOOST_UBLAS_CONFIG_ Chris@16: #define _BOOST_UBLAS_CONFIG_ Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@101: // C++11 Chris@101: #if defined(__cplusplus) && __cplusplus >= 201103L Chris@101: Chris@101: #define BOOST_UBLAS_CPP_GE_2011 Chris@101: Chris@101: #elif BOOST_MSVC >= 1800 Chris@101: Chris@101: #define BOOST_UBLAS_CPP_GE_2011 Chris@101: Chris@101: #else Chris@101: Chris@101: #undef BOOST_UBLAS_CPP_GE_2011 // Make sure no one defined it Chris@101: Chris@101: #endif Chris@16: Chris@16: // Microsoft Visual C++ Chris@16: #if defined (BOOST_MSVC) && ! defined (BOOST_STRICT_CONFIG) Chris@16: Chris@16: // Version 7.1 Chris@16: #if BOOST_MSVC == 1310 Chris@16: // One of these workarounds is needed for MSVC 7.1 AFAIK Chris@16: // (thanks to John Maddock and Martin Lauer). Chris@16: #if !(defined(BOOST_UBLAS_NO_NESTED_CLASS_RELATION) || defined(BOOST_UBLAS_MSVC_NESTED_CLASS_RELATION)) Chris@16: #define BOOST_UBLAS_NO_NESTED_CLASS_RELATION Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: Chris@16: // GNU Compiler Collection Chris@16: #if defined (__GNUC__) && ! defined (BOOST_STRICT_CONFIG) Chris@16: Chris@16: #if __GNUC__ >= 4 || (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4) Chris@16: // Specified by ABI definition see GCC bug id 9982 Chris@16: #define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW Chris@16: #endif Chris@16: Chris@16: #if __GNUC__ < 3 Chris@16: #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1 Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: Chris@16: // Intel Compiler Chris@16: #if defined (BOOST_INTEL) && ! defined (BOOST_STRICT_CONFIG) Chris@16: Chris@16: #if defined (BOOST_INTEL_LINUX) && (BOOST_INTEL_LINUX >= 800) Chris@16: // By inspection of compiler results Chris@16: #define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW Chris@16: #endif Chris@16: Chris@16: #if (BOOST_INTEL < 700) Chris@16: #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1 Chris@16: #endif Chris@16: Chris@16: // Define swap for index_pair and triple. Chris@16: #if (BOOST_INTEL <= 800) Chris@16: namespace boost { namespace numeric { namespace ublas { Chris@16: template Chris@16: class indexed_iterator; Chris@16: Chris@16: template Chris@16: class index_pair; Chris@16: template Chris@16: class index_triple; Chris@16: }}} Chris@16: Chris@16: namespace std { Chris@16: template Chris@16: inline Chris@16: void swap (boost::numeric::ublas::index_pair i1, boost::numeric::ublas::index_pair i2) { Chris@16: i1.swap (i2); Chris@16: } Chris@16: template Chris@16: inline Chris@16: void swap (boost::numeric::ublas::index_triple i1, boost::numeric::ublas::index_triple i2) { Chris@16: i1.swap (i2); Chris@16: } Chris@16: // iter_swap also needed for ICC on Itanium? Chris@16: template Chris@16: inline Chris@16: void iter_swap (boost::numeric::ublas::indexed_iterator it1, Chris@16: boost::numeric::ublas::indexed_iterator it2) { Chris@16: swap (*it1, *it2); Chris@16: } Chris@16: } Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: Chris@16: // Comeau compiler - thanks to Kresimir Fresl Chris@16: #if defined (__COMO__) && ! defined (BOOST_STRICT_CONFIG) Chris@16: Chris@16: // Missing std::abs overloads for float types in are in Chris@16: #if defined(__LIBCOMO__) && (__LIBCOMO_VERSION__ <= 31) Chris@16: #include Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: // PGI compiler Chris@16: #ifdef __PGIC__ Chris@16: #define BOOST_UBLAS_UNSUPPORTED_COMPILER 0 Chris@16: #endif Chris@16: Chris@16: // HP aCC C++ compiler Chris@16: #if defined (__HP_aCC) && ! defined (BOOST_STRICT_CONFIG) Chris@16: # if (__HP_aCC >= 60000 ) Chris@16: # define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW Chris@16: #endif Chris@16: #endif Chris@16: Chris@16: Chris@16: // SGI MIPSpro C++ compiler Chris@16: #if defined (__sgi) && ! defined (BOOST_STRICT_CONFIG) Chris@16: Chris@16: // Missing std::abs overloads for float types in are in Chris@16: // This test should be library version specific. Chris@16: #include Chris@16: Chris@16: #if __COMPILER_VERSION >=650 Chris@16: // By inspection of compiler results - thanks to Peter Schmitteckert Chris@16: #define BOOST_UBLAS_USEFUL_ARRAY_PLACEMENT_NEW Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: Chris@16: // Metrowerks Codewarrior Chris@16: #if defined (__MWERKS__) && ! defined (BOOST_STRICT_CONFIG) Chris@16: Chris@16: // 8.x Chris@16: #if __MWERKS__ <= 0x3003 Chris@16: #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1 Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: Chris@16: // Detect other compilers with serious defects - override by defineing BOOST_UBLAS_UNSUPPORTED_COMPILER=0 Chris@16: #ifndef BOOST_UBLAS_UNSUPPORTED_COMPILER Chris@101: #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STDC_NAMESPACE) Chris@16: #define BOOST_UBLAS_UNSUPPORTED_COMPILER 1 Chris@16: #endif Chris@16: #endif Chris@16: Chris@16: // Cannot continue with an unsupported compiler Chris@16: #if defined(BOOST_UBLAS_UNSUPPORTED_COMPILER) && (BOOST_UBLAS_UNSUPPORTED_COMPILER != 0) Chris@16: #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: #endif Chris@16: Chris@16: Chris@16: Chris@16: // Enable performance options in RELEASE mode Chris@16: #if defined (NDEBUG) || defined (BOOST_UBLAS_NDEBUG) Chris@16: Chris@16: #ifndef BOOST_UBLAS_INLINE Chris@16: #define BOOST_UBLAS_INLINE inline Chris@16: #endif Chris@16: Chris@16: // Do not check sizes! Chris@16: #define BOOST_UBLAS_USE_FAST_SAME Chris@16: Chris@16: // NO runtime error checks with BOOST_UBLAS_CHECK macro Chris@16: #ifndef BOOST_UBLAS_CHECK_ENABLE Chris@16: #define BOOST_UBLAS_CHECK_ENABLE 0 Chris@16: #endif Chris@16: Chris@16: // NO type compatibility numeric checks Chris@16: #ifndef BOOST_UBLAS_TYPE_CHECK Chris@16: #define BOOST_UBLAS_TYPE_CHECK 0 Chris@16: #endif Chris@16: Chris@16: Chris@16: // Disable performance options in DEBUG mode Chris@16: #else Chris@16: Chris@16: #ifndef BOOST_UBLAS_INLINE Chris@16: #define BOOST_UBLAS_INLINE Chris@16: #endif Chris@16: Chris@16: // Enable runtime error checks with BOOST_UBLAS_CHECK macro. Check bounds etc Chris@16: #ifndef BOOST_UBLAS_CHECK_ENABLE Chris@16: #define BOOST_UBLAS_CHECK_ENABLE 1 Chris@16: #endif Chris@16: Chris@16: // Type compatibiltity numeric checks Chris@16: #ifndef BOOST_UBLAS_TYPE_CHECK Chris@16: #define BOOST_UBLAS_TYPE_CHECK 1 Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: Chris@16: /* Chris@16: * Type compatibility checks Chris@16: * Control type compatibility numeric runtime checks for non dense matrices. Chris@16: * Require additional storage and complexity Chris@16: */ Chris@16: #if BOOST_UBLAS_TYPE_CHECK Chris@16: template Chris@16: struct disable_type_check Chris@16: { Chris@16: static bool value; Chris@16: }; Chris@16: template Chris@16: bool disable_type_check::value = false; Chris@16: #endif Chris@16: #ifndef BOOST_UBLAS_TYPE_CHECK_EPSILON Chris@16: #define BOOST_UBLAS_TYPE_CHECK_EPSILON (type_traits::type_sqrt (std::numeric_limits::epsilon ())) Chris@16: #endif Chris@16: #ifndef BOOST_UBLAS_TYPE_CHECK_MIN Chris@16: #define BOOST_UBLAS_TYPE_CHECK_MIN (type_traits::type_sqrt ( (std::numeric_limits::min) ())) Chris@16: #endif Chris@16: Chris@16: Chris@16: /* Chris@16: * General Configuration Chris@16: */ Chris@16: Chris@16: // Proxy shortcuts overload the alreadly heavily over used operator () Chris@16: //#define BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS Chris@16: Chris@16: // In order to simplify debugging is is possible to simplify expression template Chris@16: // so they are restricted to a single operation Chris@16: // #define BOOST_UBLAS_SIMPLE_ET_DEBUG Chris@16: Chris@16: // Use invariant hoisting. Chris@16: // #define BOOST_UBLAS_USE_INVARIANT_HOISTING Chris@16: Chris@16: // Use Duff's device in element access loops Chris@16: // #define BOOST_UBLAS_USE_DUFF_DEVICE Chris@16: Chris@16: // Choose evaluation method for dense vectors and matrices Chris@16: #if !(defined(BOOST_UBLAS_USE_INDEXING) || defined(BOOST_UBLAS_USE_ITERATING)) Chris@16: #define BOOST_UBLAS_USE_INDEXING Chris@16: #endif Chris@16: // #define BOOST_UBLAS_ITERATOR_THRESHOLD 0 Chris@16: Chris@16: // Use indexed iterators - unsupported implementation experiment Chris@16: // #define BOOST_UBLAS_USE_INDEXED_ITERATOR Chris@16: Chris@16: // Alignment of bounded_array type Chris@16: #ifndef BOOST_UBLAS_BOUNDED_ARRAY_ALIGN Chris@16: #define BOOST_UBLAS_BOUNDED_ARRAY_ALIGN Chris@16: #endif Chris@16: Chris@16: // Enable different sparse element proxies Chris@16: #ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES Chris@16: // Sparse proxies prevent reference invalidation problems in expressions such as: Chris@16: // a [1] = a [0] = 1 Thanks to Marc Duflot for spotting this. Chris@16: // #define BOOST_UBLAS_STRICT_MAP_ARRAY Chris@16: #define BOOST_UBLAS_STRICT_VECTOR_SPARSE Chris@16: #define BOOST_UBLAS_STRICT_MATRIX_SPARSE Chris@16: // Hermitian matrices use element proxies to allow assignment to conjugate triangle Chris@16: #define BOOST_UBLAS_STRICT_HERMITIAN Chris@16: #endif Chris@16: Chris@16: // Define to configure special settings for reference returning members Chris@16: // #define BOOST_UBLAS_REFERENCE_CONST_MEMBER Chris@16: // #define BOOST_UBLAS_PROXY_CONST_MEMBER Chris@16: Chris@16: Chris@16: // Include type declerations and functions Chris@16: #include Chris@16: #include Chris@16: Chris@16: Chris@16: #endif Chris@101: