The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

troubles with dgesv :-(

Open discussion regarding features, bugs, issues, vendors, etc.

troubles with dgesv :-(

Postby julia » Fri Apr 04, 2008 4:43 am

Hi,
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]);

THANK YOU VERY MUCH!!!!
julia
 
Posts: 2
Joined: Thu Apr 03, 2008 12:44 pm

Postby julia » Fri Apr 04, 2008 8:01 am

I got it!
The problem was, that the coefficientmatrix has to be 1D and not 2D. After I put all columns in one everything worked perfectly!!
julia
 
Posts: 2
Joined: Thu Apr 03, 2008 12:44 pm


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 4 guests