jeudi 20 octobre 2016

how to use gsl beta distribution?

I am using the following lines to generate a Beta distributed random variable, using gsl,

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

double alpha=10;
double beta=0.5;
gsl_rng *rng = gsl_rng_alloc(gsl_rng_taus2);
d=gsl_ran_beta(rng, alpha, beta);

but it complains when I make:

/usr/include/c++/5/bits/random.tcc:3321:8: error: request for member ‘max’ in ‘__urng’, which is of pointer type ‘gsl_rng*’ (maybe you meant to use ‘->’ ?)
        - static_cast<long double>(__urng.min()) + 1.0L;
        ^
/usr/include/c++/5/bits/random.tcc:3321:8: error: request for member ‘min’ in ‘__urng’, which is of pointer type ‘gsl_rng*’ (maybe you meant to use ‘->’ ?)
/usr/include/c++/5/bits/random.tcc:3328:29: error: expression cannot be used as a function
    __sum += _RealType(__urng() - __urng.min()) * __tmp;
                             ^
/usr/include/c++/5/bits/random.tcc:3328:32: error: request for member ‘min’ in ‘__urng’, which is of pointer type ‘gsl_rng*’ (maybe you meant to use ‘->’ ?)
    __sum += _RealType(__urng() - __urng.min()) * __tmp;




Aucun commentaire:

Enregistrer un commentaire