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

value_type/*zero*/() used as a placeholder to much disliked value_type (0)

svn path=/trunk/boost/boost/numeric/ublas/; revision=26965
This commit is contained in:
Michael Stevens
2005-01-31 15:14:30 +00:00
parent ea46a0e5fa
commit 03880cbe3f
17 changed files with 139 additions and 139 deletions

View File

@@ -202,7 +202,7 @@ namespace boost { namespace numeric { namespace ublas {
// Zeroing
BOOST_UBLAS_INLINE
void clear () {
std::fill (data ().begin (), data ().end (), value_type (0));
std::fill (data ().begin (), data ().end (), value_type/*zero*/());
}
// Assignment

View File

@@ -1002,7 +1002,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename promote_traits<typename E1::value_type,
typename E2::value_type>::promote_type value_type;
typedef typename type_traits<value_type>::real_type real_type;
return norm_inf (e1 - e2) == real_type (0);
return norm_inf (e1 - e2) == real_type/*zero*/();
}
template<class E1, class E2>
bool
@@ -1010,7 +1010,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename promote_traits<typename E1::value_type,
typename E2::value_type>::promote_type value_type;
typedef typename type_traits<value_type>::real_type real_type;
return norm_inf (e1 - e2) == real_type (0);
return norm_inf (e1 - e2) == real_type/*zero*/();
}
template<class T>

View File

@@ -88,7 +88,7 @@ namespace boost { namespace numeric { namespace ublas {
break;
} else if (compare > 0) {
if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
if (*it2e != value_type (0))
if (*it2e != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
++ it2e;
if (it2e != it2e_end)
@@ -100,7 +100,7 @@ namespace boost { namespace numeric { namespace ublas {
}
while (it2e != it2e_end) {
if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
if (*it2e != value_type (0))
if (*it2e != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
++ it2e;
}
@@ -117,7 +117,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
while (it2e != it2e_end) {
if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
if (*it2e != value_type (0))
if (*it2e != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
++ it2e;
}
@@ -134,7 +134,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
while (it2e != it2e_end) {
if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
if (*it2e != value_type (0))
if (*it2e != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
++ it2e;
}
@@ -142,7 +142,7 @@ namespace boost { namespace numeric { namespace ublas {
}
// ISSUE proxies require insert_element
for (size_type k = 0; k < index.size (); ++ k)
m (index [k].first, index [k].second) = value_type (0);
m (index [k].first, index [k].second) = value_type/*zero*/();
}
template<class M, class E, class R>
// BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
@@ -191,7 +191,7 @@ namespace boost { namespace numeric { namespace ublas {
break;
} else if (compare > 0) {
if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
if (*it1e != value_type (0))
if (*it1e != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
++ it1e;
if (it1e != it1e_end)
@@ -203,7 +203,7 @@ namespace boost { namespace numeric { namespace ublas {
}
while (it1e != it1e_end) {
if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
if (*it1e != value_type (0))
if (*it1e != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
++ it1e;
}
@@ -220,7 +220,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
while (it1e != it1e_end) {
if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
if (*it1e != value_type (0))
if (*it1e != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
++ it1e;
}
@@ -237,7 +237,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
while (it1e != it1e_end) {
if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
if (*it1e != value_type (0))
if (*it1e != value_type/*zero*/())
index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
++ it1e;
}
@@ -245,7 +245,7 @@ namespace boost { namespace numeric { namespace ublas {
}
// ISSUE proxies require insert_element
for (size_type k = 0; k < index.size (); ++ k)
m (index [k].first, index [k].second) = value_type (0);
m (index [k].first, index [k].second) = value_type/*zero*/();
}
// Explicitly iterating row major
@@ -677,7 +677,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
difference_type size2 (it2_end - it2);
while (-- size2 >= 0)
functor_type::apply (*it2, value_type (0)), ++ it2;
functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
++ it1;
}
} else {
@@ -717,7 +717,7 @@ namespace boost { namespace numeric { namespace ublas {
it2_size -= size2;
if (!functor_type::computed) {
while (-- size2 >= 0) // zeroing
functor_type::apply (*it2, value_type (0)), ++ it2;
functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
} else {
it2 += size2;
}
@@ -732,7 +732,7 @@ namespace boost { namespace numeric { namespace ublas {
size2 = it2_size;
if (!functor_type::computed) {
while (-- size2 >= 0) // zeroing
functor_type::apply (*it2, value_type (0)), ++ it2;
functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
} else {
it2 += size2;
}
@@ -750,7 +750,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
difference_type size2 (it2_end - it2);
while (-- size2 >= 0)
functor_type::apply (*it2, value_type (0)), ++ it2;
functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
++ it1;
}
} else {
@@ -811,7 +811,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
difference_type size1 (it1_end - it1);
while (-- size1 >= 0)
functor_type::apply (*it1, value_type (0)), ++ it1;
functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
++ it2;
}
} else {
@@ -851,7 +851,7 @@ namespace boost { namespace numeric { namespace ublas {
it1_size -= size1;
if (!functor_type::computed) {
while (-- size1 >= 0) // zeroing
functor_type::apply (*it1, value_type (0)), ++ it1;
functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
} else {
it1 += size1;
}
@@ -866,7 +866,7 @@ namespace boost { namespace numeric { namespace ublas {
size1 = it1_size;
if (!functor_type::computed) {
while (-- size1 >= 0) // zeroing
functor_type::apply (*it1, value_type (0)), ++ it1;
functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
} else {
it1 += size1;
}
@@ -884,7 +884,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
difference_type size1 (it1_end - it1);
while (-- size1 >= 0)
functor_type::apply (*it1, value_type (0)), ++ it1;
functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
++ it2;
}
} else {
@@ -920,7 +920,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
while (it2e != it2e_end) {
value_type t (*it2e);
if (t != value_type (0))
if (t != value_type/*zero*/())
m.insert_element (it2e.index1 (), it2e.index2 (), t);
++ it2e;
}
@@ -952,7 +952,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
while (it1e != it1e_end) {
value_type t (*it1e);
if (t != value_type (0))
if (t != value_type/*zero*/())
m.insert_element (it1e.index1 (), it1e.index2 (), t);
++ it1e;
}
@@ -1014,7 +1014,7 @@ namespace boost { namespace numeric { namespace ublas {
break;
} else if (compare < 0) {
if (!functor_type::computed) {
functor_type::apply (*it2, value_type (0));
functor_type::apply (*it2, value_type/*zero*/());
++ it2;
} else
increment (it2, it2_end, - compare);
@@ -1033,7 +1033,7 @@ namespace boost { namespace numeric { namespace ublas {
}
if (!functor_type::computed) {
while (it2 != it2_end) { // zeroing
functor_type::apply (*it2, value_type (0));
functor_type::apply (*it2, value_type/*zero*/());
++ it2;
}
} else {
@@ -1050,7 +1050,7 @@ namespace boost { namespace numeric { namespace ublas {
typename M::iterator2 it2_end (end (it1, iterator1_tag ()));
#endif
while (it2 != it2_end) { // zeroing
functor_type::apply (*it2, value_type (0));
functor_type::apply (*it2, value_type/*zero*/());
++ it2;
}
++ it1;
@@ -1071,7 +1071,7 @@ namespace boost { namespace numeric { namespace ublas {
typename M::iterator2 it2_end (end (it1, iterator1_tag ()));
#endif
while (it2 != it2_end) { // zeroing
functor_type::apply (*it2, value_type (0));
functor_type::apply (*it2, value_type/*zero*/());
++ it2;
}
++ it1;
@@ -1139,7 +1139,7 @@ namespace boost { namespace numeric { namespace ublas {
break;
} else if (compare < 0) {
if (!functor_type::computed) {
functor_type::apply (*it1, value_type (0)); // zeroing
functor_type::apply (*it1, value_type/*zero*/()); // zeroing
++ it1;
} else
increment (it1, it1_end, - compare);
@@ -1158,7 +1158,7 @@ namespace boost { namespace numeric { namespace ublas {
}
if (!functor_type::computed) {
while (it1 != it1_end) { // zeroing
functor_type::apply (*it1, value_type (0));
functor_type::apply (*it1, value_type/*zero*/());
++ it1;
}
} else {
@@ -1175,7 +1175,7 @@ namespace boost { namespace numeric { namespace ublas {
typename M::iterator1 it1_end (end (it2, iterator2_tag ()));
#endif
while (it1 != it1_end) { // zeroing
functor_type::apply (*it1, value_type (0));
functor_type::apply (*it1, value_type/*zero*/());
++ it1;
}
++ it2;
@@ -1196,7 +1196,7 @@ namespace boost { namespace numeric { namespace ublas {
typename M::iterator1 it1_end (end (it2, iterator2_tag ()));
#endif
while (it1 != it1_end) { // zeroing
functor_type::apply (*it1, value_type (0));
functor_type::apply (*it1, value_type/*zero*/());
++ it1;
}
++ it2;

View File

@@ -75,7 +75,7 @@ namespace boost { namespace numeric { namespace ublas {
else
break;
} else if (compare > 0) {
if (*ite != value_type (0))
if (*ite != value_type/*zero*/())
index.push_back (ite.index ());
++ ite;
if (ite != ite_end)
@@ -87,12 +87,12 @@ namespace boost { namespace numeric { namespace ublas {
}
while (ite != ite_end) {
if (*ite != value_type (0))
if (*ite != value_type/*zero*/())
index.push_back (ite.index ());
++ ite;
}
for (size_type k = 0; k < index.size (); ++ k)
v (index [k]) = value_type (0);
v (index [k]) = value_type/*zero*/();
}
// Explicitly iterating
@@ -320,7 +320,7 @@ namespace boost { namespace numeric { namespace ublas {
it_size -= size;
if (!functor_type::computed) {
while (-- size >= 0) // zeroing
functor_type::apply (*it, value_type (0)), ++ it;
functor_type::apply (*it, value_type/*zero*/()), ++ it;
} else {
it += size;
}
@@ -334,7 +334,7 @@ namespace boost { namespace numeric { namespace ublas {
size = it_size;
if (!functor_type::computed) {
while (-- size >= 0) // zeroing
functor_type::apply (*it, value_type (0)), ++ it;
functor_type::apply (*it, value_type/*zero*/()), ++ it;
} else {
it += size;
}
@@ -366,7 +366,7 @@ namespace boost { namespace numeric { namespace ublas {
typename E::const_iterator ite_end (e ().end ());
while (ite != ite_end) {
value_type t (*ite);
if (t != value_type (0))
if (t != value_type/*zero*/())
v.insert_element (ite.index (), t);
++ ite;
}
@@ -415,7 +415,7 @@ namespace boost { namespace numeric { namespace ublas {
break;
} else if (compare < 0) {
if (!functor_type::computed) {
functor_type::apply (*it, value_type (0));
functor_type::apply (*it, value_type/*zero*/());
++ it;
} else
increment (it, it_end, - compare);
@@ -435,7 +435,7 @@ namespace boost { namespace numeric { namespace ublas {
if (!functor_type::computed) {
while (it != it_end) { // zeroing
functor_type::apply (*it, value_type (0));
functor_type::apply (*it, value_type/*zero*/());
++ it;
}
} else {

View File

@@ -388,7 +388,7 @@ namespace boost { namespace numeric { namespace ublas {
// Zeroing
BOOST_UBLAS_INLINE
void clear () {
std::fill (data ().begin (), data ().end (), value_type (0));
std::fill (data ().begin (), data ().end (), value_type/*zero*/());
}
// Assignment

View File

@@ -99,7 +99,7 @@ namespace boost { namespace numeric { namespace ublas {
for (size_type i = 0; i < size; ++ i) {
matrix_column<M> mci (column (m, i));
matrix_row<M> mri (row (m, i));
if (m (i, i) != value_type (0)) {
if (m (i, i) != value_type/*zero*/()) {
project (mci, range (i + 1, size1)) *= value_type (1) / m (i, i);
} else if (singular == 0) {
singular = i + 1;
@@ -135,7 +135,7 @@ namespace boost { namespace numeric { namespace ublas {
matrix_row<M> mri (row (m, i));
size_type i_norm_inf = i + index_norm_inf (project (mci, range (i, size1)));
BOOST_UBLAS_CHECK (i_norm_inf < size1, external_logic ());
if (m (i_norm_inf, i) != value_type (0)) {
if (m (i_norm_inf, i) != value_type/*zero*/()) {
if (i_norm_inf != i) {
pm (i) = i_norm_inf;
row (m, i_norm_inf).swap (mri);
@@ -186,7 +186,7 @@ namespace boost { namespace numeric { namespace ublas {
axpy_prod<vector_type> (project (mr, range (i, size1), range (0, i)), urr));
size_type i_norm_inf = i + index_norm_inf (project (v, range (i, size1)));
BOOST_UBLAS_CHECK (i_norm_inf < size1, external_logic ());
if (v (i_norm_inf) != value_type (0)) {
if (v (i_norm_inf) != value_type/*zero*/()) {
if (i_norm_inf != i) {
pm (i) = i_norm_inf;
std::swap (v (i_norm_inf), v (i));
@@ -221,7 +221,7 @@ namespace boost { namespace numeric { namespace ublas {
axpy_prod<vector_type> (project (lr, range (i, size1), range (0, i)), urr));
size_type i_norm_inf = i + index_norm_inf (project (v, range (i, size1)));
BOOST_UBLAS_CHECK (i_norm_inf < size1, external_logic ());
if (v (i_norm_inf) != value_type (0)) {
if (v (i_norm_inf) != value_type/*zero*/()) {
if (i_norm_inf != i) {
pm (i) = i_norm_inf;
std::swap (v (i_norm_inf), v (i));

View File

@@ -179,7 +179,7 @@ namespace boost { namespace numeric { namespace ublas {
// Zeroing
BOOST_UBLAS_INLINE
void clear () {
std::fill (data ().begin (), data ().end (), value_type (0));
std::fill (data ().begin (), data ().end (), value_type/*zero*/());
}
// Assignment
@@ -1092,7 +1092,7 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
void clear () {
for (size_type k = 0; k < layout_type::size1 (size1_, size2_); ++ k)
std::fill (data () [k].begin (), data () [k].end (), value_type (0));
std::fill (data () [k].begin (), data () [k].end (), value_type/*zero*/());
}
// Assignment
@@ -3188,7 +3188,7 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
void clear () {
for (size_type i = 0; i < size1_; ++ i)
std::fill (data_ [i], data_ [i] + size2_, value_type (0));
std::fill (data_ [i], data_ [i] + size2_, value_type/*zero*/());
}
// Assignment

View File

@@ -548,7 +548,7 @@ namespace boost { namespace numeric { namespace ublas {
const_subiterator1_type it1_end (e1_.find (size1 ()));
const_subiterator2_type it2 (e2_.find (j));
const_subiterator2_type it2_end (e2_.find (size2 ()));
if (it2 == it2_end || (rank == 1 && (it2.index () != j || *it2 == value_type (0)))) {
if (it2 == it2_end || (rank == 1 && (it2.index () != j || *it2 == value_type/*zero*/()))) {
it1 = it1_end;
it2 = it2_end;
}
@@ -556,7 +556,7 @@ namespace boost { namespace numeric { namespace ublas {
return const_iterator1 (*this, it1.index (), it2.index ());
#else
#ifdef BOOST_UBLAS_USE_INVARIANT_HOISTING
return const_iterator1 (*this, it1, it2, it2 != it2_end ? *it2 : value_type (0));
return const_iterator1 (*this, it1, it2, it2 != it2_end ? *it2 : value_type/*zero*/());
#else
return const_iterator1 (*this, it1, it2);
#endif
@@ -568,7 +568,7 @@ namespace boost { namespace numeric { namespace ublas {
const_subiterator2_type it2_end (e2_.find (size2 ()));
const_subiterator1_type it1 (e1_.find (i));
const_subiterator1_type it1_end (e1_.find (size1 ()));
if (it1 == it1_end || (rank == 1 && (it1.index () != i || *it1 == value_type (0)))) {
if (it1 == it1_end || (rank == 1 && (it1.index () != i || *it1 == value_type/*zero*/()))) {
it2 = it2_end;
it1 = it1_end;
}
@@ -576,7 +576,7 @@ namespace boost { namespace numeric { namespace ublas {
return const_iterator2 (*this, it1.index (), it2.index ());
#else
#ifdef BOOST_UBLAS_USE_INVARIANT_HOISTING
return const_iterator2 (*this, it1, it2, it1 != it1_end ? *it1 : value_type (0));
return const_iterator2 (*this, it1, it2, it1 != it1_end ? *it1 : value_type/*zero*/());
#else
return const_iterator2 (*this, it1, it2);
#endif
@@ -2039,13 +2039,13 @@ namespace boost { namespace numeric { namespace ublas {
}
BOOST_UBLAS_INLINE
value_type dereference (packed_random_access_iterator_tag) const {
value_type t1 = value_type (0);
value_type t1 = value_type/*zero*/();
if (it1_ != it1_end_) {
BOOST_UBLAS_CHECK (it1_.index2 () == j_, internal_logic ());
if (it1_.index1 () == i_)
t1 = *it1_;
}
value_type t2 = value_type (0);
value_type t2 = value_type/*zero*/();
if (it2_ != it2_end_) {
BOOST_UBLAS_CHECK (it2_.index2 () == j_, internal_logic ());
if (it2_.index1 () == i_)
@@ -2093,13 +2093,13 @@ namespace boost { namespace numeric { namespace ublas {
}
BOOST_UBLAS_INLINE
value_type dereference (sparse_bidirectional_iterator_tag) const {
value_type t1 = value_type (0);
value_type t1 = value_type/*zero*/();
if (it1_ != it1_end_) {
BOOST_UBLAS_CHECK (it1_.index2 () == j_, internal_logic ());
if (it1_.index1 () == i_)
t1 = *it1_;
}
value_type t2 = value_type (0);
value_type t2 = value_type/*zero*/();
if (it2_ != it2_end_) {
BOOST_UBLAS_CHECK (it2_.index2 () == j_, internal_logic ());
if (it2_.index1 () == i_)
@@ -2296,13 +2296,13 @@ namespace boost { namespace numeric { namespace ublas {
}
BOOST_UBLAS_INLINE
value_type dereference (packed_random_access_iterator_tag) const {
value_type t1 = value_type (0);
value_type t1 = value_type/*zero*/();
if (it1_ != it1_end_) {
BOOST_UBLAS_CHECK (it1_.index1 () == i_, internal_logic ());
if (it1_.index2 () == j_)
t1 = *it1_;
}
value_type t2 = value_type (0);
value_type t2 = value_type/*zero*/();
if (it2_ != it2_end_) {
BOOST_UBLAS_CHECK (it2_.index1 () == i_, internal_logic ());
if (it2_.index2 () == j_)
@@ -2350,13 +2350,13 @@ namespace boost { namespace numeric { namespace ublas {
}
BOOST_UBLAS_INLINE
value_type dereference (sparse_bidirectional_iterator_tag) const {
value_type t1 = value_type (0);
value_type t1 = value_type/*zero*/();
if (it1_ != it1_end_) {
BOOST_UBLAS_CHECK (it1_.index1 () == i_, internal_logic ());
if (it1_.index2 () == j_)
t1 = *it1_;
}
value_type t2 = value_type (0);
value_type t2 = value_type/*zero*/();
if (it2_ != it2_end_) {
BOOST_UBLAS_CHECK (it2_.index1 () == i_, internal_logic ());
if (it2_.index2 () == j_)

View File

@@ -45,7 +45,7 @@ namespace boost { namespace numeric { namespace ublas {
if (p)
d_ = *p;
else
d_ = value_type (0);
d_ = value_type/*zero*/();
}
void set (const value_type &s) const {
@@ -142,7 +142,7 @@ namespace boost { namespace numeric { namespace ublas {
value_type& ref () const {
pointer p = (*this) ().find_element (i_, i_);
if (!p)
(*this) ().insert_element (i_, j_, value_type (0));
(*this) ().insert_element (i_, j_, value_type/*zero*/());
return *p;
}
@@ -385,7 +385,7 @@ namespace boost { namespace numeric { namespace ublas {
reference operator () (size_type i, size_type j) {
#ifndef BOOST_UBLAS_STRICT_MATRIX_SPARSE
const size_type element = layout_type::element (i, size1_, j, size2_);
std::pair<subiterator_type, bool> ii (data ().insert (typename array_type::value_type (element, value_type (0))));
std::pair<subiterator_type, bool> ii (data ().insert (typename array_type::value_type (element, value_type/*zero*/())));
BOOST_UBLAS_CHECK ((ii.first)->first == element, internal_logic ()); // broken map
return (ii.first)->second;
#else
@@ -1432,7 +1432,7 @@ namespace boost { namespace numeric { namespace ublas {
const size_type element1 = layout_type::element1 (i, size1_, j, size2_);
const size_type element2 = layout_type::element2 (i, size1_, j, size2_);
vector_data_value_type& vd (data () [element1]);
std::pair<subiterator_type, bool> ii (vd.insert (typename array_type::value_type::second_type::value_type (element2, value_type (0))));
std::pair<subiterator_type, bool> ii (vd.insert (typename array_type::value_type::second_type::value_type (element2, value_type/*zero*/())));
BOOST_UBLAS_CHECK ((ii.first)->first == element2, internal_logic ()); // broken map
return (ii.first)->second;
#else
@@ -2681,12 +2681,12 @@ namespace boost { namespace numeric { namespace ublas {
size_type element1 (layout_type::element1 (i, size1_, j, size2_));
size_type element2 (layout_type::element2 (i, size1_, j, size2_));
if (filled1_ <= element1 + 1)
return insert_element (i, j, value_type (0));
return insert_element (i, j, value_type/*zero*/());
pointer p = find_element (i, j);
if (p)
return *p;
else
return insert_element (i, j, value_type (0));
return insert_element (i, j, value_type/*zero*/());
#else
return reference (*this, i, j);
#endif
@@ -3989,7 +3989,7 @@ namespace boost { namespace numeric { namespace ublas {
if (p)
return *p;
else
return insert_element (i, j, value_type (0));
return insert_element (i, j, value_type/*zero*/());
#else
return reference (*this, i, j);
#endif

View File

@@ -74,14 +74,14 @@ namespace boost { namespace numeric { namespace ublas {
++ it2;
}
for (size_type j = jb; j < je + 1; ++ j) {
if (temporary (j) != value_type (0)) {
if (temporary (j) != value_type/*zero*/()) {
// FIXME we'll need to extend the container interface!
// m.push_back (it1.index1 (), j, temporary (j));
// FIXME What to do with adaptors?
// m.insert (it1.index1 (), j, temporary (j));
if (triangular_restriction::other (it1.index1 (), j))
m (it1.index1 (), j) = temporary (j);
temporary (j) = value_type (0);
temporary (j) = value_type/*zero*/();
}
}
++ it1;
@@ -142,14 +142,14 @@ namespace boost { namespace numeric { namespace ublas {
++ it1;
}
for (size_type i = ib; i < ie + 1; ++ i) {
if (temporary (i) != value_type (0)) {
if (temporary (i) != value_type/*zero*/()) {
// FIXME we'll need to extend the container interface!
// m.push_back (i, it2.index2 (), temporary (i));
// FIXME What to do with adaptors?
// m.insert (i, it2.index2 (), temporary (i));
if (triangular_restriction::other (i, it2.index2 ()))
m (i, it2.index2 ()) = temporary (i);
temporary (i) = value_type (0);
temporary (i) = value_type/*zero*/();
}
}
++ it2;

View File

@@ -176,7 +176,7 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
void clear () {
// data ().clear ();
std::fill (data ().begin (), data ().end (), value_type (0));
std::fill (data ().begin (), data ().end (), value_type/*zero*/());
}
// Assignment

View File

@@ -1069,7 +1069,7 @@ namespace boost { namespace numeric { namespace ublas {
#if BOOST_UBLAS_TYPE_CHECK
I cit (it);
while (cit != it_end) {
BOOST_UBLAS_CHECK (*cit == typename I::value_type (0), internal_logic ());
BOOST_UBLAS_CHECK (*cit == typename I::value_type/*zero*/(), internal_logic ());
++ cit;
}
#endif

View File

@@ -156,7 +156,7 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
void clear () {
// data ().clear ();
std::fill (data ().begin (), data ().end (), value_type (0));
std::fill (data ().begin (), data ().end (), value_type/*zero*/());
}
// Assignment
@@ -1766,13 +1766,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e2 ().size ();
for (size_type n = 0; n < size; ++ n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e2 () (n) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
for (size_type m = n + 1; m < size; ++ m)
e2 () (m) -= e1 () (m, n) * t;
}
@@ -1792,13 +1792,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e2 ().size ();
for (size_type n = 0; n < size; ++ n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e2 () (n) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E1::const_iterator1 it1e1 (e1 ().find1 (1, n + 1, n));
typename E1::const_iterator1 it1e1_end (e1 ().find1 (1, e1 ().size1 (), n));
difference_type m (it1e1_end - it1e1);
@@ -1821,13 +1821,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e2 ().size ();
for (size_type n = 0; n < size; ++ n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e2 () (n) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E1::const_iterator1 it1e1 (e1 ().find1 (1, n + 1, n));
typename E1::const_iterator1 it1e1_end (e1 ().find1 (1, e1 ().size1 (), n));
while (it1e1 != it1e1_end)
@@ -1884,13 +1884,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e2 ().size ();
for (difference_type n = size - 1; n >= 0; -- n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e2 () (n) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
for (difference_type m = n - 1; m >= 0; -- m)
e2 () (m) -= e1 () (m, n) * t;
}
@@ -1910,13 +1910,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e2 ().size ();
for (difference_type n = size - 1; n >= 0; -- n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e2 () (n) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E1::const_reverse_iterator1 it1e1 (e1 ().find1 (1, n, n));
typename E1::const_reverse_iterator1 it1e1_rend (e1 ().find1 (1, 0, n));
difference_type m (it1e1_rend - it1e1);
@@ -1939,13 +1939,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e2 ().size ();
for (difference_type n = size - 1; n >= 0; -- n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e2 () (n) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E1::const_reverse_iterator1 it1e1 (e1 ().find1 (1, n, n));
typename E1::const_reverse_iterator1 it1e1_rend (e1 ().find1 (1, 0, n));
while (it1e1 != it1e1_rend)
@@ -2013,13 +2013,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e1 ().size ();
for (difference_type n = size - 1; n >= 0; -- n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e2 () (n, n) == value_type (0))
if (e2 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e1 () (n) /= e2 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
for (difference_type m = n - 1; m >= 0; -- m)
e1 () (m) -= t * e2 () (n, m);
}
@@ -2039,13 +2039,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e1 ().size ();
for (difference_type n = size - 1; n >= 0; -- n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e2 () (n, n) == value_type (0))
if (e2 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e1 () (n) /= e2 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E2::const_reverse_iterator2 it2e2 (e2 ().find2 (1, n, n));
typename E2::const_reverse_iterator2 it2e2_rend (e2 ().find2 (1, n, 0));
difference_type m (it2e2_rend - it2e2);
@@ -2068,13 +2068,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e1 ().size ();
for (difference_type n = size - 1; n >= 0; -- n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e2 () (n, n) == value_type (0))
if (e2 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e1 () (n) /= e2 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E2::const_reverse_iterator2 it2e2 (e2 ().find2 (1, n, n));
typename E2::const_reverse_iterator2 it2e2_rend (e2 ().find2 (1, n, 0));
while (it2e2 != it2e2_rend)
@@ -2131,13 +2131,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e1 ().size ();
for (size_type n = 0; n < size; ++ n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e2 () (n, n) == value_type (0))
if (e2 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e1 () (n) /= e2 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
for (size_type m = n + 1; m < size; ++ m)
e1 () (m) -= t * e2 () (n, m);
}
@@ -2157,13 +2157,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e1 ().size ();
for (size_type n = 0; n < size; ++ n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e2 () (n, n) == value_type (0))
if (e2 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e1 () (n) /= e2 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E2::const_iterator2 it2e2 (e2 ().find2 (1, n, n + 1));
typename E2::const_iterator2 it2e2_end (e2 ().find2 (1, n, e2 ().size2 ()));
difference_type m (it2e2_end - it2e2);
@@ -2186,13 +2186,13 @@ namespace boost { namespace numeric { namespace ublas {
size_type size = e1 ().size ();
for (size_type n = 0; n < size; ++ n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e2 () (n, n) == value_type (0))
if (e2 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
value_type t = e1 () (n) /= e2 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E2::const_iterator2 it2e2 (e2 ().find2 (1, n, n + 1));
typename E2::const_iterator2 it2e2_end (e2 ().find2 (1, n, e2 ().size2 ()));
while (it2e2 != it2e2_end)
@@ -2271,14 +2271,14 @@ namespace boost { namespace numeric { namespace ublas {
size_type size2 = e2 ().size2 ();
for (size_type n = 0; n < size1; ++ n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
for (size_type l = 0; l < size2; ++ l) {
value_type t = e2 () (n, l) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
for (size_type m = n + 1; m < size1; ++ m)
e2 () (m, l) -= e1 () (m, n) * t;
}
@@ -2300,14 +2300,14 @@ namespace boost { namespace numeric { namespace ublas {
size_type size2 = e2 ().size2 ();
for (size_type n = 0; n < size1; ++ n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
for (size_type l = 0; l < size2; ++ l) {
value_type t = e2 () (n, l) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E1::const_iterator1 it1e1 (e1 ().find1 (1, n + 1, n));
typename E1::const_iterator1 it1e1_end (e1 ().find1 (1, e1 ().size1 (), n));
difference_type m (it1e1_end - it1e1);
@@ -2332,14 +2332,14 @@ namespace boost { namespace numeric { namespace ublas {
size_type size2 = e2 ().size2 ();
for (size_type n = 0; n < size1; ++ n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
for (size_type l = 0; l < size2; ++ l) {
value_type t = e2 () (n, l) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E1::const_iterator1 it1e1 (e1 ().find1 (1, n + 1, n));
typename E1::const_iterator1 it1e1_end (e1 ().find1 (1, e1 ().size1 (), n));
while (it1e1 != it1e1_end)
@@ -2381,14 +2381,14 @@ namespace boost { namespace numeric { namespace ublas {
size_type size2 = e2 ().size2 ();
for (difference_type n = size1 - 1; n >= 0; -- n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
for (difference_type l = size2 - 1; l >= 0; -- l) {
value_type t = e2 () (n, l) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
for (difference_type m = n - 1; m >= 0; -- m)
e2 () (m, l) -= e1 () (m, n) * t;
}
@@ -2410,14 +2410,14 @@ namespace boost { namespace numeric { namespace ublas {
size_type size2 = e2 ().size2 ();
for (difference_type n = size1 - 1; n >= 0; -- n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
for (difference_type l = size2 - 1; l >= 0; -- l) {
value_type t = e2 () (n, l) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E1::const_reverse_iterator1 it1e1 (e1 ().find1 (1, n, n));
typename E1::const_reverse_iterator1 it1e1_rend (e1 ().find1 (1, 0, n));
difference_type m (it1e1_rend - it1e1);
@@ -2442,14 +2442,14 @@ namespace boost { namespace numeric { namespace ublas {
size_type size2 = e2 ().size2 ();
for (difference_type n = size1 - 1; n >= 0; -- n) {
#ifndef BOOST_UBLAS_SINGULAR_CHECK
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type (0), singular ());
BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
#else
if (e1 () (n, n) == value_type (0))
if (e1 () (n, n) == value_type/*zero*/())
singular ().raise ();
#endif
for (difference_type l = size2 - 1; l >= 0; -- l) {
value_type t = e2 () (n, l) /= e1 () (n, n);
if (t != value_type (0)) {
if (t != value_type/*zero*/()) {
typename E1::const_reverse_iterator1 it1e1 (e1 ().find1 (1, n, n));
typename E1::const_reverse_iterator1 it1e1_rend (e1 ().find1 (1, 0, n));
while (it1e1 != it1e1_rend)

View File

@@ -136,7 +136,7 @@ namespace boost { namespace numeric { namespace ublas {
// Zeroing
BOOST_UBLAS_INLINE
void clear () {
std::fill (data ().begin (), data ().end (), value_type (0));
std::fill (data ().begin (), data ().end (), value_type/*zero*/());
}
// Assignment
@@ -1262,7 +1262,7 @@ namespace boost { namespace numeric { namespace ublas {
// Zeroing
BOOST_UBLAS_INLINE
void clear () {
std::fill (data_, data_ + size_, value_type (0));
std::fill (data_, data_ + size_, value_type/*zero*/());
}
// Assignment

View File

@@ -926,11 +926,11 @@ namespace boost { namespace numeric { namespace ublas {
}
BOOST_UBLAS_INLINE
value_type dereference (packed_random_access_iterator_tag) const {
value_type t1 = value_type (0);
value_type t1 = value_type/*zero*/();
if (it1_ != it1_end_)
if (it1_.index () == i_)
t1 = *it1_;
value_type t2 = value_type (0);
value_type t2 = value_type/*zero*/();
if (it2_ != it2_end_)
if (it2_.index () == i_)
t2 = *it2_;
@@ -976,11 +976,11 @@ namespace boost { namespace numeric { namespace ublas {
}
BOOST_UBLAS_INLINE
value_type dereference (sparse_bidirectional_iterator_tag) const {
value_type t1 = value_type (0);
value_type t1 = value_type/*zero*/();
if (it1_ != it1_end_)
if (it1_.index () == i_)
t1 = *it1_;
value_type t2 = value_type (0);
value_type t2 = value_type/*zero*/();
if (it2_ != it2_end_)
if (it2_.index () == i_)
t2 = *it2_;

View File

@@ -289,7 +289,7 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
void clear () {
const size_type sizeM = layout_type::size1 (size1_, size2_);
// FIXME should clear data () if this is done via value_type (0) then it is not size preserving
// FIXME should clear data () if this is done via value_type/*zero*/() then it is not size preserving
for (size_type i = 0; i < sizeM; ++ i)
ref (data () [i]).clear ();
storage_invariants ();

View File

@@ -44,7 +44,7 @@ namespace boost { namespace numeric { namespace ublas {
if (p)
d_ = *p;
else
d_ = value_type (0);
d_ = value_type/*zero*/();
}
void set (const value_type &s) const {
@@ -140,7 +140,7 @@ namespace boost { namespace numeric { namespace ublas {
value_type& ref () const {
pointer p = (*this) ().find_element (i_);
if (!p)
(*this) ().insert_element (i_, value_type (0));
(*this) ().insert_element (i_, value_type/*zero*/());
return *p;
}
@@ -388,7 +388,7 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
true_reference ref (size_type i) {
BOOST_UBLAS_CHECK (i < size_, bad_index ());
std::pair<subiterator_type, bool> ii (data ().insert (typename array_type::value_type (i, value_type (0))));
std::pair<subiterator_type, bool> ii (data ().insert (typename array_type::value_type (i, value_type/*zero*/())));
BOOST_UBLAS_CHECK ((ii->first).first == i, internal_logic ()); // broken map
return (ii.first)->second;
}
@@ -897,7 +897,7 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_CHECK (i < size_, bad_index ());
subiterator_type it (detail::lower_bound (index_data_.begin (), index_data_.begin () + filled_, k_based (i), std::less<size_type> ()));
if (it == index_data_.begin () + filled_ || *it != k_based (i))
return insert_element (i, value_type (0));
return insert_element (i, value_type/*zero*/());
else
return value_data_ [it - index_data_.begin ()];
}
@@ -1490,7 +1490,7 @@ namespace boost { namespace numeric { namespace ublas {
sort ();
subiterator_type it (detail::lower_bound (index_data_.begin (), index_data_.begin () + filled_, k_based (i), std::less<size_type> ()));
if (it == index_data_.begin () + filled_ || *it != k_based (i))
return insert_element (i, value_type (0));
return insert_element (i, value_type/*zero*/());
else
return value_data_ [it - index_data_.begin ()];
}