Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10127: coordinate_matrix sort() fails on to std::swap
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-06-27 06:25:54
#10127: coordinate_matrix sort() fails on to std::swap
-------------------------------+---------------------
Reporter: anonymous | Owner:
Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
Version: Boost 1.54.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+---------------------
Comment (by Andrew Medlin <amedlin@â¦>):
This also affects version 1.55.0 sparse vectors, which breaks the LU
substitution.
For example, the following code produces incorrect output. It should swap
the 2nd and 3rd elements, producing
1.000000, 3.000000, 2.000000
but instead it produces
1.000000, 3.000000, 3.000000
It is fixed by uncommenting the #define BOOST_UBLAS_NO_ELEMENT_PROXIES
{{{
//#define BOOST_UBLAS_NO_ELEMENT_PROXIES
#include <boost/numeric/ublas/vector_sparse.hpp>
#include <boost/numeric/ublas/lu.hpp>
using namespace boost::numeric::ublas;
int main()
{
mapped_vector<float> y;
y(0) = 1.0f;
y(1) = 2.0f;
y(2) = 3.0f;
LOG("Initial vector is: " << y);
permutation_matrix<std::size_t> perm(y.size());
perm(0) = 0;
perm(1) = 2;
perm(2) = 2;
swap_rows(perm, y);
LOG("Swapped vector is: " << y);
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10127#comment:2> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC