I want to solve this linear system Ax=b, where:
A =
[-0.23 2.54 -3.66 0;
-6.98 2.46 -2.73 -2.73;
0 2.56 2.46 4.07;
0 0 -4.78 3.82]
b = [4.42 27.13 -6.14 10.5]
and the solution should be
x = [-2 3 1 -4]
which is a banded matrix with lower band equals to 1 and upper band equals to 2
It is solved using DGBSV solver as follows
#include <stdlib.h>
#include <stdio.h>
#include "mkl_lapacke.h"
#define N 4
int main() {
int i;
MKL_INT ipiv[N];
double a[16] = { 0, -0.23, 2.54, -3.66,
-6.98, 2.46, -2.73, -2.13,
2.56, 2.46, 4.07, 0,
-4.78, 3.82, 0, 0};
double b[4] = {4.42, 27.13, -6.14, 10.5};
LAPACKE_dgbsv( LAPACK_ROW_MAJOR, N, 1, 2, 1, a, N, ipiv, b, 1);
for(i=0;i<N;i++)
printf("%f\n", b[i]);
}
The code is aborting at the dgbsv solver. When I write matrices a and b pointers it gives the values of the address.