Boost logo

Ublas :

Subject: Re: [ublas] [BLAS bindings] help appreciated on using trmv and gbmv
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2012-10-10 06:19:23


Florent Teichteil wrote:
> Indeed, if I clear B before filling it, I get correct results with row
> major storage, but not with column major. Am I doing something wrong?

No, the ublas "row major storage" for banded matrices corresponds directly to the lapack "column major storage" for banded matrices. I know it's confusing, but that's just the way it is.

> Moreover, I thought that banded matrices only store data within the
> bands, so I don't understand why I have to clear B before filling only
> the bands.

Well, I don't know the details in this case, but it will probably also boil down to a "that's just the way it is". You could probably find an explanation in the documentation of the corresponding lapack routine.

> > 2) The banded adaptor of the dense matrix doesn't work with blas::gbmv
> > because the memory model isn't compatible. Maybe we can apply a trick to
> > the memory model, such as passing a* = begin_value(A)-kl and lda += 1?
> > We would need to check that. Until then, it is not supported.
>
> This is the more confusing part.

If I understand you correctly, you would like us to provide information in the generated files whether
* they have been tested and are know to work without issues
* they have been tested and are know to not work at all
* they have been tested and are know to only work if certain implicit assumption are satisfied
* they have not been tested, and hence might not work at all, or have hidden issues

On the other hand, you seem to be mainly complaining about differences in the data structures from ublas and the data structures supported by lapack (and blas). I'm not sure how much responsibility the bindings authors could/should take here, if you try to be realistic. For example, the lapack data structure for triangular matrices is special. One option I see is that the bindings could offer adaptors for such special data structures, but when is a structure special enough to warrant such an adaptor? Should there be an adaptor, just because some banded algorithm expect the input matrix (which will be overwritten) to already provide some more storage, because the output matrix will likely be bigger than the input matrix?

Regards,
Thomas