Hi Thierry,Thanks for your reply.It looks MATH:GSL 0.10 I installed does not support raw(). I have received this error message:Can't locate auto/Math/GSL/RNG/raw.al in @INC (@INC contains: C:/ActivePerl-5.10
.0.1003-MSWin32-x86-285500/ActivePerl-5.10.0.1003-MSWin32-x86-285500/perl/site/l
ib C:/ActivePerl-5.10.0.1003-MSWin32-x86-285500/ActivePerl-5.10.0.1003-MSWin32-x
86-285500/perl/lib .) at test.pl line 4Line 4 is this - my @random = map {gsl_rng_uniform($rng->raw())} (1..20);Am I using too old a version? Any suggestion?Jingsheng
From: Thierry Moisan [mailto:thierry...@gmail.com]
Sent: 22 October 2008 03:36
To: Jingsheng Ma
Cc: Jonathan Leto
Subject: Re: using MATH:GSL::RNG and RandisHi Jingsheng,
First thank you for your interest in Math::GSL. For your question, you simply need to use the ->raw() method, which gives the following code :
use Math::GSL::RNG qw/:all/;
use Math::GSL::Randist qw/:all/;
my $rng = Math::GSL::RNG->new;
my @random = map {gsl_rng_uniform($rng->raw())} (1..20);
gsl_ran_lognormal($rng->raw(), 1.0, 0.2);and everything works fine. The raw method is needed to get the undelying C structure of the rng object we implemented in Perl. The raw method should be in the Math::GSL::RNG docs (at least it's in my development version of Math::GSL). This lack in the docs on CPAN should be solved soon, for this I forward this response to Jonathan.
Have a nice day!
Thierry Moisan
2008/10/21 Jingsheng Ma <Jingsh...@pet.hw.ac.uk>
Hi Jonathan Leto/Thierry Moisan,I intend to use RNG and Randis for my work. I have a problem of using those functions which requires pass $r rgn structure as the first argument. Here are the lines in my script.use Math::GSL::RNG qw/:all/;
use Math::GSL::Randist qw/:all/;
my $rng = Math::GSL::RNG->new;
my @random = map {gsl_rng_uniform($rng)} (1..20);
#gsl_ran_lognormal($rng, 1.0, 0.2);perl (GSL) complains "TypeError in method 'gsl_rng_uniform', argument 1 of type 'gsl_rng const *'". The same occurs for lognormal commented out.Can you show me a few lines how the structure should be passed? Thanks in advance.I am using perl v5.10 and MATH:GSL 0.10 on MS Windows.RegardsJingshengDr. Jingsheng MaInstitute of Petroleum EngineeringHeriot-Watt UniversityEdinburgh, ScotlandTel: 00 44 (0)131 451 8296Email: Jingsh...@pet.hw.ac.uk
Hi Jingsheng,
I see you're using ActivePerl.
If you're using the ppm available from the uwinnipeg repository, it should
be updated to version 0.14 early next week.
If you can't wait until then for the update, and let me know in the next 12
hours (before I leave for the weekend), I could probably find the time to
send you the Math-GSL-0.14 ppm package.
Cheers,
Rob