From 2584816207a7610a9938da10ea7577460abca367 Mon Sep 17 00:00:00 2001 From: Gunter Winkler Date: Mon, 10 Sep 2012 21:38:11 +0000 Subject: [PATCH] * boost/numeric/ublas/matrix_sparse.hpp: see #7363, add new define BOOST_UBLAS_COO_ALWAYS_DO_FULL_SORT in order to force a full sort instead of partial sort + inplace merge * libs/numeric/ublas/test/Jamfile.v2: add test to see effect of new define --- include/boost/numeric/ublas/matrix_sparse.hpp | 6 +++++- test/Jamfile.v2 | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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