Hello Piddlers, I'm working on a module called PDL::Probability which hopes to bind GSL's randist functions and provide a clean interface to them. It is in its very early stages and the viewable at (most of the working has been in the GSL/ subdir):
https://github.com/tnishimura/PDL-Probability HTML documentation of the (dynamically generated) GSL-binding portion of the module is here: http://pdlprobability.nfshost.com/pdl-probability-gsl.html Most of the binding (namely, for the univariate distributions) is dynamically generated by GSL/t/gsl_randist.pp using an annotation file that I created: https://github.com/tnishimura/PDL-Probability/blob/master/GSL/share/gsl_randist.yml For reference, this is the documentation to the thing I'm trying to bind: http://www.gnu.org/software/gsl/manual/html_node/Random-Number-Distributions.html Here's what I'm trying to do with this module: 1. Bind pdf (gsl_ran_*_pdf) functions. Until now, only cdf's were bound, in Maggie X's PDL::Stats module. 2. Bind samplers (gsl_ran_*'s) in a more "threadable" way. The sampler bindings in PDL::GSL::RNG sometimes places parameters in OtherPars, making them not-threadable, like gsl_ran_tdist()'s second parameter). 3. Test by comparing to C-calls. 'make test' runs the C-version of the every GSL randist functions at multiple values, and the ouptut of the C-calls are compared to PDL-versions (in GSL/t/compare-to-c.t). Right now, PDL::GSL::RNG only tests whether the functions don't die (in gsl_rng.t). 4. Provide option for alternate interfaces. You can see that I have a skeleton for PDL::Probability::RLike, which provides an R-language like interface to the functions. For example, sampling 100 normals can be done like rnorm(100, mean => 10, sigma => 123), which is a wrapper for gsl_ran_gaussian(). I'm thinking of also providing an Octave-like interface and an numpy like interface. I think alternate interfaces is a good idea b/c every language/probability library has a different idea of how to name these functions. John D. Cook, a statistician/programmer/blogger wrote about this very recently: http://www.johndcook.com/blog/2012/07/02/probability-function-names/ 5. In the future I'd like to create similar sets of functions for distributions not in GSL, like multivariate normal and t-distributions. My original intention was to create the ultimate probability function library (not just those in GSL), thus the module name. Maybe this is better done in separate modules. I am requesting any and all criticism. I haven't settled on anything, including the name of the module or the need for modules existance yet. As for naming... I was thinking of PDL::GSL::Randist but I don't want to intrude into PDL's internal namespace. And maybe I should send the testing portions to Maggie X for integration into PDL::Stats and scrap the rest. Please note that all development is being done with Linux (centos 5 and slackware 13.37), perl 5.12+, PDL 2.4.10+, gsl 1.13+. I don't think it'll work on windows yet because of hackery in the makefile. -Tom _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
