SGBMV/DGBMV/CGBMV/ZGBMV |
The following example illustrates the storage of general band matrices.
Consider the following matrix A of size m = 9 by n = 8, with lower and upper bandwidths kl = 2 and ku = 3, respectively:
11 | 12 | 13 | 14 | 0 | 0 | 0 | 0 |
21 | 22 | 23 | 24 | 25 | 0 | 0 | 0 |
31 | 32 | 33 | 34 | 35 | 36 | 0 | 0 |
0 | 42 | 43 | 44 | 45 | 46 | 47 | 0 |
0 | 0 | 53 | 54 | 55 | 56 | 57 | 58 |
0 | 0 | 0 | 64 | 65 | 66 | 67 | 68 |
0 | 0 | 0 | 0 | 75 | 76 | 77 | 78 |
0 | 0 | 0 | 0 | 0 | 86 | 87 | 88 |
0 | 0 | 0 | 0 | 0 | 0 | 97 | 98 |
A is given in an array ab with at least kl+ku+1 = 6rows and n = 8 columns as follows:
* | * | * | 14 | 25 | 36 | 47 | 58 |
* | * | 13 | 24 | 35 | 46 | 57 | 68 |
* | 12 | 23 | 34 | 45 | 56 | 67 | 78 |
11 | 22 | 33 | 44 | 55 | 66 | 77 | 88 |
21 | 32 | 43 | 54 | 65 | 76 | 87 | 98 |
31 | 42 | 53 | 64 | 75 | 86 | 97 | * |
The asterisks in the
it is stored in ab(ku+1+i−j,j). Therefore, the columns of A are stored in the columns of ab, and the diagonals of A are stored in the rows of ab, such that the principal diagonal is stored in row ku+1 of ab.
Usage | VECLIB: |
|
| CHARACTER*1 | trans |
| INTEGER*4 | m, n, kl, ku, ldab, incx, incy |
| REAL*4 | alpha, beta, ab(ldab, n), x(lenx), y(leny) |
CALL SGBMV(trans, m, n, kl, ku, alpha, ab, ldab, x, incx, beta, y, incy)
CHARACTER*1 | trans |
INTEGER*4 | m, n, kl, ku, ldab, incx, incy |
REAL*8 | alpha, beta, ab(ldab, n), x(lenx), y(leny) |
CALL DGBMV(trans, m, n, kl, ku, alpha, ab, ldab, x, incx, beta, y, incy)
Chapter 3 Basic Matrix Operations 213