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

Lapacke: solve a banded matrix system of equations [C]

Patrik_Osgnach
Beginner
327 Views

I need to solve a 2D Poisson equation, that is, a system of equations in the for AX=B where A is an n-by-n matrix and B is a n-by-1 vector. Being A a discretization matrix for the 2D Poisson problem, I know that only 5 diagonals will be not null. MKL has functions for solving banded matrix system of equations, namely LAPACKE_dgbtrf (for LU factorization) and LAPACKE_dgbtrs. Now, the 5 diagonals are: the main diagonal, the first diagonals above and below the main and two diagonals above and below by m diagonals wrt the main diagonal. After reading the documentation about band storage, I learned that I have to create a (3*m+1)-by-n matrix to store A in band storage format, so let's call this matrix AB.I'm filling AB in a row major fashion, since it's easier for me and LAPACKE_dgbtrf allows me to choose between row and column major. Now, I stuck on the leading dimenstion (parameter 7). I've read that this parameters tells how many memory elements there are between two elements of the same row and adjacent column.Now, I need to use the leading dimension of A (plain old full matrix) or AB (A turned into band storage format)?Is this call correct?LAPACKE_dgbtrf(LAPACK_ROW_MAJOR, n, n, m, m, AB, n, pivots); //pivots is int *LAPACKE_dgbtrs(LAPACK_ROW_MAJOR, 'N', n, m, m, 1, AB, n, pivots, B, n);Thank you

0 Kudos
1 Reply
Gennady_F_Intel
Moderator
327 Views

ldab

INTEGER. The leading dimension of the arrayab. (ldab2*kl+ku+ 1)

this is the quote from manual
0 Kudos
Reply