From f87cebe293a4b69a60426ca7d9feba89948bf725 Mon Sep 17 00:00:00 2001 From: Gunter Winkler Date: Tue, 18 Sep 2012 21:40:05 +0000 Subject: [PATCH] * boost/numeric/ublas/vector_sparse.hpp: add ifdef BOOST_UBLAS_COO_ALWAYS_DO_FULL_SORT to coordinate_vector::sort() (similar to coordinate_matrix::sort()), see #7363 * libs/numeric/ublas/test/Jamfile.v2: use COO_ALWAYS_DO_FULL_SORT in test_assign because we do not want to test performance here svn path=/trunk/libs/numeric/ublas/; revision=80591 --- include/boost/numeric/ublas/vector_sparse.hpp | 5 +++++ test/Jamfile.v2 | 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/boost/numeric/ublas/vector_sparse.hpp b/include/boost/numeric/ublas/vector_sparse.hpp index 99dcbcec..8144bb93 100644 --- a/include/boost/numeric/ublas/vector_sparse.hpp +++ b/include/boost/numeric/ublas/vector_sparse.hpp @@ -1807,10 +1807,15 @@ namespace boost { namespace numeric { namespace ublas { if (! sorted_ && filled_ > 0) { typedef index_pair_array array_pair; array_pair ipa (filled_, index_data_, value_data_); +#ifndef BOOST_UBLAS_COO_ALWAYS_DO_FULL_SORT const typename array_pair::iterator iunsorted = ipa.begin () + sorted_filled_; // sort new elements and merge std::sort (iunsorted, ipa.end ()); std::inplace_merge (ipa.begin (), iunsorted, ipa.end ()); +#else + const typename array_pair::iterator iunsorted = ipa.begin (); + std::sort (iunsorted, ipa.end ()); +#endif // sum duplicates with += and remove size_type filled = 0; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 514334f0..f0d7d997 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -170,6 +170,8 @@ test-suite numeric/uBLAS [ run test_complex_norms.cpp ] [ run test_assignment.cpp + : : : BOOST_UBLAS_COO_ALWAYS_DO_FULL_SORT + : : ] [ run test_triangular.cpp ]