Opened 10 years ago
Closed 10 years ago
#7363 closed Bugs (fixed)
coordinate_matrix::sort() fails with gcc 4.7
Reported by: | Gunter | Owned by: | Gunter |
---|---|---|---|
Milestone: | Boost 1.52.0 | Component: | uBLAS |
Version: | Boost 1.51.0 | Severity: | Problem |
Keywords: | ublas coordinate_matrix | Cc: | j.ungermann@… |
Description
coordinate_matrix::sort() fails with gcc 4.7 because std::inplace_merge requires the provided iterator's method operator*() to really return a reference. The current implementation of index_triple's iterator however returns a proxy (which does not comply to the random_access iterator concept).
(The same problem applies to zip_iterator, see e.g. http://www.boost.org/doc/libs/1_48_0/libs/iterator/doc/new-iter-concepts.html#changes-to-algorithm-requirements )
Attachments (3)
Change History (16)
comment:1 by , 10 years ago
Component: | None → uBLAS |
---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Status: | new → assigned |
---|
by , 10 years ago
Attachment: | custom_inplace_merge.diff added |
---|
comment:4 by , 10 years ago
I just attached a patch (as anonymous, sorry) hopefully fixing the problem.
Two custom inplace_merge routines were added to coordinate_vector and coordinate_matrix that replace the problematic STL version.
This could be generalized, but this requires an astonishing amount of templated code to properly pull of, so this copy-paste version seems preferable.
In addition two new test files were added that exercise the coordinate types and check on sortedness of indice and correctness.
I compiled and executed the tests, so some additional changes are likely required to automatically execute them. (I am unfamiliar with the boost test system and familiarizing me with that would have create delayed the patch).
comment:5 by , 10 years ago
comment:6 by , 10 years ago
(In [80591])
- 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
comment:7 by , 10 years ago
Ticket #4862 is a duplicate of this one (obvious from the attached error output in that ticket).
by , 10 years ago
Attachment: | custom_inplace_merge_fixed.diff added |
---|
by , 10 years ago
Attachment: | custom_inplace_merge_r80623.diff added |
---|
comment:8 by , 10 years ago
I provided two new patch files. The first one with "_fixed" fixes a danging include statement that should generate a compilation error. The second one is the same patch but against the most recent revision 80623 that I just checked out. The original patch was partly against an older version.
comment:9 by , 10 years ago
(In [80625])
- boost/numeric/ublas/vector_sparse.hpp, boost/numeric/ublas/matrix_sparse.hpp: see #7363, applied patch (added inplace_merge)
- libs/numeric/ublas/test/Jamfile.v2, libs/numeric/ublas/test/test_coordinate_vector_inplace_merge.cpp, libs/numeric/ublas/test/test_coordinate_matrix_inplace_merge.cpp: add test for COO::sort()
comment:10 by , 10 years ago
comment:11 by , 10 years ago
comment:12 by , 10 years ago
comment:13 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
tests are green on release branch
(In [80487]) * 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