Boost logo

Ublas :

Subject: Re: [ublas] Fwd: boost/numeric/bindings/lapack
From: Vardan Akopian (vakopian_at_[hidden])
Date: 2008-11-13 03:09:28


On Wed, Nov 12, 2008 at 3:16 PM, Thomas Klimpel
<Thomas.Klimpel_at_[hidden]> wrote:
>> I've received the following patch suggestion from Julius Ziegler. What he
>> points out does look fishy. Since I've never worked with banded matrices in
>> LAPACK, I hope someone on the list is better equipped to give a definitive
>> answer.
>
> The fix from Julius Ziegler is correct (according to the documentation of SGBTRF and ublas/banded_matrix), but it doesn't go far enough. It should also change "assert(ku > 0)" into "assert(ku >= 0)", because that is all that is required by SGBTRF.
>

It's been long time since I wrote this, but I'm pretty sure the
original code is correct. Accourding to the documentation of SGBTRF
(http://www.netlib.org/lapack/explore-html/sgbtrf.f.html ), the AB
matrix is of dimension (LDAB, N), where LDAB >= 2*KL+KU+1. To achieve
this dimension the original banded matrix A must have allocated KL
lower and KL+KU upper diagonals. If A had only allocated KL lower and
KU upper diagonals before calling gbtrs, it cannot be used as the AB
matrix. So the routine assumes that exactly KL+KU upper diagonals were
allocated in A.
But in that case, A.upper() would be KL+KU, which is not what we need
to pass as KU to SGBTRF, thus the calculation in the original code.

I do agree however, that assert(ku > 0) should be changed to assert(ku >= 0).

-Vardan