Boost logo

Ublas :

Subject: Re: [ublas] [BLAS bindings] help appreciated on using trmv and gbmv
From: Florent Teichteil (florent.teichteil_at_[hidden])
Date: 2012-10-08 08:33:08


Hi, Rutger,

> As for the test cases, after some checking, I think it has to do with
> accumulation of error. The results print to identical values, but
> norm_inf shows differences (due to std::rand() being large). If you
> replace std::rand() with, say, 1.0, all results become identical and
> tests say "CORRECT". I would have to check "What Every Computer
> Scientist Should Know About Floating Point Arithmetic", but I am sure
> the answer can be found in that direction.
>

You're right, computations with trmv are correct with values of
reasonable magnitudes, let say between -500 and 500 for instance.
Actually, I figured out why it didn't work with very large values up to
RAND_MAX: depending on the computations performed by gemv or trmv, some
temporary values exceeded the maximum value that can be represented by a
double number (for instance, RAND_MAX * RAND_MAX can not be represented
using double precision numbers).

That said... The bindings for banded matrices, i.e. gbmv, still give
incorrect results with matrices and vectors filled with reasonable
values. Moreover, the only transpose operator that makes sense
(according to your previous post), does not compile with
banded_adaptors. So:

1. How can I get correct results with gbmv (even with matrices and
vectors filled with the same value of 1.0)?

2. How can I transpose a banded-adapted matrix before calling gbmv,
using boost::numeric::bindings::trans?

Cheers,
Florent