This is the mail archive of the gsl-discuss@sourceware.cygnus.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug with gsl_blas ?


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]