Boost logo

Ublas :

Subject: [ublas] [bindings] Possible bug in GBCON
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2010-07-27 05:00:50


Hi,

I'm facing a problem with GBCON.

I use it to estimate the reciprocal matrix condition number of a banded matrix.

Firstly, I call GBTRF to get the LUP decomposition (AB, IPIV) of my
input matrix A.
Then, I compute the matrix norm (specifically, the 1-norm).
Finally, I call GBCON using as parameters the above (AB,IPIV) pair and
the matrix norm:
   bindings::lapack::gbcon('O', AB, IPIV, norm, rcond)
The result is stored in 'rcond'.

Well, when I call GBCON the following assertion fails (gbcon.hpp -
lines 155,250):

        BOOST_ASSERT( bindings::stride_major(ab) >=

2*bindings::bandwidth_lower(ab)+bindings::bandwidth_upper(ab)+1 );

I think the problem is in the use of
   bindings::bandwidth_upper(ab)
which IMHO should be replaced with
   bindings::bandwidth_upper(ab) - bindings::bandwidth_lower(ab)
As a matter of fact, LAPACK doc
  http://www.netlib.org/lapack/explore-html/a00579_source.html
refers to KL and KU with respect to the original input matrix A and
not to its LUP decomposition AB.

I submit a test case and a possible patch (the patch also fixes a
similar issue when calling detail::gbcon).

What do you think?

Thank you very much!!

Cheers,

-- Marco