update boost on linux
This commit is contained in:
@@ -433,20 +433,19 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
template<class E>
|
||||
static BOOST_UBLAS_INLINE
|
||||
result_type apply (const vector_expression<E> &e) {
|
||||
#ifndef BOOST_UBLAS_SCALED_NORM
|
||||
real_type t = real_type ();
|
||||
typedef typename E::size_type vector_size_type;
|
||||
vector_size_type size (e ().size ());
|
||||
#ifndef BOOST_UBLAS_SCALED_NORM
|
||||
real_type t = real_type ();
|
||||
for (vector_size_type i = 0; i < size; ++ i) {
|
||||
real_type u (type_traits<value_type>::norm_2 (e () (i)));
|
||||
t += u * u;
|
||||
}
|
||||
return type_traits<real_type>::type_sqrt (t);
|
||||
return static_cast<result_type>(type_traits<real_type>::type_sqrt (t));
|
||||
#else
|
||||
real_type scale = real_type ();
|
||||
real_type sum_squares (1);
|
||||
size_type size (e ().size ());
|
||||
for (size_type i = 0; i < size; ++ i) {
|
||||
for (vector_size_type i = 0; i < size; ++ i) {
|
||||
real_type u (type_traits<value_type>::norm_2 (e () (i)));
|
||||
if ( real_type () /* zero */ == u ) continue;
|
||||
if (scale < u) {
|
||||
@@ -458,7 +457,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
sum_squares += v * v;
|
||||
}
|
||||
}
|
||||
return scale * type_traits<real_type>::type_sqrt (sum_squares);
|
||||
return static_cast<result_type>(scale * type_traits<real_type>::type_sqrt (sum_squares));
|
||||
#endif
|
||||
}
|
||||
// Dense case
|
||||
@@ -472,7 +471,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
t += u * u;
|
||||
++ it;
|
||||
}
|
||||
return type_traits<real_type>::type_sqrt (t);
|
||||
return static_cast<result_type>(type_traits<real_type>::type_sqrt (t));
|
||||
#else
|
||||
real_type scale = real_type ();
|
||||
real_type sum_squares (1);
|
||||
@@ -488,7 +487,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
++ it;
|
||||
}
|
||||
return scale * type_traits<real_type>::type_sqrt (sum_squares);
|
||||
return static_cast<result_type>(scale * type_traits<real_type>::type_sqrt (sum_squares));
|
||||
#endif
|
||||
}
|
||||
// Sparse case
|
||||
@@ -502,7 +501,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
t += u * u;
|
||||
++ it;
|
||||
}
|
||||
return type_traits<real_type>::type_sqrt (t);
|
||||
return static_cast<result_type>(type_traits<real_type>::type_sqrt (t));
|
||||
#else
|
||||
real_type scale = real_type ();
|
||||
real_type sum_squares (1);
|
||||
@@ -518,10 +517,56 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
++ it;
|
||||
}
|
||||
return scale * type_traits<real_type>::type_sqrt (sum_squares);
|
||||
return static_cast<result_type>(scale * type_traits<real_type>::type_sqrt (sum_squares));
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template<class V>
|
||||
struct vector_norm_2_square :
|
||||
public vector_scalar_real_unary_functor<V> {
|
||||
typedef typename vector_scalar_real_unary_functor<V>::value_type value_type;
|
||||
typedef typename vector_scalar_real_unary_functor<V>::real_type real_type;
|
||||
typedef typename vector_scalar_real_unary_functor<V>::result_type result_type;
|
||||
|
||||
template<class E>
|
||||
static BOOST_UBLAS_INLINE
|
||||
result_type apply (const vector_expression<E> &e) {
|
||||
real_type t = real_type ();
|
||||
typedef typename E::size_type vector_size_type;
|
||||
vector_size_type size (e ().size ());
|
||||
for (vector_size_type i = 0; i < size; ++ i) {
|
||||
real_type u (type_traits<value_type>::norm_2 (e () (i)));
|
||||
t += u * u;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
// Dense case
|
||||
template<class D, class I>
|
||||
static BOOST_UBLAS_INLINE
|
||||
result_type apply (D size, I it) {
|
||||
real_type t = real_type ();
|
||||
while (-- size >= 0) {
|
||||
real_type u (type_traits<value_type>::norm_2 (*it));
|
||||
t += u * u;
|
||||
++ it;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
// Sparse case
|
||||
template<class I>
|
||||
static BOOST_UBLAS_INLINE
|
||||
result_type apply (I it, const I &it_end) {
|
||||
real_type t = real_type ();
|
||||
while (it != it_end) {
|
||||
real_type u (type_traits<value_type>::norm_2 (*it));
|
||||
t += u * u;
|
||||
++ it;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
template<class V>
|
||||
struct vector_norm_inf:
|
||||
public vector_scalar_real_unary_functor<V> {
|
||||
@@ -749,7 +794,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
result_type apply (I1 it1, const I1 &it1_end, I2 it2, const I2 &it2_end, sparse_bidirectional_iterator_tag) {
|
||||
result_type t = result_type (0);
|
||||
if (it1 != it1_end && it2 != it2_end) {
|
||||
while (true) {
|
||||
for (;;) {
|
||||
if (it1.index () == it2.index ()) {
|
||||
t += *it1 * *it2, ++ it1, ++ it2;
|
||||
if (it1 == it1_end || it2 == it2_end)
|
||||
@@ -887,7 +932,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
result_type t = result_type (0);
|
||||
if (it1 != it1_end && it2 != it2_end) {
|
||||
size_type it1_index = it1.index2 (), it2_index = it2.index ();
|
||||
while (true) {
|
||||
for (;;) {
|
||||
difference_type compare = it1_index - it2_index;
|
||||
if (compare == 0) {
|
||||
t += *it1 * *it2, ++ it1, ++ it2;
|
||||
@@ -1055,7 +1100,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
result_type t = result_type (0);
|
||||
if (it1 != it1_end && it2 != it2_end) {
|
||||
size_type it1_index = it1.index (), it2_index = it2.index1 ();
|
||||
while (true) {
|
||||
for (;;) {
|
||||
difference_type compare = it1_index - it2_index;
|
||||
if (compare == 0) {
|
||||
t += *it1 * *it2, ++ it1, ++ it2;
|
||||
@@ -1232,7 +1277,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
result_type t = result_type (0);
|
||||
if (it1 != it1_end && it2 != it2_end) {
|
||||
size_type it1_index = it1.index2 (), it2_index = it2.index1 ();
|
||||
while (true) {
|
||||
for (;;) {
|
||||
difference_type compare = difference_type (it1_index - it2_index);
|
||||
if (compare == 0) {
|
||||
t += *it1 * *it2, ++ it1, ++ it2;
|
||||
@@ -1674,6 +1719,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
BOOST_UBLAS_CHECK (i < size_i, bad_index ());
|
||||
BOOST_UBLAS_CHECK (j < size_j, bad_index ());
|
||||
BOOST_UBLAS_CHECK (i <= j, bad_index ());
|
||||
boost::ignore_unused(size_i, size_j);
|
||||
// FIXME size_type overflow
|
||||
// sigma_j (j + 1) = (j + 1) * j / 2
|
||||
// j = 0 1 2 3, sigma = 0 1 3 6
|
||||
|
||||
Reference in New Issue
Block a user