From e320497862fef80a4e4694a50008ef2cd31e1720 Mon Sep 17 00:00:00 2001 From: Michael Stevens Date: Sat, 7 Oct 2006 18:18:01 +0000 Subject: [PATCH] FIX remove none space space in last commit FIX interval was not compilable due to rename to scalar_traits CHANGE interval handling to use general abs/sqrt from last commit svn path=/trunk/boost/boost/numeric/ublas/; revision=35519 --- include/boost/numeric/ublas/traits.hpp | 73 ++++---------------------- 1 file changed, 11 insertions(+), 62 deletions(-) diff --git a/include/boost/numeric/ublas/traits.hpp b/include/boost/numeric/ublas/traits.hpp index 9f3454ae..d3b3caad 100644 --- a/include/boost/numeric/ublas/traits.hpp +++ b/include/boost/numeric/ublas/traits.hpp @@ -49,7 +49,7 @@ namespace boost { namespace numeric { namespace ublas { }; - // Type traits - generic numeric properties and functions + // Type traits - generic numeric properties and functions template struct type_traits; @@ -86,17 +86,17 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE real_type type_abs (const_reference t) { -            // we'll find either std::abs or else another version via ADL: -            using namespace std; -            return abs (t); + // we'll find either std::abs or else another version via ADL: + using namespace std; + return abs (t); } static BOOST_UBLAS_INLINE value_type type_sqrt (const_reference t) { -            using namespace std; -            // force a type conversion back to value_type for intgral types -            // we'll find either std::sqrt or else another version via ADL: -            return value_type (sqrt (t)); + using namespace std; + // force a type conversion back to value_type for intgral types + // we'll find either std::sqrt or else another version via ADL: + return value_type (sqrt (t)); } static @@ -268,59 +268,9 @@ namespace boost { namespace numeric { namespace ublas { }; #ifdef BOOST_UBLAS_USE_INTERVAL - // Define properties for a generic scalar interval type - template - struct scalar_interval_type_traits : scalar_type_traits { - typedef scalar_interval_type_traits self_type; - typedef boost::numeric::interval value_type; - typedef const value_type &const_reference; - typedef value_type &reference; - typedef value_type real_type; - typedef real_type precision_type; // we do not know what type has more precision then the real_type - - static const unsigned plus_complexity = 1; - static const unsigned multiplies_complexity = 1; - - static - BOOST_UBLAS_INLINE - real_type type_abs (const_reference t) { - return abs (t); - } - static - BOOST_UBLAS_INLINE - value_type type_sqrt (const_reference t) { - return sqrt (t); - } - - static - BOOST_UBLAS_INLINE - real_type norm_1 (const_reference t) { - return self_type::type_abs (t); - } - static - BOOST_UBLAS_INLINE - real_type norm_2 (const_reference t) { - return self_type::type_abs (t); - } - static - BOOST_UBLAS_INLINE - real_type norm_inf (const_reference t) { - return self_type::type_abs (t); - } - - static - BOOST_UBLAS_INLINE - bool equals (const_reference t1, const_reference t2) { - return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * - (std::max) ((std::max) (self_type::norm_inf (t1), - self_type::norm_inf (t2)), - BOOST_UBLAS_TYPE_CHECK_MIN); - } - }; - // Define scalar interval type traits template<> - struct type_traits > : scalar_interval_type_traits > { + struct type_traits > : scalar_traits > { typedef type_traits > self_type; typedef boost::numeric::interval value_type; typedef const value_type &const_reference; @@ -330,7 +280,7 @@ namespace boost { namespace numeric { namespace ublas { }; template<> - struct type_traits > : scalar_interval_type_traits > { + struct type_traits > : scalar_traits > { typedef type_traits > self_type; typedef boost::numeric::interval value_type; typedef const value_type &const_reference; @@ -339,7 +289,7 @@ namespace boost { namespace numeric { namespace ublas { typedef boost::numeric::interval precision_type; }; template<> - struct type_traits > : scalar_interval_type_traits > { + struct type_traits > : scalar_traits > { typedef type_traits > self_type; typedef boost::numeric::interval value_type; typedef const value_type &const_reference; @@ -347,7 +297,6 @@ namespace boost { namespace numeric { namespace ublas { typedef value_type real_type; typedef value_type precision_type; }; - #endif