HI,
ich versuche vergeblich dgesv (Lapack, berechnung eines linearen gleichungsystems) zum laufen zu bringen. Die Berechnung scheint jedes mal erfolgreich (INFO=0) aber die Loesungen sind jedes Mal "nan" (auch fuer andere Matrizen A).
RIESEN GROSSER DANK FUER DIE HILFE VORAB.
hier mein code:
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]);
ich versuche vergeblich dgesv (Lapack, berechnung eines linearen gleichungsystems) zum laufen zu bringen. Die Berechnung scheint jedes mal erfolgreich (INFO=0) aber die Loesungen sind jedes Mal "nan" (auch fuer andere Matrizen A).
RIESEN GROSSER DANK FUER DIE HILFE VORAB.
hier mein code:
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]);
Comment