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

Use ?gbmv with a 3d array.

Fiori
Beginner
326 Views

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.

end

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 http://software.intel.com/sites/products/documentation/hpc/mkl/mklman/GUID-2FB74140-ADF9-4D82-8644-FD32025F6B71.htm 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.

 

0 Kudos
1 Solution
Zhang_Z_Intel
Employee
326 Views

?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: http://software.intel.com/en-us/node/471382#BAND

View solution in original post

0 Kudos
1 Reply
Zhang_Z_Intel
Employee
327 Views

?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: http://software.intel.com/en-us/node/471382#BAND

0 Kudos
Reply