Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6538 Discussions

dgbmv versus doing it "yourself" (for tri or penta diagonal matrices)


Hi all,

I need often (for i between 0 and 52 * 40 - 1 let's say) to calculate M_i * V_i + F_i where the matrix M_i is of size 2000 * 2000 and is not constant as a function of i, where vectors V_i and F_i are non constant as functions of i. The point is that M_i is either tridiagonal of pentadiagonal (even heptadiagonal) and that F_i as all its coefficients zero except maybe the first and the last.

Naturally I would like to use dgbmv, but due to the special format that M_i has tu be put in to be used with this function, I find it a bit prohibitive.

Do you intel guys have a benchmark of comparisons for lets say case where M_i triangular showing how faster using dgbmv for doing such a product is compared to doing it oneself ?

I could indeed do this test on my computer myself, but more generally, I was wondering is there where benchark documents of this kind, for blas lapack functions for instance ?

Thx in advance,





0 Kudos
2 Replies
Black Belt

You have stated contradicting requirements: (i) M is tridiagonal, pentadiagonal, ... and (ii) M is triangular. Which is the one of interest?

If you formulate M as a full matrix and then recast it into band-matrix format, that is an inefficient way and wastes memory. Hav you considered forming M directly as a band matrix?


(ii) triangular was a typo sorry --> read tridiagonal

(i) was is not a typo : M_i is either tridiagonal, pentadiagonal or heptadiagonal : there are 3 cases (of course any tridiagonal matrix is penta and hepta diagonal an any pentadiagonal matrix is heptadiagonal etc, but I'm sure everyone understands what I mean by "cases")

In the tridiagonal case : I have of course considered forming directly M_i as a band matrix, but each M_i in my loop will in fact be used with dgbmv (and then needs to be stored as a band matrix) one time and with dgttrf (and then needs to be stored as three diagonals). That's why I was thinking, instead of using dgbmv, to rather store M_i as three diagonals and to do the dgbmv part myself, hence the question.