[BioLib-dev] Need to link another library gsl

Xin Shuai xshuai at umail.iu.edu
Mon Aug 3 16:34:43 UTC 2009


I can try the boost version of rng. But I still got a worry about the
argument type problem.Those four functions defined are not used directly in
libsequence. Instead, they are included in different classes as member
function object.( See gsl_rng_wrappers.hpp for detail) . And the instance of
these classes will be passed into other functions as argument and those
functions are really used directly in libsquence.For example, such a
function in libsequnce:

std::pair<int,int> pick2
<http://molpopgen.org/software/libsequence/doc/html/group__coalescent.html#g4ba1caf640763a9056a0aff2dd73a1d2>(
uniform_generator & uni, const int & nsam)


the argument &uni is just an object of the following class:

class gsl_uniform01

  {

  private:

    gsl_rng * __r;

  public:

    gsl_uniform01( gsl_rng * r ) : __r(r)

    {

    }

    inline double operator()(void) const

    {

      return gsl_rng_uniform(__r);

    }

  };


Therefore, even if I can write a boost_rng_wrapper.hpp and wrap boost random
number generator, I'm afraid it won't be accepted as the current
libsequence. I have to rewrite all related functions, like pick2, to make it
accept boost rng rather than gsl rng.

Correct me if I'm wrong.

On Mon, Aug 3, 2009 at 11:45 AM, Pjotr Prins <pjotr.public14 at thebird.nl>wrote:

> On Mon, Aug 03, 2009 at 10:56:52AM -0400, Xin Shuai wrote:
> > I've tried to add the related  .c source files in gsl library and compile
> > them. However, the difficulty is little beyond my expectation
> > Actually, only four functions are needed for libsequence:
> >
> > gsl_rng_uniform(__r)
> >
> > gsl_ran_flat(__r,a,b)
> >
> > gsl_ran_exponential(__r,mean)
> >
> > gsl_ran_poisson(__r,mean)
>
> Funny. They are all random number generators, which are also in BOOST
> and Rlib. How about replacing these functions in libsequence with
> their Boost counterpart? Since we have Boost already. See, for example
>
>
> http://www.boost.org/doc/libs/1_35_0/libs/math/doc/sf_and_dist/html/math_toolkit/dist/dist_ref/dists/poisson_dist.html
>
> would that be hard? I notice libsequence has a single wrapper
> Sequence/RNG/gsl_rng_wrappers.hpp, which includes these. The other
> uses are all example files.
>
> How about creating Sequence/RNG/boost_rng_wrappers.hpp which gets
> included when USE_BOOST is defined?
>
> That would be a nice contribution for the libsequence project.
>
> If that fails I can pull the GSL source tree into biolib. I have half
> a mind to do that anyway - it is not so large.
>
> All possible ;-)
>
> Pj.
>
>


-- 
Xin Shuai (David)
PhD of Complex System in School of Informatics
Indiana University Bloomington
812-606-8019



More information about the BioLib-dev mailing list