tests+docs for Randist, dirichlet/multinomial working #22

Merged
merged 16 commits into from Aug 22, 2011

Projects

None yet

2 participants

@tnishimura

I've worked on three areas. First, I curated Randist.pod a bit, reformatting and renaming some variables so it's more self documenting. Second, I added a bunch of point-value tests for the more common distributions' pdf's in Randist.t. I have yet to think of a good way to test the sampling functions.

Third, I got dirichlet and multinomial working by creating a wrapper functions (in c) which utilize two new sets of typemaps: %typemap(in) (int len, double[]) for input, and array_wrapper for output (see gsl_typemaps.i). I think this is better than completely emulating C behavior of modifying input arrays because it makes *dirichlet and *multinom functions look like the others, doesn't require user to pass size, and avoids segfaults when the arrays are different sizes.

@leto
Owner
leto commented Aug 22, 2011

This is awesome! Nice work on the docs and the SWIG functions.

I am getting one test failure:

Failed test 'gsl_ran_chisq_pdf(0,2) ?= 0,
res= +-0.5, eps=1e-08'
 at t/Randist.t line 199.
  (in Math::GSL::Randist::Test->GSL_RAN_CHISQ)

Is that test wrong? Should be testing for 0.5 instead of 0 ?

@tnishimura

No, chisq(0,2) should be .5. I wonder why this didn't show on my home computer last night... might be some floating point issue? I'll look into it tonight more, but for now I commited an updated test x=0.0001 instead of 0.

@leto
Owner
leto commented Aug 22, 2011

Which version of GSL and Perl are you running tests against? I am using 1.14 and v5.10.1 (*) built for x86_64-linux-gnu-thread-multi

@leto leto merged commit 29bdaa2 into leto:master Aug 22, 2011
@tnishimura

Thanks for the pull. My home machine which was passing the original test is slackware64-13.37 + gsl 1.15 + perl 5.12.3 (I think-- I'll check tonight). My laptop (which failed the test) is centos 5 64bit + perl 5.12.3+gsl 1.15, so I don't think there's any major differences.

@leto
Owner
leto commented Aug 22, 2011

Blarg, setting a $TODO variable does not seem to be working, because I have custom test functions. I will commit some tests in a few.

@leto
Owner
leto commented Aug 22, 2011

Just pushed failing tests to a branch. Both tests (one uses 0 and the
other 0.0) fail for me. What about you?

On Mon, Aug 22, 2011 at 12:32 PM, tnishimura
reply@reply.github.com
wrote:

Thanks for the pull.  My home machine which was passing the original test is slackware64-13.37 + gsl 1.15 + perl 5.12.3 (I think-- I'll check tonight).  My laptop (which failed the test) is centos 5 64bit  + perl 5.12.3+gsl 1.15, so I don't think there's any major differences.

Reply to this email directly or view it on GitHub:
#22 (comment)

Jonathan "Duke" Leto jonathan@leto.net
Leto Labs LLC
209.691.DUKE // http://labs.leto.net
NOTE: Personal email is only checked twice a day at 10am/2pm PST,
please call/text for time-sensitive matters.

@tnishimura

Yep, both GSL_RAN_CHISQ_BUG failing for me as well. Apparently this has been discovered years ago: http://www.cygwin.com/ml/gsl-discuss/2003-q2/msg00062.html But the domain of the chisq pdf is [0,inf), not (0, inf)... Maybe I'll bug them.

@tnishimura

The difference is b/c gsl_ran_chisq_pdf was updated to handle nu=2 as a special case between 1.14 and 1.15. (Apparently my centos machine's Math::GSL was linking to an older GSL (1.13), so that explains that. (whoops)) Is there a way to find out the GSL version from within Math::GSL?

@leto
Owner
leto commented Aug 23, 2011

That exact problem already has a Github issue:
#2

The closest thing we have currently is swig/system.i , which is only
accessible from C and SWIG land. I think the simplest solution is to
just have a convenience wrapper around gsl-config. It should probably
be a function that is optionally importable directly from Math::GSL,
such as:

use Math::GSL qw/gsl_version/;

Something like this will be very useful in our test suite, and help us
get rid of some test failures from the CPAN smokers.

On Mon, Aug 22, 2011 at 10:11 PM, tnishimura
reply@reply.github.com
wrote:

The difference is b/c gsl_ran_chisq_pdf was updated to handle nu=2 as a special case between 1.14 and 1.15.  (Apparently my centos machine's Math::GSL was linking to an older GSL (1.13), so it that explains that. (whoops))  Is there a way to find out the GSL version from within Math::GSL?

Reply to this email directly or view it on GitHub:
#22 (comment)

Jonathan "Duke" Leto jonathan@leto.net
Leto Labs LLC
209.691.DUKE // http://labs.leto.net
NOTE: Personal email is only checked twice a day at 10am/2pm PST,
please call/text for time-sensitive matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment