
Ublas : 
Subject: [ublas] uBlas bug or compiler bug?
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 20090912 05:15:08
Dear all,
Today I've found a strange behavior with uBlas.
I've tried both Boost 1.37.0 (preinstalled on my Linux Fedora 11
system) and Boost 1.40.0 (compiled by myself).
I've attached the code (ublas.cpp) and the related makefile (ublas.mk)
used for compiling (actually usable for gcc and alike). For people
having the "make" command, simply run:
$ make f ublas.mk clean all
You need the Boost.Test compiled libraries (see flag
lboost_unit_test_framework)
Well, the problem.
The code simply test some matrix operations: matrixscalar product,
matrix sum, matrix product.
For each test, the computed value is checked against the expected
value, with a certain tolerance TOL (=1.0e5).
When I run the code I get the seventeen errors in the matrix product
test suite like the one below (the other sixteen are the same since
the error always occurs a the same line):
 [snip] 
ublas.cpp(144): error in "matrix_matrix_prod": check std::fabs(*col_it
 T(row,col)) <= TOL failed
 [/snip] 
But, and here is the *strange* behavior, if I comment both the
"matrix_scalar_prod" and the "matrix_matrix_sum" test suites (lines
from 22 to 94) the matrix product test suite (matrix_matrix_prod) is
OK!!!
Moreover commenting only the "matrix_matrix_sum" I get another
different behavior, that is only four errors (with Boost 1.37) and two
errors (with Boost 1.40); and if I comment only th
"matrix_scalar_prod" the errors returns to be seventeen:
Wow!! :(
So I don't understand if this is a uBlas bug or a compiler bug ...or
maybe something I do wrong with uBlas.
My compiler is: GCC 4.4.1
Can you try to run the attached code and give me a feedback?
Many many thanks!!!
Cheers,
 Marco