Boost logo

Ublas :

Subject: Re: [ublas] uBlas bug or compiler bug?
From: Nasos Iliopoulos (nasos_i_at_[hidden])
Date: 2009-09-12 14:24:15

Try to initialize matrix "T" in your multiplication algorithm to zeros. I attach a test run on your example without the boost unit test and with
matrix_type T=boost::numeric::ublas::zero_matrix<real_type>(A.size1(), B.size2());

compiled with:
g++ -O3 ublas_no_boost_unit_test.cpp -o test;

Very Best
Nasos Iliopoulos

> Date: Sat, 12 Sep 2009 11:15:08 +0200
> From: marco.guazzone_at_[hidden]
> To: ublas_at_[hidden]
> Subject: [ublas] uBlas bug or compiler bug?
> Dear all,
> Today I've found a strange behavior with uBlas.
> I've tried both Boost 1.37.0 (pre-installed 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 (
> used for compiling (actually usable for gcc and alike). For people
> having the "make" command, simply run:
> $ make -f 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: matrix-scalar product,
> matrix sum, matrix product.
> For each test, the computed value is checked against the expected
> value, with a certain tolerance TOL (=1.0e-5).
> 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

Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.