bug-gsl
[Top][All Lists]
Advanced

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

[Bug-gsl] possible bug in gsl_ran_dirichlet


From: I J Wilson
Subject: [Bug-gsl] possible bug in gsl_ran_dirichlet
Date: Tue, 31 Jul 2007 16:12:54 +0100

I'm not sure if this is a bug - but I would not
think that a randoim number generator should produce nans

gsl_ran_dirichlet gives nan when given small values for
parameters. 

An example program that shows this is at the end of this email
 

#include "gsl/gsl_rng.h"
#include "gsl/gsl_randist.h"


int main(void)
{
  double a[2],b[2];
  gsl_rng *r;

  a[0]=1.0;
  a[1]=1.0;

  r=gsl_rng_alloc(gsl_rng_mt19937);
  gsl_rng_set(r,1);
  int i;
  for (i=1;i<=10;i++) {
    a[0]/=10.0;
    a[1]/=10.0;
    gsl_ran_dirichlet(r,2,a,b);
    printf("(%g,%g): %g %g\n",a[0],a[1],b[0],b[1]);
  }
  
}




reply via email to

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