On 9 September 2009 at 10:27, Matthew Vernon wrote:
| Hi,
| 
| If you call any of the random-number functions in GSL and forget to 
| initialise the random number generator (or initialise it wrongly), GSL 
| SEGVs. This is poor - it should produce an error message. I deal with 
| queries from people this has confused surprisingly frequently.

Can you please supply a reproducible example?  If I bastardize an old example
of mine and comment-out 'gsl_rng_env_setup()' it still runs fine as shown below.

e...@ron:/tmp> cat test_gsl_rng.c

/* minimal gsl program from the info pages */

#include <stdio.h>
#include <gsl/gsl_rng.h>

gsl_rng * r ;  /* global generator */

int
main ()
{
  /* gsl_rng_env_setup() ; */

  r = gsl_rng_alloc (gsl_rng_default);

  printf("generator type: %s\n", gsl_rng_name (r));
  printf("seed = %u\n", gsl_rng_default_seed);
  printf("first value = %u\n", gsl_rng_get (r)) ;
}

/*
 * Local variables:
 *  compile-command: "gcc -W test_gsl_rng.c -o test_gsl_rng -lblas -lgsl -lm"
 * End:
 */
e...@ron:/tmp> gcc -W test_gsl_rng.c -o test_gsl_rng -lblas -lgsl -lm
e...@ron:/tmp> ./test_gsl_rng
generator type: mt19937
seed = 0
first value = 4293858116
e...@ron:/tmp>


Or do you claim that not-using 

   gsl_rng_alloc (gsl_rng_default)

leading to a SEGV is a invalid behaviour?  I am much less convinced that that
is a valid bug report -- it's much like using un-alloc'ed pointer types in
my book.

Dirk

| 
| Regards,
| 
| Matthew
| 
| -- System Information:
| Debian Release: 5.0.3
|   APT prefers stable
|   APT policy: (500, 'stable')
| Architecture: amd64 (x86_64)
| 
| Kernel: Linux 2.6.20-2-macpro-amd64 (SMP w/4 CPU cores)
| Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
| Shell: /bin/sh linked to /bin/bash
| 
| Versions of packages libgsl0-dev depends on:
| ii  libgsl0ldbl                  1.11+dfsg-1 GNU Scientific Library (GSL) -- 
li
| 
| libgsl0-dev recommends no packages.
| 
| libgsl0-dev suggests no packages.
| 
| -- no debconf information
| 
| 

-- 
Three out of two people have difficulties with fractions.



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to