I have problems to get dgesv calculating right. The routine returns INFO = 0, but the solution is allways "nan" (for different matrizes A). can somebody help me?
here my code:
- Code: Select all
int N = 2;
int NRHS = 1;
int LDA = 2;
int LDB = 2;
int INFO;
int* IPIV;
IPIV = (int*)calloc(2, sizeof(int));
double* B;
B = (double*) calloc(2,sizeof(double));
double **A;
A = (double**) calloc(2, sizeof(double*));
for(int i = 0; i < 2; i++)
{
A[i] = (double*) calloc(2, sizeof(double));
}
A[0][0] = 1.0;
A[0][1] = 2.0;
A[1][0] = 0.0;
A[1][1] = 2.0;
B[0] = 1.0;
B[1] = 0.0;
dgesv_(&N, &NRHS, A, &LDA, IPIV, B, &LDB, &INFO);
printf("info:%i \n", INFO);
printf("Loesungsvektor:(%f , %f)\n", B[0], B[1]);

