2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-21 15:32:12 +00:00

* 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
This commit is contained in:
Gunter Winkler
2012-09-10 21:38:11 +00:00
parent 1d0af622ab
commit 2584816207
2 changed files with 12 additions and 1 deletions

View File

@@ -4397,11 +4397,15 @@ namespace boost { namespace numeric { namespace ublas {
if (! sorted_ && filled_ > 0) {
typedef index_triple_array<index_array_type, index_array_type, value_array_type> 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) {

View File

@@ -152,6 +152,13 @@ test-suite numeric/uBLAS
]
[ run test_coordinate_matrix_sort.cpp
]
[ run test_coordinate_matrix_sort.cpp
:
:
: <define>BOOST_UBLAS_COO_ALWAYS_DO_FULL_SORT
: test_coordinate_matrix_always_do_full_sort
:
]
[ run test_complex_norms.cpp
]
[ run test_assignment.cpp