This is the mail archive of the
gsl-discuss@sourceware.cygnus.com
mailing list for the GSL project.
Bug with gsl_blas ?
- To: GSL discussion list <gsl-discuss at sourceware dot cygnus dot com>
- Subject: Bug with gsl_blas ?
- From: Fabrice Rossi <rossi at ufrmd dot dauphine dot fr>
- Date: Thu, 25 Nov 1999 17:33:00 +0100
- Organization: Dauphine University
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