diff --git a/include/boost/numeric/ublas/matrix_sparse.hpp b/include/boost/numeric/ublas/matrix_sparse.hpp index b395a529..a9d90145 100644 --- a/include/boost/numeric/ublas/matrix_sparse.hpp +++ b/include/boost/numeric/ublas/matrix_sparse.hpp @@ -4397,11 +4397,15 @@ namespace boost { namespace numeric { namespace ublas { if (! sorted_ && filled_ > 0) { typedef index_triple_array array_triple; array_triple ita (filled_, index1_data_, index2_data_, value_data_); +#ifndef BOOST_UBLAS_COO_ALWAYS_DO_FULL_SORT const typename array_triple::iterator iunsorted = ita.begin () + sorted_filled_; // sort new elements and merge std::sort (iunsorted, ita.end ()); std::inplace_merge (ita.begin (), iunsorted, ita.end ()); - +#else + const typename array_triple::iterator iunsorted = ita.begin (); + std::sort (iunsorted, ita.end ()); +#endif // sum duplicates with += and remove array_size_type filled = 0; for (array_size_type i = 1; i < filled_; ++ i) { diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 423d1999..c94dd6de 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -152,6 +152,13 @@ test-suite numeric/uBLAS ] [ run test_coordinate_matrix_sort.cpp ] + [ run test_coordinate_matrix_sort.cpp + : + : + : BOOST_UBLAS_COO_ALWAYS_DO_FULL_SORT + : test_coordinate_matrix_always_do_full_sort + : + ] [ run test_complex_norms.cpp ] [ run test_assignment.cpp