Use ?gbmv with a 3d array.

Use ?gbmv with a 3d array.

Let assume the we have a 3d array A and a matrix B of size 2x5.

int A[3][2][2]= { {{1,2},{3,4} }, {{5,6},{7,8}}, {{9,10},{11,12}} };

 I want to program the following:

cs =0.0;

for j=1 until 3

Multiply the Aj matrix with the t-j column of the B matrix and add the result to the term cs.


I have read the function ?gbmv which computes a matrix-vector product using a general band matrix, but I don't know how to do that when the matrix is a 3d array. In this site I read the following

"Array, DIMENSION (lda, n).

Before entry, the leading (kl + ku + 1) by n part of the array a must contain the matrix of coefficients. This matrix must be supplied column-by-column, with the leading diagonal of the matrix in row (ku + 1) of the array, the first super-diagonal starting at position 2 in row ku, the first sub-diagonal starting at position 1 in row (ku + 2), and so on. Elements in the array a that do not correspond to elements in the band matrix (such as the top left ku by ku triangle) are not referenced."

But I don't understand it.

Could you help me, please. A simple example would help me.

Thank you very much.


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

?gbmv is a routine to multiply a 2-D *banded* matrix with a vector. The matrices in your example 3D array are not banded. Why do you want to use ?gbmv instead of ?gemv?. In case you indeed want to use ?gbmv for banded matrices, then you can take look at this for a good explanation on the banded matrix storage format, which is what ?gbmv expects for the matrix argument passed to it:

Leave a Comment

Please sign in to add a comment. Not a member? Join today