From ee9fd65bb9bfde50cbadab3ceb1652def191647c Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Thu, 26 Feb 2004 18:27:02 +0000 Subject: [PATCH] remove minmax hack from win32.hpp and fix all places that could be affected by the minmax macros svn path=/trunk/boost/boost/numeric/ublas/; revision=22394 --- doc/samples/banded_adaptor.cpp | 3 +- doc/samples/banded_matrix.cpp | 3 +- doc/samples/matrix_binary.cpp | 5 +- doc/samples/matrix_matrix_binary.cpp | 5 +- doc/samples/matrix_matrix_solve.cpp | 3 +- doc/samples/matrix_vector_binary.cpp | 3 +- doc/samples/matrix_vector_solve.cpp | 3 +- doc/samples/vector_binary.cpp | 3 +- doc/samples/vector_binary_outer.cpp | 3 +- doc/samples/vector_binary_redux.cpp | 3 +- include/boost/numeric/ublas/banded.hpp | 121 +++++++++--------- include/boost/numeric/ublas/config.hpp | 4 +- include/boost/numeric/ublas/functional.hpp | 89 ++++++------- include/boost/numeric/ublas/hermitian.hpp | 33 ++--- include/boost/numeric/ublas/lu.hpp | 8 +- include/boost/numeric/ublas/matrix.hpp | 9 +- include/boost/numeric/ublas/matrix_assign.hpp | 27 ++-- .../boost/numeric/ublas/matrix_expression.hpp | 13 +- include/boost/numeric/ublas/matrix_proxy.hpp | 9 +- include/boost/numeric/ublas/matrix_sparse.hpp | 33 ++--- .../boost/numeric/ublas/operation_blocked.hpp | 22 ++-- .../boost/numeric/ublas/operation_sparse.hpp | 10 +- include/boost/numeric/ublas/storage.hpp | 29 +++-- .../boost/numeric/ublas/storage_sparse.hpp | 9 +- include/boost/numeric/ublas/symmetric.hpp | 33 ++--- include/boost/numeric/ublas/traits.hpp | 41 +++--- include/boost/numeric/ublas/vector.hpp | 5 +- include/boost/numeric/ublas/vector_assign.hpp | 15 ++- .../boost/numeric/ublas/vector_expression.hpp | 7 +- include/boost/numeric/ublas/vector_sparse.hpp | 25 ++-- test4/test4.hpp | 6 +- 31 files changed, 308 insertions(+), 274 deletions(-) diff --git a/doc/samples/banded_adaptor.cpp b/doc/samples/banded_adaptor.cpp index 61552021..0f7dcec7 100644 --- a/doc/samples/banded_adaptor.cpp +++ b/doc/samples/banded_adaptor.cpp @@ -16,13 +16,14 @@ #include #include +#include int main () { using namespace boost::numeric::ublas; matrix m (3, 3); banded_adaptor > ba (m, 1, 1); for (signed i = 0; i < signed (ba.size1 ()); ++ i) - for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (ba.size2 ())); ++ j) + for (signed j = std_max (i - 1, 0); j < std_min (i + 2, signed (ba.size2 ())); ++ j) ba (i, j) = 3 * i + j; std::cout << ba << std::endl; } diff --git a/doc/samples/banded_matrix.cpp b/doc/samples/banded_matrix.cpp index 68ee4d39..eb31d874 100644 --- a/doc/samples/banded_matrix.cpp +++ b/doc/samples/banded_matrix.cpp @@ -16,12 +16,13 @@ #include #include +#include int main () { using namespace boost::numeric::ublas; banded_matrix m (3, 3, 1, 1); for (signed i = 0; i < signed (m.size1 ()); ++ i) - for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (m.size2 ())); ++ j) + for (signed j = std_max (i - 1, 0); j < std_min (i + 2, signed (m.size2 ())); ++ j) m (i, j) = 3 * i + j; std::cout << m << std::endl; } diff --git a/doc/samples/matrix_binary.cpp b/doc/samples/matrix_binary.cpp index e4f67bf1..3148d3ab 100644 --- a/doc/samples/matrix_binary.cpp +++ b/doc/samples/matrix_binary.cpp @@ -16,12 +16,13 @@ #include #include +#include int main () { using namespace boost::numeric::ublas; matrix m1 (3, 3), m2 (3, 3); - for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i) - for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j) + for (unsigned i = 0; i < std_min (m1.size1 (), m2.size1 ()); ++ i) + for (unsigned j = 0; j < std_min (m1.size2 (), m2.size2 ()); ++ j) m1 (i, j) = m2 (i, j) = 3 * i + j; std::cout << m1 + m2 << std::endl; diff --git a/doc/samples/matrix_matrix_binary.cpp b/doc/samples/matrix_matrix_binary.cpp index 45b58efc..7b3bc9ad 100644 --- a/doc/samples/matrix_matrix_binary.cpp +++ b/doc/samples/matrix_matrix_binary.cpp @@ -16,12 +16,13 @@ #include #include +#include int main () { using namespace boost::numeric::ublas; matrix m1 (3, 3), m2 (3, 3); - for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i) - for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j) + for (unsigned i = 0; i < std_min (m1.size1 (), m2.size1 ()); ++ i) + for (unsigned j = 0; j < std_min (m1.size2 (), m2.size2 ()); ++ j) m1 (i, j) = m2 (i, j) = 3 * i + j; std::cout << prod (m1, m2) << std::endl; diff --git a/doc/samples/matrix_matrix_solve.cpp b/doc/samples/matrix_matrix_solve.cpp index 7b92c6d3..12558937 100644 --- a/doc/samples/matrix_matrix_solve.cpp +++ b/doc/samples/matrix_matrix_solve.cpp @@ -16,11 +16,12 @@ #include #include +#include int main () { using namespace boost::numeric::ublas; matrix m1 (3, 3), m2 (3, 3); - for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i) + for (unsigned i = 0; i < std_min (m1.size1 (), m2.size1 ()); ++ i) for (unsigned j = 0; j <= i; ++ j) m1 (i, j) = m2 (i, j) = 3 * i + j + 1; diff --git a/doc/samples/matrix_vector_binary.cpp b/doc/samples/matrix_vector_binary.cpp index 39e4edf6..74197c8e 100644 --- a/doc/samples/matrix_vector_binary.cpp +++ b/doc/samples/matrix_vector_binary.cpp @@ -16,12 +16,13 @@ #include #include +#include int main () { using namespace boost::numeric::ublas; matrix m (3, 3); vector v (3); - for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) { + for (unsigned i = 0; i < std_min (m.size1 (), v.size ()); ++ i) { for (unsigned j = 0; j < m.size2 (); ++ j) m (i, j) = 3 * i + j; v (i) = i; diff --git a/doc/samples/matrix_vector_solve.cpp b/doc/samples/matrix_vector_solve.cpp index 1f432482..1ed0496d 100644 --- a/doc/samples/matrix_vector_solve.cpp +++ b/doc/samples/matrix_vector_solve.cpp @@ -16,12 +16,13 @@ #include #include +#include int main () { using namespace boost::numeric::ublas; matrix m (3, 3); vector v (3); - for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) { + for (unsigned i = 0; i < std_min (m.size1 (), v.size ()); ++ i) { for (unsigned j = 0; j <= i; ++ j) m (i, j) = 3 * i + j + 1; v (i) = i; diff --git a/doc/samples/vector_binary.cpp b/doc/samples/vector_binary.cpp index d664c1d4..f069c54c 100644 --- a/doc/samples/vector_binary.cpp +++ b/doc/samples/vector_binary.cpp @@ -16,11 +16,12 @@ #include #include +#include int main () { using namespace boost::numeric::ublas; vector v1 (3), v2 (3); - for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i) + for (unsigned i = 0; i < std_min (v1.size (), v2.size ()); ++ i) v1 (i) = v2 (i) = i; std::cout << v1 + v2 << std::endl; diff --git a/doc/samples/vector_binary_outer.cpp b/doc/samples/vector_binary_outer.cpp index 42fa2569..72ba9dcc 100644 --- a/doc/samples/vector_binary_outer.cpp +++ b/doc/samples/vector_binary_outer.cpp @@ -16,11 +16,12 @@ #include #include +#include int main () { using namespace boost::numeric::ublas; vector v1 (3), v2 (3); - for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i) + for (unsigned i = 0; i < std_min (v1.size (), v2.size ()); ++ i) v1 (i) = v2 (i) = i; std::cout << outer_prod (v1, v2) << std::endl; diff --git a/doc/samples/vector_binary_redux.cpp b/doc/samples/vector_binary_redux.cpp index 754c6154..7ad0728a 100644 --- a/doc/samples/vector_binary_redux.cpp +++ b/doc/samples/vector_binary_redux.cpp @@ -15,11 +15,12 @@ // #include +#include int main () { using namespace boost::numeric::ublas; vector v1 (3), v2 (3); - for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i) + for (unsigned i = 0; i < std_min (v1.size (), v2.size ()); ++ i) v1 (i) = v2 (i) = i; std::cout << inner_prod (v1, v2) << std::endl; diff --git a/include/boost/numeric/ublas/banded.hpp b/include/boost/numeric/ublas/banded.hpp index ed537c7a..4ede62a6 100644 --- a/include/boost/numeric/ublas/banded.hpp +++ b/include/boost/numeric/ublas/banded.hpp @@ -20,6 +20,7 @@ #include #include #include +#include // Iterators based on ideas of Jeremy Siek @@ -125,7 +126,7 @@ namespace boost { namespace numeric { namespace ublas { size2_ = size2; lower_ = lower; upper_ = upper; - detail::resize (data (), std::max (size1, size2) * (lower + 1 + upper), preserve); + detail::resize (data (), std_max (size1, size2) * (lower + 1 + upper), preserve); } // Element access @@ -134,11 +135,11 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < size1_, bad_index ()); BOOST_UBLAS_CHECK (j < size2_, bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = lower_ + j - i; - if (k < std::max (size1_, size2_) && + if (k < std_max (size1_, size2_) && l < lower_ + 1 + upper_) - return data () [functor_type::element (k, std::max (size1_, size2_), + return data () [functor_type::element (k, std_max (size1_, size2_), l, lower_ + 1 + upper_)]; #else size_type k = j; @@ -155,11 +156,11 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < size1_, bad_index ()); BOOST_UBLAS_CHECK (j < size2_, bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = lower_ + j - i; - if (k < std::max (size1_, size2_) && + if (k < std_max (size1_, size2_) && l < lower_ + 1 + upper_) - return data () [functor_type::element (k, std::max (size1_, size2_), + return data () [functor_type::element (k, std_max (size1_, size2_), l, lower_ + 1 + upper_)]; #else size_type k = j; @@ -306,13 +307,13 @@ namespace boost { namespace numeric { namespace ublas { // return; // #endif #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = lower_ + j - i; - BOOST_UBLAS_CHECK (type_traits::equals (data () [functor_type::element (k, std::max (size1_, size2_), + BOOST_UBLAS_CHECK (type_traits::equals (data () [functor_type::element (k, std_max (size1_, size2_), l, lower_ + 1 + upper_)], value_type ()), bad_index ()); - // data ().insert (data ().begin () + functor_type::element (k, std::max (size1_, size2_), + // data ().insert (data ().begin () + functor_type::element (k, std_max (size1_, size2_), // l, lower_ + 1 + upper_), t); - data () [functor_type::element (k, std::max (size1_, size2_), + data () [functor_type::element (k, std_max (size1_, size2_), l, lower_ + 1 + upper_)] = t; #else size_type k = j; @@ -330,11 +331,11 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < size1_, bad_index ()); BOOST_UBLAS_CHECK (j < size2_, bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = lower_ + j - i; - // data ().erase (data ().begin () + functor_type::element (k, std::max (size1_, size2_), + // data ().erase (data ().begin () + functor_type::element (k, std_max (size1_, size2_), // l, lower_ + 1 + upper_)); - data () [functor_type::element (k, std::max (size1_, size2_), + data () [functor_type::element (k, std_max (size1_, size2_), l, lower_ + 1 + upper_)] = value_type (); #else size_type k = j; @@ -378,40 +379,40 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE const_iterator1 find1 (int rank, size_type i, size_type j) const { if (rank == 1) { - size_type lower_i = std::max (difference_type (j - upper_), difference_type (0)); - i = std::max (i, lower_i); - size_type upper_i = std::min (j + 1 + lower_, size1_); - i = std::min (i, upper_i); + size_type lower_i = std_max (difference_type (j - upper_), difference_type (0)); + i = std_max (i, lower_i); + size_type upper_i = std_min (j + 1 + lower_, size1_); + i = std_min (i, upper_i); } return const_iterator1 (*this, i, j); } BOOST_UBLAS_INLINE iterator1 find1 (int rank, size_type i, size_type j) { if (rank == 1) { - size_type lower_i = std::max (difference_type (j - upper_), difference_type (0)); - i = std::max (i, lower_i); - size_type upper_i = std::min (j + 1 + lower_, size1_); - i = std::min (i, upper_i); + size_type lower_i = std_max (difference_type (j - upper_), difference_type (0)); + i = std_max (i, lower_i); + size_type upper_i = std_min (j + 1 + lower_, size1_); + i = std_min (i, upper_i); } return iterator1 (*this, i, j); } BOOST_UBLAS_INLINE const_iterator2 find2 (int rank, size_type i, size_type j) const { if (rank == 1) { - size_type lower_j = std::max (difference_type (i - lower_), difference_type (0)); - j = std::max (j, lower_j); - size_type upper_j = std::min (i + 1 + upper_, size2_); - j = std::min (j, upper_j); + size_type lower_j = std_max (difference_type (i - lower_), difference_type (0)); + j = std_max (j, lower_j); + size_type upper_j = std_min (i + 1 + upper_, size2_); + j = std_min (j, upper_j); } return const_iterator2 (*this, i, j); } BOOST_UBLAS_INLINE iterator2 find2 (int rank, size_type i, size_type j) { if (rank == 1) { - size_type lower_j = std::max (difference_type (i - lower_), difference_type (0)); - j = std::max (j, lower_j); - size_type upper_j = std::min (i + 1 + upper_, size2_); - j = std::min (j, upper_j); + size_type lower_j = std_max (difference_type (i - lower_), difference_type (0)); + j = std_max (j, lower_j); + size_type upper_j = std_min (i + 1 + upper_, size2_); + j = std_min (j, upper_j); } return iterator2 (*this, i, j); } @@ -1184,9 +1185,9 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < size2 (), bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = lower_ + j - i; - if (k < std::max (size1 (), size2 ()) && + if (k < std_max (size1 (), size2 ()) && l < lower_ + 1 + upper_) return data () (i, j); #else @@ -1203,9 +1204,9 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < size2 (), bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = lower_ + j - i; - if (k < std::max (size1 (), size2 ()) && + if (k < std_max (size1 (), size2 ()) && l < lower_ + 1 + upper_) return data () (i, j); #else @@ -1228,9 +1229,9 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < size2 (), bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = lower_ + j - i; - if (k < std::max (size1 (), size2 ()) && + if (k < std_max (size1 (), size2 ()) && l < lower_ + 1 + upper_) return data () (i, j); #else @@ -1359,40 +1360,40 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE const_iterator1 find1 (int rank, size_type i, size_type j) const { if (rank == 1) { - size_type lower_i = std::max (difference_type (j - upper_), difference_type (0)); - i = std::max (i, lower_i); - size_type upper_i = std::min (j + 1 + lower_, size1 ()); - i = std::min (i, upper_i); + size_type lower_i = std_max (difference_type (j - upper_), difference_type (0)); + i = std_max (i, lower_i); + size_type upper_i = std_min (j + 1 + lower_, size1 ()); + i = std_min (i, upper_i); } return const_iterator1 (*this, data ().find1 (rank, i, j)); } BOOST_UBLAS_INLINE iterator1 find1 (int rank, size_type i, size_type j) { if (rank == 1) { - size_type lower_i = std::max (difference_type (j - upper_), difference_type (0)); - i = std::max (i, lower_i); - size_type upper_i = std::min (j + 1 + lower_, size1 ()); - i = std::min (i, upper_i); + size_type lower_i = std_max (difference_type (j - upper_), difference_type (0)); + i = std_max (i, lower_i); + size_type upper_i = std_min (j + 1 + lower_, size1 ()); + i = std_min (i, upper_i); } return iterator1 (*this, data ().find1 (rank, i, j)); } BOOST_UBLAS_INLINE const_iterator2 find2 (int rank, size_type i, size_type j) const { if (rank == 1) { - size_type lower_j = std::max (difference_type (i - lower_), difference_type (0)); - j = std::max (j, lower_j); - size_type upper_j = std::min (i + 1 + upper_, size2 ()); - j = std::min (j, upper_j); + size_type lower_j = std_max (difference_type (i - lower_), difference_type (0)); + j = std_max (j, lower_j); + size_type upper_j = std_min (i + 1 + upper_, size2 ()); + j = std_min (j, upper_j); } return const_iterator2 (*this, data ().find2 (rank, i, j)); } BOOST_UBLAS_INLINE iterator2 find2 (int rank, size_type i, size_type j) { if (rank == 1) { - size_type lower_j = std::max (difference_type (i - lower_), difference_type (0)); - j = std::max (j, lower_j); - size_type upper_j = std::min (i + 1 + upper_, size2 ()); - j = std::min (j, upper_j); + size_type lower_j = std_max (difference_type (i - lower_), difference_type (0)); + j = std_max (j, lower_j); + size_type upper_j = std_min (i + 1 + upper_, size2 ()); + j = std_min (j, upper_j); } return iterator2 (*this, data ().find2 (rank, i, j)); } @@ -1466,9 +1467,9 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < (*this) ().size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < (*this) ().size2 (), bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = (*this) ().lower () + j - i; - if (k < std::max ((*this) ().size1 (), (*this) ().size2 ()) && + if (k < std_max ((*this) ().size1 (), (*this) ().size2 ()) && l < (*this) ().lower () + 1 + (*this) ().upper ()) return *it1_; #else @@ -1619,9 +1620,9 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < (*this) ().size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < (*this) ().size2 (), bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = (*this) ().lower () + j - i; - if (k < std::max ((*this) ().size1 (), (*this) ().size2 ()) && + if (k < std_max ((*this) ().size1 (), (*this) ().size2 ()) && l < (*this) ().lower () + 1 + (*this) ().upper ()) return *it1_; #else @@ -1778,9 +1779,9 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < (*this) ().size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < (*this) ().size2 (), bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = (*this) ().lower () + j - i; - if (k < std::max ((*this) ().size1 (), (*this) ().size2 ()) && + if (k < std_max ((*this) ().size1 (), (*this) ().size2 ()) && l < (*this) ().lower () + 1 + (*this) ().upper ()) return *it2_; #else @@ -1931,9 +1932,9 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < (*this) ().size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < (*this) ().size2 (), bad_index ()); #ifdef BOOST_UBLAS_OWN_BANDED - size_type k = std::max (i, j); + size_type k = std_max (i, j); size_type l = (*this) ().lower () + j - i; - if (k < std::max ((*this) ().size1 (), (*this) ().size2 ()) && + if (k < std_max ((*this) ().size1 (), (*this) ().size2 ()) && l < (*this) ().lower () + 1 + (*this) ().upper ()) return *it2_; #else diff --git a/include/boost/numeric/ublas/config.hpp b/include/boost/numeric/ublas/config.hpp index 01f281c2..b1377fe2 100644 --- a/include/boost/numeric/ublas/config.hpp +++ b/include/boost/numeric/ublas/config.hpp @@ -369,7 +369,7 @@ static bool disable_type_check = false; #define BOOST_UBLAS_TYPE_CHECK_EPSILON (type_traits::sqrt (std::numeric_limits::epsilon ())) #endif #ifndef BOOST_UBLAS_TYPE_CHECK_MIN -#define BOOST_UBLAS_TYPE_CHECK_MIN (type_traits::sqrt (std::numeric_limits::min ())) +#define BOOST_UBLAS_TYPE_CHECK_MIN (type_traits::sqrt ((std::numeric_limits::min) ())) #endif @@ -384,7 +384,7 @@ static bool disable_type_check = false; #define BOOST_UBLAS_USE_INDEXING // #define BOOST_UBLAS_USE_ITERATING // #define BOOST_UBLAS_ITERATOR_THRESHOLD 0 -// #define BOOST_UBLAS_ITERATOR_THRESHOLD (std::numeric_limits::max ()) +// #define BOOST_UBLAS_ITERATOR_THRESHOLD ((std::numeric_limits::max) ()) // Use indexed iterators. // #define BOOST_UBLAS_USE_INDEXED_ITERATOR diff --git a/include/boost/numeric/ublas/functional.hpp b/include/boost/numeric/ublas/functional.hpp index 0da4d056..956bcd91 100644 --- a/include/boost/numeric/ublas/functional.hpp +++ b/include/boost/numeric/ublas/functional.hpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace boost { namespace numeric { namespace ublas { @@ -727,20 +728,20 @@ namespace boost { namespace numeric { namespace ublas { if (it1_size > 0 && it2_size > 0) diff = it2.index () - it1.index (); if (diff != 0) { - difference_type size = std::min (diff, it1_size); + difference_type size = std_min (diff, it1_size); if (size > 0) { it1 += size; it1_size -= size; diff -= size; } - size = std::min (- diff, it2_size); + size = std_min (- diff, it2_size); if (size > 0) { it2 += size; it2_size -= size; diff += size; } } - difference_type size (std::min (it1_size, it2_size)); + difference_type size (std_min (it1_size, it2_size)); while (-- size >= 0) t += *it1 * *it2, ++ it1, ++ it2; return t; @@ -868,20 +869,20 @@ namespace boost { namespace numeric { namespace ublas { if (it1_size > 0 && it2_size > 0) diff = it2.index () - it1.index2 (); if (diff != 0) { - difference_type size = std::min (diff, it1_size); + difference_type size = std_min (diff, it1_size); if (size > 0) { it1 += size; it1_size -= size; diff -= size; } - size = std::min (- diff, it2_size); + size = std_min (- diff, it2_size); if (size > 0) { it2 += size; it2_size -= size; diff += size; } } - difference_type size (std::min (it1_size, it2_size)); + difference_type size (std_min (it1_size, it2_size)); while (-- size >= 0) t += *it1 * *it2, ++ it1, ++ it2; return t; @@ -1032,20 +1033,20 @@ namespace boost { namespace numeric { namespace ublas { if (it1_size > 0 && it2_size > 0) diff = it2.index1 () - it1.index (); if (diff != 0) { - difference_type size = std::min (diff, it1_size); + difference_type size = std_min (diff, it1_size); if (size > 0) { it1 += size; it1_size -= size; diff -= size; } - size = std::min (- diff, it2_size); + size = std_min (- diff, it2_size); if (size > 0) { it2 += size; it2_size -= size; diff += size; } } - difference_type size (std::min (it1_size, it2_size)); + difference_type size (std_min (it1_size, it2_size)); while (-- size >= 0) t += *it1 * *it2, ++ it1, ++ it2; return t; @@ -1205,20 +1206,20 @@ namespace boost { namespace numeric { namespace ublas { if (it1_size > 0 && it2_size > 0) diff = it2.index1 () - it1.index2 (); if (diff != 0) { - difference_type size = std::min (diff, it1_size); + difference_type size = std_min (diff, it1_size); if (size > 0) { it1 += size; it1_size -= size; diff -= size; } - size = std::min (- diff, it2_size); + size = std_min (- diff, it2_size); if (size > 0) { it2 += size; it2_size -= size; diff += size; } } - difference_type size (std::min (it1_size, it2_size)); + difference_type size (std_min (it1_size, it2_size)); while (-- size >= 0) t += *it1 * *it2, ++ it1, ++ it2; return t; @@ -1415,7 +1416,7 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i <= j, bad_index ()); // sigma_i (size - i) = size * i - i * (i - 1) / 2 // i = 0 1 2 3, sigma = 0 4 7 9 - return (i * (2 * std::max (size1, size2) - i + 1)) / 2 + j - i; + return (i * (2 * std_max (size1, size2) - i + 1)) / 2 + j - i; } static @@ -1565,7 +1566,7 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i >= j, bad_index ()); // sigma_j (size - j) = size * j - j * (j - 1) / 2 // j = 0 1 2 3, sigma = 0 4 7 9 - return i - j + (j * (2 * std::max (size1, size2) - j + 1)) / 2; + return i - j + (j * (2 * std_max (size1, size2) - j + 1)) / 2; } static BOOST_UBLAS_INLINE @@ -1683,7 +1684,7 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type packed_size (size_type size1, size_type size2) { - size_type size = std::max (size1, size2); + size_type size = std_max (size1, size2); return ((size + 1) * size) / 2; } @@ -1712,22 +1713,22 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type restrict1 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } static BOOST_UBLAS_INLINE size_type restrict2 (size_type i, size_type j) { - return std::min (i + 1, j); + return std_min (i + 1, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict1 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict2 (size_type i, size_type j) { - return std::min (i + 1, j); + return std_min (i + 1, j); } }; struct upper { @@ -1737,7 +1738,7 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type packed_size (size_type size1, size_type size2) { - size_type size = std::max (size1, size2); + size_type size = std_max (size1, size2); return ((size + 1) * size) / 2; } @@ -1766,22 +1767,22 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type restrict1 (size_type i, size_type j) { - return std::min (i, j + 1); + return std_min (i, j + 1); } static BOOST_UBLAS_INLINE size_type restrict2 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict1 (size_type i, size_type j) { - return std::min (i, j + 1); + return std_min (i, j + 1); } static BOOST_UBLAS_INLINE size_type mutable_restrict2 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } }; struct unit_lower { @@ -1791,7 +1792,7 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type packed_size (size_type size1, size_type size2) { - size_type size = std::max (size1, size2); + size_type size = std_max (size1, size2); return ((size + 1) * size) / 2; } @@ -1820,22 +1821,22 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type restrict1 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } static BOOST_UBLAS_INLINE size_type restrict2 (size_type i, size_type j) { - return std::min (i + 1, j); + return std_min (i + 1, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict1 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict2 (size_type i, size_type j) { - return std::min (i, j); + return std_min (i, j); } }; struct unit_upper { @@ -1845,7 +1846,7 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type packed_size (size_type size1, size_type size2) { - size_type size = std::max (size1, size2); + size_type size = std_max (size1, size2); return ((size + 1) * size) / 2; } @@ -1874,22 +1875,22 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type restrict1 (size_type i, size_type j) { - return std::min (i, j + 1); + return std_min (i, j + 1); } static BOOST_UBLAS_INLINE size_type restrict2 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict1 (size_type i, size_type j) { - return std::min (i, j); + return std_min (i, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict2 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } }; struct strict_lower { @@ -1899,7 +1900,7 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type packed_size (size_type size1, size_type size2) { - size_type size = std::max (size1, size2); + size_type size = std_max (size1, size2); return ((size + 1) * size) / 2; } @@ -1928,22 +1929,22 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type restrict1 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } static BOOST_UBLAS_INLINE size_type restrict2 (size_type i, size_type j) { - return std::min (i, j); + return std_min (i, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict1 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict2 (size_type i, size_type j) { - return std::min (i, j); + return std_min (i, j); } }; struct strict_upper { @@ -1953,7 +1954,7 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type packed_size (size_type size1, size_type size2) { - size_type size = std::max (size1, size2); + size_type size = std_max (size1, size2); return ((size + 1) * size) / 2; } @@ -1982,22 +1983,22 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type restrict1 (size_type i, size_type j) { - return std::min (i, j); + return std_min (i, j); } static BOOST_UBLAS_INLINE size_type restrict2 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict1 (size_type i, size_type j) { - return std::min (i, j); + return std_min (i, j); } static BOOST_UBLAS_INLINE size_type mutable_restrict2 (size_type i, size_type j) { - return std::max (i, j); + return std_max (i, j); } }; diff --git a/include/boost/numeric/ublas/hermitian.hpp b/include/boost/numeric/ublas/hermitian.hpp index 333dcf8e..c33c86f4 100644 --- a/include/boost/numeric/ublas/hermitian.hpp +++ b/include/boost/numeric/ublas/hermitian.hpp @@ -20,6 +20,7 @@ #include #include #include +#include // Iterators based on ideas of Jeremy Siek // Hermitian matrices are square. Thanks to Peter Schmitteckert for spotting this. @@ -1745,23 +1746,23 @@ namespace boost { namespace numeric { namespace ublas { const_iterator1 &operator += (difference_type n) { BOOST_UBLAS_CHECK (current_ == 0 || current_ == 1, internal_logic ()); if (current_ == 0) { - size_type d = std::min (n, it1_end_ - it1_); + size_type d = std_min (n, it1_end_ - it1_); it1_ += d; n -= d; if (n > 0 || (end_ == 1 && it1_ == it1_end_)) { BOOST_UBLAS_CHECK (end_ == 1, external_logic ()); - d = std::min (n, it2_end_ - it2_begin_); + d = std_min (n, it2_end_ - it2_begin_); it2_ = it2_begin_ + d; n -= d; current_ = 1; } } else /* if (current_ == 1) */ { - size_type d = std::min (n, it2_end_ - it2_); + size_type d = std_min (n, it2_end_ - it2_); it2_ += d; n -= d; if (n > 0 || (end_ == 0 && it2_ == it2_end_)) { BOOST_UBLAS_CHECK (end_ == 0, external_logic ()); - d = std::min (n, it1_end_ - it1_begin_); + d = std_min (n, it1_end_ - it1_begin_); it1_ = it1_begin_ + d; n -= d; current_ = 0; @@ -1774,23 +1775,23 @@ namespace boost { namespace numeric { namespace ublas { const_iterator1 &operator -= (difference_type n) { BOOST_UBLAS_CHECK (current_ == 0 || current_ == 1, internal_logic ()); if (current_ == 0) { - size_type d = std::min (n, it1_ - it1_begin_); + size_type d = std_min (n, it1_ - it1_begin_); it1_ -= d; n -= d; if (n > 0) { BOOST_UBLAS_CHECK (end_ == 1, external_logic ()); - d = std::min (n, it2_end_ - it2_begin_); + d = std_min (n, it2_end_ - it2_begin_); it2_ = it2_end_ - d; n -= d; current_ = 1; } } else /* if (current_ == 1) */ { - size_type d = std::min (n, it2_ - it2_begin_); + size_type d = std_min (n, it2_ - it2_begin_); it2_ -= d; n -= d; if (n > 0) { BOOST_UBLAS_CHECK (end_ == 0, external_logic ()); - d = std::min (n, it1_end_ - it1_begin_); + d = std_min (n, it1_end_ - it1_begin_); it1_ = it1_end_ - d; n -= d; current_ = 0; @@ -2202,23 +2203,23 @@ namespace boost { namespace numeric { namespace ublas { const_iterator2 &operator += (difference_type n) { BOOST_UBLAS_CHECK (current_ == 0 || current_ == 1, internal_logic ()); if (current_ == 0) { - size_type d = std::min (n, it1_end_ - it1_); + size_type d = std_min (n, it1_end_ - it1_); it1_ += d; n -= d; if (n > 0 || (end_ == 1 && it1_ == it1_end_)) { BOOST_UBLAS_CHECK (end_ == 1, external_logic ()); - d = std::min (n, it2_end_ - it2_begin_); + d = std_min (n, it2_end_ - it2_begin_); it2_ = it2_begin_ + d; n -= d; current_ = 1; } } else /* if (current_ == 1) */ { - size_type d = std::min (n, it2_end_ - it2_); + size_type d = std_min (n, it2_end_ - it2_); it2_ += d; n -= d; if (n > 0 || (end_ == 0 && it2_ == it2_end_)) { BOOST_UBLAS_CHECK (end_ == 0, external_logic ()); - d = std::min (n, it1_end_ - it1_begin_); + d = std_min (n, it1_end_ - it1_begin_); it1_ = it1_begin_ + d; n -= d; current_ = 0; @@ -2231,23 +2232,23 @@ namespace boost { namespace numeric { namespace ublas { const_iterator2 &operator -= (difference_type n) { BOOST_UBLAS_CHECK (current_ == 0 || current_ == 1, internal_logic ()); if (current_ == 0) { - size_type d = std::min (n, it1_ - it1_begin_); + size_type d = std_min (n, it1_ - it1_begin_); it1_ -= d; n -= d; if (n > 0) { BOOST_UBLAS_CHECK (end_ == 1, external_logic ()); - d = std::min (n, it2_end_ - it2_begin_); + d = std_min (n, it2_end_ - it2_begin_); it2_ = it2_end_ - d; n -= d; current_ = 1; } } else /* if (current_ == 1) */ { - size_type d = std::min (n, it2_ - it2_begin_); + size_type d = std_min (n, it2_ - it2_begin_); it2_ -= d; n -= d; if (n > 0) { BOOST_UBLAS_CHECK (end_ == 0, external_logic ()); - d = std::min (n, it1_end_ - it1_begin_); + d = std_min (n, it1_end_ - it1_begin_); it1_ = it1_end_ - d; n -= d; current_ = 0; diff --git a/include/boost/numeric/ublas/lu.hpp b/include/boost/numeric/ublas/lu.hpp index 9de5ec84..07069d54 100644 --- a/include/boost/numeric/ublas/lu.hpp +++ b/include/boost/numeric/ublas/lu.hpp @@ -19,6 +19,8 @@ #ifndef BOOST_UBLAS_LU_H #define BOOST_UBLAS_LU_H +#include + namespace boost { namespace numeric { namespace ublas { template > @@ -90,7 +92,7 @@ namespace boost { namespace numeric { namespace ublas { int singular = 0; size_type size1 = m.size1 (); size_type size2 = m.size2 (); - size_type size = std::min (size1, size2); + size_type size = std_min (size1, size2); for (size_type i = 0; i < size; ++ i) { matrix_column mci (column (m, i)); matrix_row mri (row (m, i)); @@ -124,7 +126,7 @@ namespace boost { namespace numeric { namespace ublas { int singular = 0; size_type size1 = m.size1 (); size_type size2 = m.size2 (); - size_type size = std::min (size1, size2); + size_type size = std_min (size1, size2); for (size_type i = 0; i < size; ++ i) { matrix_column mci (column (m, i)); matrix_row mri (row (m, i)); @@ -167,7 +169,7 @@ namespace boost { namespace numeric { namespace ublas { int singular = 0; size_type size1 = m.size1 (); size_type size2 = m.size2 (); - size_type size = std::min (size1, size2); + size_type size = std_min (size1, size2); #ifndef BOOST_UBLAS_LU_WITH_INPLACE_SOLVE matrix_type mr (m); mr.assign (zero_matrix (size1, size2)); diff --git a/include/boost/numeric/ublas/matrix.hpp b/include/boost/numeric/ublas/matrix.hpp index aeb9c710..e90d00e1 100644 --- a/include/boost/numeric/ublas/matrix.hpp +++ b/include/boost/numeric/ublas/matrix.hpp @@ -23,6 +23,7 @@ #include #include #include +#include // Iterators based on ideas of Jeremy Siek @@ -2066,16 +2067,16 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE const_iterator1 find1 (int rank, size_type i, size_type j) const { if (rank == 1) { - i = std::max (i, j); - i = std::min (i, j + 1); + i = std_max (i, j); + i = std_min (i, j + 1); } return const_iterator1 (*this, i, j); } BOOST_UBLAS_INLINE const_iterator2 find2 (int rank, size_type i, size_type j) const { if (rank == 1) { - j = std::max (j, i); - j = std::min (j, i + 1); + j = std_max (j, i); + j = std_min (j, i + 1); } return const_iterator2 (*this, i, j); } diff --git a/include/boost/numeric/ublas/matrix_assign.hpp b/include/boost/numeric/ublas/matrix_assign.hpp index fea6931e..ee286dbc 100644 --- a/include/boost/numeric/ublas/matrix_assign.hpp +++ b/include/boost/numeric/ublas/matrix_assign.hpp @@ -19,6 +19,7 @@ #include #include +#include // Iterators based on ideas of Jeremy Siek @@ -37,7 +38,7 @@ namespace boost { namespace numeric { namespace ublas { #else // GCC 3.1, oops?! return norm_inf (e1 - e2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * - std::max (real_type (std::max (real_type (norm_inf (e1)), real_type (norm_inf (e2)))), + std_max (real_type (std_max (real_type (norm_inf (e1)), real_type (norm_inf (e2)))), real_type (BOOST_UBLAS_TYPE_CHECK_MIN)); #endif } @@ -534,13 +535,13 @@ namespace boost { namespace numeric { namespace ublas { if (it1_size > 0 && it1e_size > 0) diff1 = it1.index1 () - it1e.index1 (); if (diff1 != 0) { - difference_type size1 = std::min (diff1, it1e_size); + difference_type size1 = std_min (diff1, it1e_size); if (size1 > 0) { it1e += size1; it1e_size -= size1; diff1 -= size1; } - size1 = std::min (- diff1, it1_size); + size1 = std_min (- diff1, it1_size); if (size1 > 0) { it1_size -= size1; if (boost::is_same::value) { @@ -563,7 +564,7 @@ namespace boost { namespace numeric { namespace ublas { diff1 += size1; } } - difference_type size1 (std::min (it1_size, it1e_size)); + difference_type size1 (std_min (it1_size, it1e_size)); it1_size -= size1; it1e_size -= size1; while (-- size1 >= 0) { @@ -583,13 +584,13 @@ namespace boost { namespace numeric { namespace ublas { difference_type diff2 (0); if (it2_size > 0 && it2e_size > 0) { diff2 = it2.index2 () - it2e.index2 (); - difference_type size2 = std::min (diff2, it2e_size); + difference_type size2 = std_min (diff2, it2e_size); if (size2 > 0) { it2e += size2; it2e_size -= size2; diff2 -= size2; } - size2 = std::min (- diff2, it2_size); + size2 = std_min (- diff2, it2_size); if (size2 > 0) { it2_size -= size2; if (boost::is_same::value) { @@ -601,7 +602,7 @@ namespace boost { namespace numeric { namespace ublas { diff2 += size2; } } - difference_type size2 (std::min (it2_size, it2e_size)); + difference_type size2 (std_min (it2_size, it2e_size)); it2_size -= size2; it2e_size -= size2; while (-- size2 >= 0) @@ -669,13 +670,13 @@ namespace boost { namespace numeric { namespace ublas { if (it2_size > 0 && it2e_size > 0) diff2 = it2.index2 () - it2e.index2 (); if (diff2 != 0) { - difference_type size2 = std::min (diff2, it2e_size); + difference_type size2 = std_min (diff2, it2e_size); if (size2 > 0) { it2e += size2; it2e_size -= size2; diff2 -= size2; } - size2 = std::min (- diff2, it2_size); + size2 = std_min (- diff2, it2_size); if (size2 > 0) { it2_size -= size2; if (boost::is_same::value) { @@ -698,7 +699,7 @@ namespace boost { namespace numeric { namespace ublas { diff2 += size2; } } - difference_type size2 (std::min (it2_size, it2e_size)); + difference_type size2 (std_min (it2_size, it2e_size)); it2_size -= size2; it2e_size -= size2; while (-- size2 >= 0) { @@ -718,13 +719,13 @@ namespace boost { namespace numeric { namespace ublas { difference_type diff1 (0); if (it1_size > 0 && it1e_size > 0) { diff1 = it1.index1 () - it1e.index1 (); - difference_type size1 = std::min (diff1, it1e_size); + difference_type size1 = std_min (diff1, it1e_size); if (size1 > 0) { it1e += size1; it1e_size -= size1; diff1 -= size1; } - size1 = std::min (- diff1, it1_size); + size1 = std_min (- diff1, it1_size); if (size1 > 0) { it1_size -= size1; if (boost::is_same::value) { @@ -736,7 +737,7 @@ namespace boost { namespace numeric { namespace ublas { diff1 += size1; } } - difference_type size1 (std::min (it1_size, it1e_size)); + difference_type size1 (std_min (it1_size, it1e_size)); it1_size -= size1; it1e_size -= size1; while (-- size1 >= 0) diff --git a/include/boost/numeric/ublas/matrix_expression.hpp b/include/boost/numeric/ublas/matrix_expression.hpp index 33adb1fb..8e5d2b5f 100644 --- a/include/boost/numeric/ublas/matrix_expression.hpp +++ b/include/boost/numeric/ublas/matrix_expression.hpp @@ -21,6 +21,7 @@ #include #include #include +#include // Expression templates based on ideas of Todd Veldhuizen and Geoffrey Furnish // Iterators based on ideas of Jeremy Siek @@ -2114,7 +2115,7 @@ namespace boost { namespace numeric { namespace ublas { const_iterator21_type it21_end (e2_.find1 (rank, size1 (), j)); BOOST_UBLAS_CHECK (rank == 0 || it11 == it11_end || it11.index2 () == j, internal_logic ()) BOOST_UBLAS_CHECK (rank == 0 || it21 == it21_end || it21.index2 () == j, internal_logic ()) - i = std::min (it11 != it11_end ? it11.index1 () : size1 (), + i = std_min (it11 != it11_end ? it11.index1 () : size1 (), it21 != it21_end ? it21.index1 () : size1 ()); #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR return const_iterator1 (*this, i, j); @@ -2130,7 +2131,7 @@ namespace boost { namespace numeric { namespace ublas { const_iterator22_type it22_end (e2_.find2 (rank, i, size2 ())); BOOST_UBLAS_CHECK (rank == 0 || it12 == it12_end || it12.index1 () == i, internal_logic ()) BOOST_UBLAS_CHECK (rank == 0 || it22 == it22_end || it22.index1 () == i, internal_logic ()) - j = std::min (it12 != it12_end ? it12.index2 () : size2 (), + j = std_min (it12 != it12_end ? it12.index2 () : size2 (), it22 != it22_end ? it22.index2 () : size2 ()); #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR return const_iterator2 (*this, i, j); @@ -2247,7 +2248,7 @@ namespace boost { namespace numeric { namespace ublas { if (it2_ != it2_end_) { index2 = it2_.index1 (); } - i_ = std::min (index1, index2); + i_ = std_min (index1, index2); } BOOST_UBLAS_INLINE void decrement (sparse_bidirectional_iterator_tag) { @@ -2265,7 +2266,7 @@ namespace boost { namespace numeric { namespace ublas { if (it2_ != it2_end_) index2 = it2_.index1 (); } - i_ = std::max (index1, index2); + i_ = std_max (index1, index2); } BOOST_UBLAS_INLINE value_type dereference (sparse_bidirectional_iterator_tag) const { @@ -2513,7 +2514,7 @@ namespace boost { namespace numeric { namespace ublas { if (it2_ != it2_end_) index2 = it2_.index2 (); } - j_ = std::min (index1, index2); + j_ = std_min (index1, index2); } BOOST_UBLAS_INLINE void decrement (sparse_bidirectional_iterator_tag) { @@ -2531,7 +2532,7 @@ namespace boost { namespace numeric { namespace ublas { if (it2_ != it2_end_) index2 = it2_.index2 (); } - j_ = std::max (index1, index2); + j_ = std_max (index1, index2); } BOOST_UBLAS_INLINE value_type dereference (sparse_bidirectional_iterator_tag) const { diff --git a/include/boost/numeric/ublas/matrix_proxy.hpp b/include/boost/numeric/ublas/matrix_proxy.hpp index a636f0ca..78c90611 100644 --- a/include/boost/numeric/ublas/matrix_proxy.hpp +++ b/include/boost/numeric/ublas/matrix_proxy.hpp @@ -20,6 +20,7 @@ #include #include #include +#include // Iterators based on ideas of Jeremy Siek @@ -1880,7 +1881,7 @@ namespace boost { namespace numeric { namespace ublas { // One of the slices may be stationary. // Thanks to Michael Stevens for this extension. // return BOOST_UBLAS_SAME (it1_ - it.it1_, it2_ - it.it2_); - return std::max (it1_ - it.it1_, it2_ - it.it2_); + return std_max (it1_ - it.it1_, it2_ - it.it2_); } // Dereference @@ -1895,7 +1896,7 @@ namespace boost { namespace numeric { namespace ublas { // One of the slices may be stationary. // Thanks to Michael Stevens for this extension. // return BOOST_UBLAS_SAME (it1_.index (), it2_.index ()); - return std::max (it1_.index (), it2_.index ()); + return std_max (it1_.index (), it2_.index ()); } // Assignment @@ -1993,7 +1994,7 @@ namespace boost { namespace numeric { namespace ublas { // One of the slices may be stationary. // Thanks to Michael Stevens for this extension. // return BOOST_UBLAS_SAME (it1_ - it.it1_, it2_ - it.it2_); - return std::max (it1_ - it.it1_, it2_ - it.it2_); + return std_max (it1_ - it.it1_, it2_ - it.it2_); } // Dereference @@ -2008,7 +2009,7 @@ namespace boost { namespace numeric { namespace ublas { // One of the slices may be stationary. // Thanks to Michael Stevens for this extension. // return BOOST_UBLAS_SAME (it1_.index (), it2_.index ()); - return std::max (it1_.index (), it2_.index ()); + return std_max (it1_.index (), it2_.index ()); } // Assignment diff --git a/include/boost/numeric/ublas/matrix_sparse.hpp b/include/boost/numeric/ublas/matrix_sparse.hpp index 9c1eec8a..111e4e9a 100644 --- a/include/boost/numeric/ublas/matrix_sparse.hpp +++ b/include/boost/numeric/ublas/matrix_sparse.hpp @@ -21,6 +21,7 @@ #include #include #include +#include // Iterators based on ideas of Jeremy Siek @@ -380,10 +381,10 @@ namespace boost { namespace numeric { namespace ublas { void resize (size_type size1, size_type size2, size_type non_zeros = 0) { size1_ = size1; size2_ = size2; - non_zeros_ = std::max (non_zeros, std::min (size1_, size2_)); + non_zeros_ = std_max (non_zeros, std_min (size1_, size2_)); // Guarding against overflow. // Thanks to Alexei Novakov for the hint. - // non_zeros_ = std::min (non_zeros_, size1_ * size2_); + // non_zeros_ = std_min (non_zeros_, size1_ * size2_); if (size1_ > 0 && non_zeros_ / size1_ >= size2_) non_zeros_ = size1_ * size2_; detail::reserve (data (), non_zeros_); @@ -393,10 +394,10 @@ namespace boost { namespace numeric { namespace ublas { // Reserving BOOST_UBLAS_INLINE void reserve (size_type non_zeros = 0) { - non_zeros_ = std::max (non_zeros, std::min (size1_, size2_)); + non_zeros_ = std_max (non_zeros, std_min (size1_, size2_)); // Guarding against overflow. // Thanks to Alexei Novakov for the hint. - // non_zeros_ = std::min (non_zeros_, size1_ * size2_); + // non_zeros_ = std_min (non_zeros_, size1_ * size2_); if (size1_ > 0 && non_zeros_ / size1_ >= size2_) non_zeros_ = size1_ * size2_; detail::reserve (data (), non_zeros_); @@ -2698,10 +2699,10 @@ namespace boost { namespace numeric { namespace ublas { void resize (size_type size1, size_type size2, size_type non_zeros = 0, bool preserve = true) { size1_ = size1; size2_ = size2; - non_zeros_ = std::max (non_zeros, std::min (size1_, size2_)); + non_zeros_ = std_max (non_zeros, std_min (size1_, size2_)); // Guarding against overflow. // Thanks to Alexei Novakov for the hint. - // non_zeros_ = std::min (non_zeros_, size1_ * size2_); + // non_zeros_ = std_min (non_zeros_, size1_ * size2_); if (size1_ > 0 && non_zeros_ / size1_ >= size2_) non_zeros_ = size1_ * size2_; filled1_ = 1; @@ -2715,10 +2716,10 @@ namespace boost { namespace numeric { namespace ublas { // Reserving BOOST_UBLAS_INLINE void reserve (size_type non_zeros = 0, bool preserve = true) { - non_zeros_ = std::max (non_zeros, std::min (size1_, size2_)); + non_zeros_ = std_max (non_zeros, std_min (size1_, size2_)); // Guarding against overflow. // Thanks to Alexei Novakov for the hint. - // non_zeros_ = std::min (non_zeros_, size1_ * size2_); + // non_zeros_ = std_min (non_zeros_, size1_ * size2_); if (size1_ > 0 && non_zeros_ / size1_ >= size2_) non_zeros_ = size1_ * size2_; detail::resize (index2_data (), non_zeros_, preserve); @@ -3032,7 +3033,7 @@ namespace boost { namespace numeric { namespace ublas { for (;;) { size_type address1 (functor_type::address1 (i, size1_, j, size2_)); size_type address2 (functor_type::address2 (i, size1_, j, size2_)); - vector_const_iterator_type itv (index1_data ().begin () + std::min (filled1_ - 1, address1)); + vector_const_iterator_type itv (index1_data ().begin () + std_min (filled1_ - 1, address1)); if (filled1_ <= address1 + 1) return const_iterator1 (*this, rank, i, j, itv, index2_data ().begin () + filled2_); @@ -3069,7 +3070,7 @@ namespace boost { namespace numeric { namespace ublas { for (;;) { size_type address1 (functor_type::address1 (i, size1_, j, size2_)); size_type address2 (functor_type::address2 (i, size1_, j, size2_)); - vector_iterator_type itv (index1_data ().begin () + std::min (filled1_ - 1, address1)); + vector_iterator_type itv (index1_data ().begin () + std_min (filled1_ - 1, address1)); if (filled1_ <= address1 + 1) return iterator1 (*this, rank, i, j, itv, index2_data ().begin () + filled2_); @@ -3106,7 +3107,7 @@ namespace boost { namespace numeric { namespace ublas { for (;;) { size_type address1 (functor_type::address1 (i, size1_, j, size2_)); size_type address2 (functor_type::address2 (i, size1_, j, size2_)); - vector_const_iterator_type itv (index1_data ().begin () + std::min (filled1_ - 1, address1)); + vector_const_iterator_type itv (index1_data ().begin () + std_min (filled1_ - 1, address1)); if (filled1_ <= address1 + 1) return const_iterator2 (*this, rank, i, j, itv, index2_data ().begin () + filled2_); @@ -3143,7 +3144,7 @@ namespace boost { namespace numeric { namespace ublas { for (;;) { size_type address1 (functor_type::address1 (i, size1_, j, size2_)); size_type address2 (functor_type::address2 (i, size1_, j, size2_)); - vector_iterator_type itv (index1_data ().begin () + std::min (filled1_ - 1, address1)); + vector_iterator_type itv (index1_data ().begin () + std_min (filled1_ - 1, address1)); if (filled1_ <= address1 + 1) return iterator2 (*this, rank, i, j, itv, index2_data ().begin () + filled2_); @@ -4006,10 +4007,10 @@ namespace boost { namespace numeric { namespace ublas { void resize (size_type size1, size_type size2, size_type non_zeros = 0, bool preserve = true) { size1_ = size1; size2_ = size2; - non_zeros_ = std::max (non_zeros, std::min (size1_, size2_)); + non_zeros_ = std_max (non_zeros, std_min (size1_, size2_)); // Guarding against overflow. // Thanks to Alexei Novakov for the hint. - // non_zeros_ = std::min (non_zeros_, size1_ * size2_); + // non_zeros_ = std_min (non_zeros_, size1_ * size2_); // FIX: coordinate_vector may contain duplicate elements. // if (size1_ > 0 && non_zeros_ / size1_ >= size2_) // non_zeros_ = size1_ * size2_; @@ -4022,10 +4023,10 @@ namespace boost { namespace numeric { namespace ublas { // Reserving BOOST_UBLAS_INLINE void reserve (size_type non_zeros = 0, bool preserve = true) { - non_zeros_ = std::max (non_zeros, std::min (size1_, size2_)); + non_zeros_ = std_max (non_zeros, std_min (size1_, size2_)); // Guarding against overflow. // Thanks to Alexei Novakov for the hint. - // non_zeros_ = std::min (non_zeros_, size1_ * size2_); + // non_zeros_ = std_min (non_zeros_, size1_ * size2_); // FIX: coordinate_vector may contain duplicate elements. // if (size1_ > 0 && non_zeros_ / size1_ >= size2_) // non_zeros_ = size1_ * size2_; diff --git a/include/boost/numeric/ublas/operation_blocked.hpp b/include/boost/numeric/ublas/operation_blocked.hpp index f32726d2..9acc0007 100644 --- a/include/boost/numeric/ublas/operation_blocked.hpp +++ b/include/boost/numeric/ublas/operation_blocked.hpp @@ -17,6 +17,8 @@ #ifndef BOOST_UBLAS_OPERATION_BLOCKED_H #define BOOST_UBLAS_OPERATION_BLOCKED_H +#include + namespace boost { namespace numeric { namespace ublas { template @@ -39,7 +41,7 @@ namespace boost { namespace numeric { namespace ublas { size_type i_size = e1 ().size1 (); size_type j_size = BOOST_UBLAS_SAME (e1 ().size2 (), e2 ().size ()); for (size_type i_begin = 0; i_begin < i_size; i_begin += block_size) { - size_type i_end = i_begin + std::min (i_size - i_begin, block_size); + size_type i_end = i_begin + std_min (i_size - i_begin, block_size); // FIX: never ignore Martin Weiser's advice ;-( #ifdef BOOST_UBLAS_NO_CACHE vector_range v_range (v, range (i_begin, i_end)); @@ -49,7 +51,7 @@ namespace boost { namespace numeric { namespace ublas { #endif v_range.assign (zero_vector (i_end - i_begin)); for (size_type j_begin = 0; j_begin < j_size; j_begin += block_size) { - size_type j_end = j_begin + std::min (j_size - j_begin, block_size); + size_type j_end = j_begin + std_min (j_size - j_begin, block_size); #ifdef BOOST_UBLAS_NO_CACHE const matrix_range e1_range (e1 (), range (i_begin, i_end), range (j_begin, j_end)); const vector_range e2_range (e2 (), range (j_begin, j_end)); @@ -92,7 +94,7 @@ namespace boost { namespace numeric { namespace ublas { size_type i_size = BOOST_UBLAS_SAME (e1 ().size (), e2 ().size1 ()); size_type j_size = e2 ().size2 (); for (size_type j_begin = 0; j_begin < j_size; j_begin += block_size) { - size_type j_end = j_begin + std::min (j_size - j_begin, block_size); + size_type j_end = j_begin + std_min (j_size - j_begin, block_size); // FIX: never ignore Martin Weiser's advice ;-( #ifdef BOOST_UBLAS_NO_CACHE vector_range v_range (v, range (j_begin, j_end)); @@ -102,7 +104,7 @@ namespace boost { namespace numeric { namespace ublas { #endif v_range.assign (zero_vector (j_end - j_begin)); for (size_type i_begin = 0; i_begin < i_size; i_begin += block_size) { - size_type i_end = i_begin + std::min (i_size - i_begin, block_size); + size_type i_end = i_begin + std_min (i_size - i_begin, block_size); #ifdef BOOST_UBLAS_NO_CACHE const vector_range e1_range (e1 (), range (i_begin, i_end)); const matrix_range e2_range (e2 (), range (i_begin, i_end), range (j_begin, j_end)); @@ -147,9 +149,9 @@ namespace boost { namespace numeric { namespace ublas { size_type j_size = e2 ().size2 (); size_type k_size = BOOST_UBLAS_SAME (e1 ().size2 (), e2 ().size1 ()); for (size_type i_begin = 0; i_begin < i_size; i_begin += block_size) { - size_type i_end = i_begin + std::min (i_size - i_begin, block_size); + size_type i_end = i_begin + std_min (i_size - i_begin, block_size); for (size_type j_begin = 0; j_begin < j_size; j_begin += block_size) { - size_type j_end = j_begin + std::min (j_size - j_begin, block_size); + size_type j_end = j_begin + std_min (j_size - j_begin, block_size); // FIX: never ignore Martin Weiser's advice ;-( #ifdef BOOST_UBLAS_NO_CACHE matrix_range m_range (m, range (i_begin, i_end), range (j_begin, j_end)); @@ -159,7 +161,7 @@ namespace boost { namespace numeric { namespace ublas { #endif m_range.assign (zero_matrix (i_end - i_begin, j_end - j_begin)); for (size_type k_begin = 0; k_begin < k_size; k_begin += block_size) { - size_type k_end = k_begin + std::min (k_size - k_begin, block_size); + size_type k_end = k_begin + std_min (k_size - k_begin, block_size); #ifdef BOOST_UBLAS_NO_CACHE const matrix_range e1_range (e1 (), range (i_begin, i_end), range (k_begin, k_end)); const matrix_range e2_range (e2 (), range (k_begin, k_end), range (j_begin, j_end)); @@ -206,9 +208,9 @@ namespace boost { namespace numeric { namespace ublas { size_type j_size = e2 ().size2 (); size_type k_size = BOOST_UBLAS_SAME (e1 ().size2 (), e2 ().size1 ()); for (size_type j_begin = 0; j_begin < j_size; j_begin += block_size) { - size_type j_end = j_begin + std::min (j_size - j_begin, block_size); + size_type j_end = j_begin + std_min (j_size - j_begin, block_size); for (size_type i_begin = 0; i_begin < i_size; i_begin += block_size) { - size_type i_end = i_begin + std::min (i_size - i_begin, block_size); + size_type i_end = i_begin + std_min (i_size - i_begin, block_size); // FIX: never ignore Martin Weiser's advice ;-( #ifdef BOOST_UBLAS_NO_CACHE matrix_range m_range (m, range (i_begin, i_end), range (j_begin, j_end)); @@ -218,7 +220,7 @@ namespace boost { namespace numeric { namespace ublas { #endif m_range.assign (zero_matrix (i_end - i_begin, j_end - j_begin)); for (size_type k_begin = 0; k_begin < k_size; k_begin += block_size) { - size_type k_end = k_begin + std::min (k_size - k_begin, block_size); + size_type k_end = k_begin + std_min (k_size - k_begin, block_size); #ifdef BOOST_UBLAS_NO_CACHE const matrix_range e1_range (e1 (), range (i_begin, i_end), range (k_begin, k_end)); const matrix_range e2_range (e2 (), range (k_begin, k_end), range (j_begin, j_end)); diff --git a/include/boost/numeric/ublas/operation_sparse.hpp b/include/boost/numeric/ublas/operation_sparse.hpp index 06b23157..5aa624df 100644 --- a/include/boost/numeric/ublas/operation_sparse.hpp +++ b/include/boost/numeric/ublas/operation_sparse.hpp @@ -17,6 +17,8 @@ #ifndef BOOST_UBLAS_OPERATION_SPARSE_H #define BOOST_UBLAS_OPERATION_SPARSE_H +#include + // These scaled additions were borrowed from MTL unashamedly. // But Alexei Novakov had a lot of ideas to improve these. Thanks. @@ -60,8 +62,8 @@ namespace boost { namespace numeric { namespace ublas { while (itr != itr_end) { size_type j (itr.index ()); temporary (j) += *it2 * *itr; - jb = std::min (jb, j); - je = std::max (je, j); + jb = std_min (jb, j); + je = std_max (je, j); ++ itr; } ++ it2; @@ -123,8 +125,8 @@ namespace boost { namespace numeric { namespace ublas { while (itc != itc_end) { size_type i (itc.index ()); temporary (i) += *it1 * *itc; - ib = std::min (ib, i); - ie = std::max (ie, i); + ib = std_min (ib, i); + ie = std_max (ie, i); ++ itc; } ++ it1; diff --git a/include/boost/numeric/ublas/storage.hpp b/include/boost/numeric/ublas/storage.hpp index f8ab8995..aacd0334 100644 --- a/include/boost/numeric/ublas/storage.hpp +++ b/include/boost/numeric/ublas/storage.hpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace boost { namespace numeric { namespace ublas { @@ -39,7 +40,7 @@ namespace boost { namespace numeric { namespace ublas { // BOOST_UBLAS_INLINE // const T &same_impl (const T &size1, const T &size2) { // BOOST_UBLAS_CHECK (size1 == size2, bad_argument ()); -// return std::min (size1, size2); +// return std_min (size1, size2); // } // #define BOOST_UBLAS_SAME(size1, size2) same_impl ((size1), (size2)) template @@ -49,7 +50,7 @@ namespace boost { namespace numeric { namespace ublas { // const T &same_impl_ex (const T &size1, const T &size2, const char *file, int line) { T same_impl_ex (const T &size1, const T &size2, const char *file, int line) { BOOST_UBLAS_CHECK_EX (size1 == size2, file, line, bad_argument ()); - return std::min (size1, size2); + return std_min (size1, size2); } #define BOOST_UBLAS_SAME(size1, size2) same_impl_ex ((size1), (size2), __FILE__, __LINE__) #else @@ -136,8 +137,8 @@ namespace boost { namespace numeric { namespace ublas { // if (! data_) // throw std::bad_alloc (); if (preserve) { - std::copy (data_, data_ + std::min (size, size_), data); - std::fill (data + std::min (size, size_), data + size, value_type ()); + std::copy (data_, data_ + std_min (size, size_), data); + std::fill (data + std_min (size, size_), data + size, value_type ()); } delete [] data_; size_ = size; @@ -358,7 +359,7 @@ namespace boost { namespace numeric { namespace ublas { // throw std::bad_alloc (); bad_size ().raise (); if (preserve) - std::fill (data_ + std::min (size, size_), data_ + size, value_type ()); + std::fill (data_ + std_min (size, size_), data_ + size, value_type ()); size_ = size; } @@ -408,7 +409,7 @@ namespace boost { namespace numeric { namespace ublas { // Precondition for container relaxed as requested during review. // BOOST_UBLAS_CHECK (size_ == a.size_, bad_size ()); std::swap (size_, a.size_); - std::swap_ranges (data_, data_ + std::max (size_, a.size_), a.data_); + std::swap_ranges (data_, data_ + std_max (size_, a.size_), a.data_); } } #ifndef BOOST_UBLAS_NO_MEMBER_FRIENDS @@ -596,8 +597,8 @@ namespace boost { namespace numeric { namespace ublas { // if (! data_) // throw std::bad_alloc (); if (preserve) { - std::copy (data_, data_ + std::min (size, size_), data); - std::fill (data + std::min (size, size_), data + size, value_type ()); + std::copy (data_, data_ + std_min (size, size_), data); + std::fill (data + std_min (size, size_), data + size, value_type ()); } if (own_) delete [] data_; @@ -612,8 +613,8 @@ namespace boost { namespace numeric { namespace ublas { // if (! data_) // throw std::bad_alloc (); if (preserve) { - std::copy (data_, data_ + std::min (size, size_), data); - std::fill (data + std::min (size, size_), data + size, value_type ()); + std::copy (data_, data_ + std_min (size, size_), data); + std::fill (data + std_min (size, size_), data + size, value_type ()); } if (own_) delete [] data_; @@ -862,8 +863,8 @@ namespace boost { namespace numeric { namespace ublas { // if (! data_.get ()) // throw std::bad_alloc (); if (preserve) { - std::copy (data_.get (), data_.get () + std::min (size, size_), data.get ()); - std::fill (data.get () + std::min (size, size_), data.get () + size, value_type ()); + std::copy (data_.get (), data_.get () + std_min (size, size_), data.get ()); + std::fill (data.get () + std_min (size, size_), data.get () + size, value_type ()); } size_ = size; data_ = data; @@ -875,8 +876,8 @@ namespace boost { namespace numeric { namespace ublas { // if (! data_.get ()) // throw std::bad_alloc (); if (preserve) { - std::copy (data_.get (), data_.get () + std::min (size, size_), data); - std::fill (data + std::min (size, size_), data + size, value_type ()); + std::copy (data_.get (), data_.get () + std_min (size, size_), data); + std::fill (data + std_min (size, size_), data + size, value_type ()); } size_ = size; data_ = data; diff --git a/include/boost/numeric/ublas/storage_sparse.hpp b/include/boost/numeric/ublas/storage_sparse.hpp index d125c384..5e468bc9 100644 --- a/include/boost/numeric/ublas/storage_sparse.hpp +++ b/include/boost/numeric/ublas/storage_sparse.hpp @@ -25,6 +25,7 @@ #include #include #include +#include namespace boost { namespace numeric { namespace ublas { @@ -350,8 +351,8 @@ namespace boost { namespace numeric { namespace ublas { // throw std::bad_alloc (); // if (! data_) // throw std::bad_alloc (); - std::copy (data_, data_ + std::min (size, size_), data); - std::fill (data + std::min (size, size_), data + size, value_type ()); + std::copy (data_, data_ + std_min (size, size_), data); + std::fill (data + std_min (size, size_), data + size, value_type ()); delete [] data_; capacity_ = size << 1; data_ = data; @@ -760,8 +761,8 @@ namespace boost { namespace numeric { namespace ublas { // throw std::bad_alloc (); // if (! data_) // throw std::bad_alloc (); - std::copy (data_, data_ + std::min (size, size_), data); - std::fill (data + std::min (size, size_), data + size, value_type ()); + std::copy (data_, data_ + std_min (size, size_), data); + std::fill (data + std_min (size, size_), data + size, value_type ()); delete [] data_; capacity_ = size << 1; data_ = data; diff --git a/include/boost/numeric/ublas/symmetric.hpp b/include/boost/numeric/ublas/symmetric.hpp index 7855c766..59c19d28 100644 --- a/include/boost/numeric/ublas/symmetric.hpp +++ b/include/boost/numeric/ublas/symmetric.hpp @@ -20,6 +20,7 @@ #include #include #include +#include // Iterators based on ideas of Jeremy Siek // Symmetric matrices are square. Thanks to Peter Schmitteckert for spotting this. @@ -1380,23 +1381,23 @@ namespace boost { namespace numeric { namespace ublas { const_iterator1 &operator += (difference_type n) { BOOST_UBLAS_CHECK (current_ == 0 || current_ == 1, internal_logic ()); if (current_ == 0) { - size_type d = std::min (n, it1_end_ - it1_); + size_type d = std_min (n, it1_end_ - it1_); it1_ += d; n -= d; if (n > 0 || (end_ == 1 && it1_ == it1_end_)) { BOOST_UBLAS_CHECK (end_ == 1, external_logic ()); - d = std::min (n, it2_end_ - it2_begin_); + d = std_min (n, it2_end_ - it2_begin_); it2_ = it2_begin_ + d; n -= d; current_ = 1; } } else /* if (current_ == 1) */ { - size_type d = std::min (n, it2_end_ - it2_); + size_type d = std_min (n, it2_end_ - it2_); it2_ += d; n -= d; if (n > 0 || (end_ == 0 && it2_ == it2_end_)) { BOOST_UBLAS_CHECK (end_ == 0, external_logic ()); - d = std::min (n, it1_end_ - it1_begin_); + d = std_min (n, it1_end_ - it1_begin_); it1_ = it1_begin_ + d; n -= d; current_ = 0; @@ -1409,23 +1410,23 @@ namespace boost { namespace numeric { namespace ublas { const_iterator1 &operator -= (difference_type n) { BOOST_UBLAS_CHECK (current_ == 0 || current_ == 1, internal_logic ()); if (current_ == 0) { - size_type d = std::min (n, it1_ - it1_begin_); + size_type d = std_min (n, it1_ - it1_begin_); it1_ -= d; n -= d; if (n > 0) { BOOST_UBLAS_CHECK (end_ == 1, external_logic ()); - d = std::min (n, it2_end_ - it2_begin_); + d = std_min (n, it2_end_ - it2_begin_); it2_ = it2_end_ - d; n -= d; current_ = 1; } } else /* if (current_ == 1) */ { - size_type d = std::min (n, it2_ - it2_begin_); + size_type d = std_min (n, it2_ - it2_begin_); it2_ -= d; n -= d; if (n > 0) { BOOST_UBLAS_CHECK (end_ == 0, external_logic ()); - d = std::min (n, it1_end_ - it1_begin_); + d = std_min (n, it1_end_ - it1_begin_); it1_ = it1_end_ - d; n -= d; current_ = 0; @@ -1827,23 +1828,23 @@ namespace boost { namespace numeric { namespace ublas { const_iterator2 &operator += (difference_type n) { BOOST_UBLAS_CHECK (current_ == 0 || current_ == 1, internal_logic ()); if (current_ == 0) { - size_type d = std::min (n, it1_end_ - it1_); + size_type d = std_min (n, it1_end_ - it1_); it1_ += d; n -= d; if (n > 0 || (end_ == 1 && it1_ == it1_end_)) { BOOST_UBLAS_CHECK (end_ == 1, external_logic ()); - d = std::min (n, it2_end_ - it2_begin_); + d = std_min (n, it2_end_ - it2_begin_); it2_ = it2_begin_ + d; n -= d; current_ = 1; } } else /* if (current_ == 1) */ { - size_type d = std::min (n, it2_end_ - it2_); + size_type d = std_min (n, it2_end_ - it2_); it2_ += d; n -= d; if (n > 0 || (end_ == 0 && it2_ == it2_end_)) { BOOST_UBLAS_CHECK (end_ == 0, external_logic ()); - d = std::min (n, it1_end_ - it1_begin_); + d = std_min (n, it1_end_ - it1_begin_); it1_ = it1_begin_ + d; n -= d; current_ = 0; @@ -1856,23 +1857,23 @@ namespace boost { namespace numeric { namespace ublas { const_iterator2 &operator -= (difference_type n) { BOOST_UBLAS_CHECK (current_ == 0 || current_ == 1, internal_logic ()); if (current_ == 0) { - size_type d = std::min (n, it1_ - it1_begin_); + size_type d = std_min (n, it1_ - it1_begin_); it1_ -= d; n -= d; if (n > 0) { BOOST_UBLAS_CHECK (end_ == 1, external_logic ()); - d = std::min (n, it2_end_ - it2_begin_); + d = std_min (n, it2_end_ - it2_begin_); it2_ = it2_end_ - d; n -= d; current_ = 1; } } else /* if (current_ == 1) */ { - size_type d = std::min (n, it2_ - it2_begin_); + size_type d = std_min (n, it2_ - it2_begin_); it2_ -= d; n -= d; if (n > 0) { BOOST_UBLAS_CHECK (end_ == 0, external_logic ()); - d = std::min (n, it1_end_ - it1_begin_); + d = std_min (n, it1_end_ - it1_begin_); it1_ = it1_end_ - d; n -= d; current_ = 0; diff --git a/include/boost/numeric/ublas/traits.hpp b/include/boost/numeric/ublas/traits.hpp index e4510efe..f5dc0ce0 100644 --- a/include/boost/numeric/ublas/traits.hpp +++ b/include/boost/numeric/ublas/traits.hpp @@ -22,6 +22,7 @@ #include #include +#include // Promote traits borrowed from Todd Veldhuizen @@ -87,7 +88,7 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { // Oops, should have known that! - return std::max (type_traits::abs (self_type::real (t)), + return std_max (type_traits::abs (self_type::real (t)), type_traits::abs (self_type::imag (t))); } @@ -95,7 +96,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -172,7 +173,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -252,7 +253,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -329,7 +330,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -394,7 +395,7 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { // Oops, should have known that! - return std::max (type_traits::abs (self_type::real (t)), + return std_max (type_traits::abs (self_type::real (t)), type_traits::abs (self_type::imag (t))); } @@ -402,7 +403,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -469,7 +470,7 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { // Oops, should have known that! - return std::max (type_traits::abs (self_type::real (t)), + return std_max (type_traits::abs (self_type::real (t)), type_traits::abs (self_type::imag (t))); } @@ -477,7 +478,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -541,7 +542,7 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { // Oops, should have known that! - return std::max (type_traits::abs (self_type::real (t)), + return std_max (type_traits::abs (self_type::real (t)), type_traits::abs (self_type::imag (t))); } @@ -549,7 +550,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -616,7 +617,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -684,7 +685,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -749,7 +750,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -815,7 +816,7 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { // Oops, should have known that! - return std::max (type_traits::abs (self_type::real (t)), + return std_max (type_traits::abs (self_type::real (t)), type_traits::abs (self_type::imag (t))); } @@ -823,7 +824,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -890,7 +891,7 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { // Oops, should have known that! - return std::max (type_traits::abs (self_type::real (t)), + return std_max (type_traits::abs (self_type::real (t)), type_traits::abs (self_type::imag (t))); } @@ -898,7 +899,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } @@ -962,7 +963,7 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { // Oops, should have known that! - return std::max (type_traits::abs (self_type::real (t)), + return std_max (type_traits::abs (self_type::real (t)), type_traits::abs (self_type::imag (t))); } @@ -970,7 +971,7 @@ namespace boost { namespace numeric { namespace ublas { 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), + std_max (std_max (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } diff --git a/include/boost/numeric/ublas/vector.hpp b/include/boost/numeric/ublas/vector.hpp index d06fae7b..0eaa1bf8 100644 --- a/include/boost/numeric/ublas/vector.hpp +++ b/include/boost/numeric/ublas/vector.hpp @@ -22,6 +22,7 @@ #include #include #include +#include // Iterators based on ideas of Jeremy Siek @@ -670,8 +671,8 @@ namespace boost { namespace numeric { namespace ublas { // Element lookup BOOST_UBLAS_INLINE const_iterator find (size_type i) const { - i = std::max (i, index_); - i = std::min (i, index_ + 1); + i = std_max (i, index_); + i = std_min (i, index_ + 1); return const_iterator (*this, i); } diff --git a/include/boost/numeric/ublas/vector_assign.hpp b/include/boost/numeric/ublas/vector_assign.hpp index b8821011..36471f15 100644 --- a/include/boost/numeric/ublas/vector_assign.hpp +++ b/include/boost/numeric/ublas/vector_assign.hpp @@ -19,6 +19,7 @@ #include #include +#include // Iterators based on ideas of Jeremy Siek @@ -37,7 +38,7 @@ namespace boost { namespace numeric { namespace ublas { #else // GCC 3.1, oops?! return norm_inf (e1 - e2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * - std::max (real_type (std::max (real_type (norm_inf (e1)), real_type (norm_inf (e2)))), + std_max (real_type (std_max (real_type (norm_inf (e1)), real_type (norm_inf (e2)))), real_type (BOOST_UBLAS_TYPE_CHECK_MIN)); #endif } @@ -299,14 +300,14 @@ namespace boost { namespace numeric { namespace ublas { difference_type it_size (it_end - it); difference_type ite_size (ite_end - ite); if (it_size > 0 && ite_size > 0) { - difference_type size (std::min (difference_type (it.index () - ite.index ()), ite_size)); + difference_type size (std_min (difference_type (it.index () - ite.index ()), ite_size)); if (size > 0) { ite += size; ite_size -= size; } } if (it_size > 0 && ite_size > 0) { - difference_type size (std::min (difference_type (ite.index () - it.index ()), it_size)); + difference_type size (std_min (difference_type (ite.index () - it.index ()), it_size)); if (size > 0) { it_size -= size; if (boost::is_same::value) { @@ -317,7 +318,7 @@ namespace boost { namespace numeric { namespace ublas { } } } - difference_type size (std::min (it_size, ite_size)); + difference_type size (std_min (it_size, ite_size)); it_size -= size; ite_size -= size; while (-- size >= 0) @@ -504,18 +505,18 @@ namespace boost { namespace numeric { namespace ublas { difference_type it_size (it_end - it); difference_type ite_size (ite_end - ite); if (it_size > 0 && ite_size > 0) { - difference_type size (std::min (difference_type (it.index () - ite.index ()), ite_size)); + difference_type size (std_min (difference_type (it.index () - ite.index ()), ite_size)); if (size > 0) { ite += size; ite_size -= size; } } if (it_size > 0 && ite_size > 0) { - difference_type size (std::min (difference_type (ite.index () - it.index ()), it_size)); + difference_type size (std_min (difference_type (ite.index () - it.index ()), it_size)); if (size > 0) it_size -= size; } - difference_type size (std::min (it_size, ite_size)); + difference_type size (std_min (it_size, ite_size)); it_size -= size; ite_size -= size; while (-- size >= 0) diff --git a/include/boost/numeric/ublas/vector_expression.hpp b/include/boost/numeric/ublas/vector_expression.hpp index f409f4f0..3b5028a7 100644 --- a/include/boost/numeric/ublas/vector_expression.hpp +++ b/include/boost/numeric/ublas/vector_expression.hpp @@ -21,6 +21,7 @@ #include #include #include +#include // Expression templates based on ideas of Todd Veldhuizen and Geoffrey Furnish // Iterators based on ideas of Jeremy Siek @@ -863,7 +864,7 @@ namespace boost { namespace numeric { namespace ublas { const_iterator1_type it1_end (e1_.find (size ())); const_iterator2_type it2 (e2_.find (i)); const_iterator2_type it2_end (e2_.find (size ())); - i = std::min (it1 != it1_end ? it1.index () : size (), + i = std_min (it1 != it1_end ? it1.index () : size (), it2 != it2_end ? it2.index () : size ()); #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR return const_iterator (*this, i); @@ -974,7 +975,7 @@ namespace boost { namespace numeric { namespace ublas { if (it2_ != it2_end_) index2 = it2_.index (); } - i_ = std::min (index1, index2); + i_ = std_min (index1, index2); } BOOST_UBLAS_INLINE void decrement (sparse_bidirectional_iterator_tag) { @@ -992,7 +993,7 @@ namespace boost { namespace numeric { namespace ublas { if (it2_ != it2_end_) index2 = it2_.index (); } - i_ = std::max (index1, index2); + i_ = std_max (index1, index2); } BOOST_UBLAS_INLINE value_type dereference (sparse_bidirectional_iterator_tag) const { diff --git a/include/boost/numeric/ublas/vector_sparse.hpp b/include/boost/numeric/ublas/vector_sparse.hpp index b754209a..4764ecc2 100644 --- a/include/boost/numeric/ublas/vector_sparse.hpp +++ b/include/boost/numeric/ublas/vector_sparse.hpp @@ -20,6 +20,7 @@ #include #include #include +#include // Iterators based on ideas of Jeremy Siek @@ -371,8 +372,8 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE void resize (size_type size, size_type non_zeros = 0) { size_ = size; - non_zeros_ = std::max (non_zeros, size_type (1)); - non_zeros_ = std::min (non_zeros_, size_); + non_zeros_ = std_max (non_zeros, size_type (1)); + non_zeros_ = std_min (non_zeros_, size_); detail::reserve (data (), non_zeros_); data ().clear (); } @@ -380,8 +381,8 @@ namespace boost { namespace numeric { namespace ublas { // Reserving BOOST_UBLAS_INLINE void reserve (size_type non_zeros = 0) { - non_zeros_ = std::max (non_zeros, size_type (1)); - non_zeros_ = std::min (non_zeros_, size_); + non_zeros_ = std_max (non_zeros, size_type (1)); + non_zeros_ = std_min (non_zeros_, size_); detail::reserve (data (), non_zeros_); } @@ -882,8 +883,8 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE void resize (size_type size, size_type non_zeros = 0, bool preserve = true) { size_ = size; - non_zeros_ = std::max (non_zeros, size_type (1)); - non_zeros_ = std::min (non_zeros_, size_); + non_zeros_ = std_max (non_zeros, size_type (1)); + non_zeros_ = std_min (non_zeros_, size_); filled_ = 0; detail::resize (index_data (), non_zeros_, preserve); detail::resize (value_data (), non_zeros_, preserve); @@ -892,8 +893,8 @@ namespace boost { namespace numeric { namespace ublas { // Reserving BOOST_UBLAS_INLINE void reserve (size_type non_zeros = 0, bool preserve = true) { - non_zeros_ = std::max (non_zeros, size_type (1)); - non_zeros_ = std::min (non_zeros_, size_); + non_zeros_ = std_max (non_zeros, size_type (1)); + non_zeros_ = std_min (non_zeros_, size_); detail::resize (index_data (), non_zeros_, preserve); detail::resize (value_data (), non_zeros_, preserve); } @@ -1451,9 +1452,9 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE void resize (size_type size, size_type non_zeros = 0, bool preserve = true) { size_ = size; - non_zeros_ = std::max (non_zeros, size_type (1)); + non_zeros_ = std_max (non_zeros, size_type (1)); // FIX: coordinate_vector may contain duplicate elements. - // non_zeros_ = std::min (non_zeros_, size_); + // non_zeros_ = std_min (non_zeros_, size_); filled_ = 0; detail::resize (index_data (), non_zeros_, preserve); detail::resize (value_data (), non_zeros_, preserve); @@ -1462,9 +1463,9 @@ namespace boost { namespace numeric { namespace ublas { // Reserving BOOST_UBLAS_INLINE void reserve (size_type non_zeros = 0, bool preserve = true) { - non_zeros_ = std::max (non_zeros, size_type (1)); + non_zeros_ = std_max (non_zeros, size_type (1)); // FIX: coordinate_vector may contain duplicate elements. - // non_zeros_ = std::min (non_zeros_, size_); + // non_zeros_ = std_min (non_zeros_, size_); detail::resize (index_data (), non_zeros_, preserve); detail::resize (value_data (), non_zeros_, preserve); } diff --git a/test4/test4.hpp b/test4/test4.hpp index 98d465db..1337ef32 100644 --- a/test4/test4.hpp +++ b/test4/test4.hpp @@ -17,6 +17,8 @@ #ifndef TEST4_H #define TEST4_H +#include + #define USE_BANDED // #define USE_DIAGONAL @@ -35,10 +37,10 @@ void initialize_matrix (M &m) { int size2 = m.size2 (); for (int i = 0; i < size1; ++ i) #ifdef USE_BANDED - for (int j = std::max (i - 1, 0); j < std::min (i + 2, size2); ++ j) + for (int j = boost::std_max (i - 1, 0); j < boost::std_min (i + 2, size2); ++ j) #endif #ifdef USE_DIAGONAL - for (int j = std::max (i, 0); j < std::min (i + 1, size2); ++ j) + for (int j = boost::std_max (i, 0); j < boost::std_min (i + 1, size2); ++ j) #endif m (i, j) = i * size1 + j + 1.f; }