|
Boost : |
From: Marc Duflot (m.duflot_at_[hidden])
Date: 2002-06-27 09:17:52
There is a bug in uBLAS that is illustrated with the following code:
#include <iostream>
#include <boost/numeric/ublas/vector_sp.h>
#include <boost/numeric/ublas/io.h>
int main () {
numerics::sparse_vector<double> v (3);
v(1) = v(0) = 42;
std::cout << v << std::endl;
}
The output of the program is (with g++ 2.95.2 and g++ 3.0.4 on Linux)
[3](42,0,0)
The element v(1) is 0 instead of 42. The bug comes from the fact that v(1) is
evaluated before v(0) = 42. The bug is not present with the Intel compiler on
the same platform.
Note: there is the same problem with Loki::AssocVector.
I think that this feature must be documented (or corrected if it is possible)
before uBLAS is accepted into boost.
Sorry if it is indeed documented somewhere or if it is a known bug.
-- Marc Duflot http://vesta.ltas.ulg.ac.be/~duflot/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk