Curious what 2.5 4.0 3.5is the rhs solution 1 2 3... if the matrix
2 -1 0
-1 2 -1
0 -1 2
dpotrfand are dpotrsmade for symmetric positive definite matrices ...
I would suggest using dgetrfand dgetrs. In your case:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <lapacke.h>
int main()
{
double A[3*3]={ 2.0, -1.0, 0.0,
0, 2.0, -1.0,
0.0, 0, 2.0},
b[3]={1.0,2,3.0};
int n=3,info,nrhs=1; char uplo='L';
int ipvs[3];
dgetrf_(&n, &n, A, &n,ipvs, &info);
printf("info %d\n",info);
dgetrs_("T", &n, &nrhs, A, &n,ipvs, b, &n, &info);
printf("info %d\n",info);
printf("Solution: %10.4f %10.4f %10.4f\n",b[0], b[1], b[2]);
return 0;
}
1.3750 1.75 1.5. , "N" "T". 0.5 1.25 2.125
!
,