Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80591 - in trunk: boost/numeric/ublas libs/numeric/ublas/test
From: guwi17_at_[hidden]
Date: 2012-09-18 17:40:05


Author: guwi17
Date: 2012-09-18 17:40:05 EDT (Tue, 18 Sep 2012)
New Revision: 80591
URL: http://svn.boost.org/trac/boost/changeset/80591

Log:

* 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

Text files modified:
   trunk/boost/numeric/ublas/vector_sparse.hpp | 5 +++++
   trunk/libs/numeric/ublas/test/Jamfile.v2 | 2 ++
   2 files changed, 7 insertions(+), 0 deletions(-)

Modified: trunk/boost/numeric/ublas/vector_sparse.hpp
==============================================================================
--- trunk/boost/numeric/ublas/vector_sparse.hpp (original)
+++ trunk/boost/numeric/ublas/vector_sparse.hpp 2012-09-18 17:40:05 EDT (Tue, 18 Sep 2012)
@@ -1807,10 +1807,15 @@
             if (! sorted_ && filled_ > 0) {
                 typedef index_pair_array<index_array_type, value_array_type> 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;

Modified: trunk/libs/numeric/ublas/test/Jamfile.v2
==============================================================================
--- trunk/libs/numeric/ublas/test/Jamfile.v2 (original)
+++ trunk/libs/numeric/ublas/test/Jamfile.v2 2012-09-18 17:40:05 EDT (Tue, 18 Sep 2012)
@@ -170,6 +170,8 @@
       [ run test_complex_norms.cpp
       ]
           [ run test_assignment.cpp
+ : : : <define>BOOST_UBLAS_COO_ALWAYS_DO_FULL_SORT
+ : :
           ]
           [ run test_triangular.cpp
           ]


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk