[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] sorting vectors with NANs

From: Ben Klemens
Subject: [Bug-gsl] sorting vectors with NANs
Date: Wed, 23 Feb 2005 13:40:06 -0800
User-agent: Mutt/1.4i

Dear GSL maintainers,

If there's an NAN in a vector, then gsl_sort_vector falls into an
infinite loop.

Run the program below as is, and it will never exit. If you comment out
the GSL_NAN line, then it exits in the blink of an eye.

I've tried this on two Linux boxes, both running Mandrake 10, one with
GSL 1.6 and one with GSL 1.5. Compiled with:
gcc -lgsl -lgslcblas bug_demo.c




#include <gsl/gsl_matrix.h>
#include <gsl/gsl_sort_vector.h>
#include <gsl/gsl_math.h>
int main(void){
gsl_vector      *v      = gsl_vector_calloc(3);
        gsl_vector_set(v, 0, GSL_NAN);
        gsl_vector_set(v, 1, 1);
        gsl_vector_set(v, 2, 2);
        return 0;


ps. A bug report is probably not the place to put this, but I'm putting
together a stats library based on the GSL. If anybody's interested,
have a look at apophenia.info (which is still in the planning stage).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]