Boost logo

Boost :

From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2002-06-27 18:00:57


----- Original Message -----
From: "Marc Duflot" <m.duflot_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, June 27, 2002 4:17 PM
Subject: [boost] uBLAS: problem with sparse_vector

> 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.

Surprising. I'll have to look, whether it's a library or compiler problem.

> Note: there is the same problem with Loki::AssocVector.

Interesting :-)

> I think that this feature must be documented (or corrected if it is
possible)
> before uBLAS is accepted into boost.

Ok.

> Sorry if it is indeed documented somewhere or if it is a known bug.

No, this one is new for me.

Regards

Joerg


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk