2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-26 17:12:10 +00:00

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
This commit is contained in:
Michael Stevens
2006-10-07 18:18:01 +00:00
parent de658c29b1
commit e320497862

View File

@@ -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<class T>
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<class T>
struct scalar_interval_type_traits : scalar_type_traits<T> {
typedef scalar_interval_type_traits<T> self_type;
typedef boost::numeric::interval<float> 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<boost::numeric::interval<float> > : scalar_interval_type_traits<boost::numeric::interval<float> > {
struct type_traits<boost::numeric::interval<float> > : scalar_traits<boost::numeric::interval<float> > {
typedef type_traits<boost::numeric::interval<float> > self_type;
typedef boost::numeric::interval<float> value_type;
typedef const value_type &const_reference;
@@ -330,7 +280,7 @@ namespace boost { namespace numeric { namespace ublas {
};
template<>
struct type_traits<boost::numeric::interval<double> > : scalar_interval_type_traits<boost::numeric::interval<double> > {
struct type_traits<boost::numeric::interval<double> > : scalar_traits<boost::numeric::interval<double> > {
typedef type_traits<boost::numeric::interval<double> > self_type;
typedef boost::numeric::interval<double> value_type;
typedef const value_type &const_reference;
@@ -339,7 +289,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef boost::numeric::interval<long double> precision_type;
};
template<>
struct type_traits<boost::numeric::interval<long double> > : scalar_interval_type_traits<boost::numeric::interval<long double> > {
struct type_traits<boost::numeric::interval<long double> > : scalar_traits<boost::numeric::interval<long double> > {
typedef type_traits<boost::numeric::interval<long double> > self_type;
typedef boost::numeric::interval<long double> 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