Bug with gsl_blas ?
Fabrice Rossi
rossi@ufrmd.dauphine.fr
Thu Nov 25 08:33:00 GMT 1999
Hi.
I've started to code the multidimensionnal minisation algorithm, and I tried
to use blas. I must confess I'm not at all a blas expert (I've basically read
the faq and that's all), but I think I'm not doing stupid things (well, I
_hope_). The following program dumps core:
#include <gsl_vector.h>
#include <gsl_blas_types.h>
#include <gsl_blas.h>
int main()
{
gsl_vector *x;
gsl_vector *y;
x = gsl_vector_calloc(2);
y = gsl_vector_calloc(2);
gsl_vector_set(x,0,2.5);
gsl_vector_set(x,1,1.5);
printf("x "); gsl_vector_fprintf (stdout, x, "%g"); printf("\n");
gsl_vector_copy(y,x);
gsl_blas_daxpy(2.0,x,y);
printf("y "); gsl_vector_fprintf (stdout, y, "%g"); printf("\n");
}
The problem comes from gsl_blas_daxpy and I really don't understand why. When
I run the program under gdb, I end up in source_axpy_r.h in which the
condition i<N-3 seems to not be evaluated correctly. Is this related to the
fact N-3 is here a negative value, whereas size_t is unsigned? When I replace
i<N-3 by: (int)i<(int)N-3, the program works...
Is this a compiler bug, or something similar? I'm using gcc version 2.7.2 on
an old RedHat 5.2 x86 linux system.
Fabrice Rossi
More information about the Gsl-discuss
mailing list