2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-22 03:42:19 +00:00

applied patch from #4410

[SVN r64857]
This commit is contained in:
David Bellot
2010-08-16 22:11:08 +00:00
parent 68dd316648
commit ddf29f230e

View File

@@ -13,6 +13,7 @@
#ifndef _BOOST_UBLAS_MATRIX_ASSIGN_
#define _BOOST_UBLAS_MATRIX_ASSIGN_
#include <boost/numeric/ublas/traits.hpp>
// Required for make_conformant storage
#include <vector>
@@ -90,7 +91,7 @@ namespace detail {
break;
} else if (compare > 0) {
if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
if (*it2e != value_type/*zero*/())
if (static_cast<value_type>(*it2e) != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
++ it2e;
if (it2e != it2e_end)
@@ -102,7 +103,7 @@ namespace detail {
}
while (it2e != it2e_end) {
if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
if (*it2e != value_type/*zero*/())
if (static_cast<value_type>(*it2e) != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
++ it2e;
}
@@ -119,7 +120,7 @@ namespace detail {
#endif
while (it2e != it2e_end) {
if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
if (*it2e != value_type/*zero*/())
if (static_cast<value_type>(*it2e) != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
++ it2e;
}
@@ -136,7 +137,7 @@ namespace detail {
#endif
while (it2e != it2e_end) {
if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
if (*it2e != value_type/*zero*/())
if (static_cast<value_type>(*it2e) != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
++ it2e;
}
@@ -193,7 +194,7 @@ namespace detail {
break;
} else if (compare > 0) {
if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
if (*it1e != value_type/*zero*/())
if (static_cast<value_type>(*it1e) != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
++ it1e;
if (it1e != it1e_end)
@@ -205,7 +206,7 @@ namespace detail {
}
while (it1e != it1e_end) {
if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
if (*it1e != value_type/*zero*/())
if (static_cast<value_type>(*it1e) != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
++ it1e;
}
@@ -222,7 +223,7 @@ namespace detail {
#endif
while (it1e != it1e_end) {
if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
if (*it1e != value_type/*zero*/())
if (static_cast<value_type>(*it1e) != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
++ it1e;
}
@@ -239,7 +240,7 @@ namespace detail {
#endif
while (it1e != it1e_end) {
if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
if (*it1e != value_type/*zero*/())
if (static_cast<value_type>(*it1e) != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
++ it1e;
}
@@ -636,7 +637,8 @@ namespace detail {
template<template <class T1, class T2> class F, class R, class M, class E>
// BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
void matrix_assign (M &m, const matrix_expression<E> &e, packed_proxy_tag, row_major_tag) {
typedef F<typename M::iterator2::reference, typename E::value_type> functor_type;
typedef typename matrix_traits<E>::value_type expr_value_type;
typedef F<typename M::iterator2::reference, expr_value_type> functor_type;
// R unnecessary, make_conformant not required
typedef typename M::difference_type difference_type;
typedef typename M::value_type value_type;
@@ -677,7 +679,7 @@ namespace detail {
#endif
difference_type size2 (it2_end - it2);
while (-- size2 >= 0)
functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
functor_type::apply (*it2, expr_value_type/*zero*/()), ++ it2;
++ it1;
}
} else {
@@ -717,7 +719,7 @@ namespace detail {
it2_size -= size2;
if (!functor_type::computed) {
while (-- size2 >= 0) // zeroing
functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
functor_type::apply (*it2, expr_value_type/*zero*/()), ++ it2;
} else {
it2 += size2;
}
@@ -732,7 +734,7 @@ namespace detail {
size2 = it2_size;
if (!functor_type::computed) {
while (-- size2 >= 0) // zeroing
functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
functor_type::apply (*it2, expr_value_type/*zero*/()), ++ it2;
} else {
it2 += size2;
}
@@ -750,7 +752,7 @@ namespace detail {
#endif
difference_type size2 (it2_end - it2);
while (-- size2 >= 0)
functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
functor_type::apply (*it2, expr_value_type/*zero*/()), ++ it2;
++ it1;
}
} else {
@@ -765,7 +767,8 @@ namespace detail {
template<template <class T1, class T2> class F, class R, class M, class E>
// BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
void matrix_assign (M &m, const matrix_expression<E> &e, packed_proxy_tag, column_major_tag) {
typedef F<typename M::iterator1::reference, typename E::value_type> functor_type;
typedef typename matrix_traits<E>::value_type expr_value_type;
typedef F<typename M::iterator1::reference, expr_value_type> functor_type;
// R unnecessary, make_conformant not required
typedef typename M::difference_type difference_type;
typedef typename M::value_type value_type;
@@ -806,7 +809,7 @@ namespace detail {
#endif
difference_type size1 (it1_end - it1);
while (-- size1 >= 0)
functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
functor_type::apply (*it1, expr_value_type/*zero*/()), ++ it1;
++ it2;
}
} else {
@@ -846,7 +849,7 @@ namespace detail {
it1_size -= size1;
if (!functor_type::computed) {
while (-- size1 >= 0) // zeroing
functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
functor_type::apply (*it1, expr_value_type/*zero*/()), ++ it1;
} else {
it1 += size1;
}
@@ -861,7 +864,7 @@ namespace detail {
size1 = it1_size;
if (!functor_type::computed) {
while (-- size1 >= 0) // zeroing
functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
functor_type::apply (*it1, expr_value_type/*zero*/()), ++ it1;
} else {
it1 += size1;
}
@@ -879,7 +882,7 @@ namespace detail {
#endif
difference_type size1 (it1_end - it1);
while (-- size1 >= 0)
functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
functor_type::apply (*it1, expr_value_type/*zero*/()), ++ it1;
++ it2;
}
} else {
@@ -958,7 +961,8 @@ namespace detail {
template<template <class T1, class T2> class F, class R, class M, class E>
// BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
void matrix_assign (M &m, const matrix_expression<E> &e, sparse_proxy_tag, row_major_tag) {
typedef F<typename M::iterator2::reference, typename E::value_type> functor_type;
typedef typename matrix_traits<E>::value_type expr_value_type;
typedef F<typename M::iterator2::reference, expr_value_type> functor_type;
typedef R conformant_restrict_type;
typedef typename M::size_type size_type;
typedef typename M::difference_type difference_type;
@@ -1004,7 +1008,7 @@ namespace detail {
break;
} else if (compare < 0) {
if (!functor_type::computed) {
functor_type::apply (*it2, value_type/*zero*/());
functor_type::apply (*it2, expr_value_type/*zero*/());
++ it2;
} else
increment (it2, it2_end, - compare);
@@ -1023,7 +1027,7 @@ namespace detail {
}
if (!functor_type::computed) {
while (it2 != it2_end) { // zeroing
functor_type::apply (*it2, value_type/*zero*/());
functor_type::apply (*it2, expr_value_type/*zero*/());
++ it2;
}
} else {
@@ -1040,7 +1044,7 @@ namespace detail {
typename M::iterator2 it2_end (end (it1, iterator1_tag ()));
#endif
while (it2 != it2_end) { // zeroing
functor_type::apply (*it2, value_type/*zero*/());
functor_type::apply (*it2, expr_value_type/*zero*/());
++ it2;
}
++ it1;
@@ -1061,7 +1065,7 @@ namespace detail {
typename M::iterator2 it2_end (end (it1, iterator1_tag ()));
#endif
while (it2 != it2_end) { // zeroing
functor_type::apply (*it2, value_type/*zero*/());
functor_type::apply (*it2, expr_value_type/*zero*/());
++ it2;
}
++ it1;
@@ -1078,7 +1082,8 @@ namespace detail {
template<template <class T1, class T2> class F, class R, class M, class E>
// BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
void matrix_assign (M &m, const matrix_expression<E> &e, sparse_proxy_tag, column_major_tag) {
typedef F<typename M::iterator1::reference, typename E::value_type> functor_type;
typedef typename matrix_traits<E>::value_type expr_value_type;
typedef F<typename M::iterator1::reference, expr_value_type> functor_type;
typedef R conformant_restrict_type;
typedef typename M::size_type size_type;
typedef typename M::difference_type difference_type;
@@ -1124,7 +1129,7 @@ namespace detail {
break;
} else if (compare < 0) {
if (!functor_type::computed) {
functor_type::apply (*it1, value_type/*zero*/()); // zeroing
functor_type::apply (*it1, expr_value_type/*zero*/()); // zeroing
++ it1;
} else
increment (it1, it1_end, - compare);
@@ -1143,7 +1148,7 @@ namespace detail {
}
if (!functor_type::computed) {
while (it1 != it1_end) { // zeroing
functor_type::apply (*it1, value_type/*zero*/());
functor_type::apply (*it1, expr_value_type/*zero*/());
++ it1;
}
} else {
@@ -1160,7 +1165,7 @@ namespace detail {
typename M::iterator1 it1_end (end (it2, iterator2_tag ()));
#endif
while (it1 != it1_end) { // zeroing
functor_type::apply (*it1, value_type/*zero*/());
functor_type::apply (*it1, expr_value_type/*zero*/());
++ it1;
}
++ it2;
@@ -1181,7 +1186,7 @@ namespace detail {
typename M::iterator1 it1_end (end (it2, iterator2_tag ()));
#endif
while (it1 != it1_end) { // zeroing
functor_type::apply (*it1, value_type/*zero*/());
functor_type::apply (*it1, expr_value_type/*zero*/());
++ it1;
}
++ it2;