.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "RNG 3pm" .TH RNG 3pm "2014-12-17" "perl v5.20.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" PDL::GSL::RNG \- PDL interface to RNG and randist routines in GSL .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is an interface to the rng and randist packages present in the \s-1GNU\s0 Scientific Library. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use PDL; \& use PDL::GSL::RNG; \& \& $rng = PDL::GSL::RNG\->new(\*(Aqtaus\*(Aq); \& \& $rng\->set_seed(time()); \& \& $a=zeroes(5,5,5) \& \& $rng\->get_uniform($a); # inplace \& \& $b=$rng\->get_uniform(3,4,5); # creates new pdl .Ve .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "\fInew()\fP" .IX Subsection "new()" The new method initializes a new instance of the \s-1RNG.\s0 .PP The avaible RNGs are: coveyou cmrg fishman18 fishman20 fishman2x gfsr4 knuthran knuthran2 knuthran2002 lecuyer21 minstd mrg mt19937 mt19937_1999 mt19937_1998 r250 ran0 ran1 ran2 ran3 rand rand48 random128_bsd random128_glibc2 random128_libc5 random256_bsd random256_glibc2 random256_libc5 random32_bsd random32_glibc2 random32_libc5 random64_bsd random64_glibc2 random64_libc5 random8_bsd random8_glibc2 random8_libc5 random_bsd random_glibc2 random_libc5 randu ranf ranlux ranlux389 ranlxd1 ranlxd2 ranlxs0 ranlxs1 ranlxs2 ranmar slatec taus taus2 taus113 transputer tt800 uni uni32 vax waterman14 zuf default The last one (default) uses the enviroment variable \&\s-1GSL_RNG_TYPE.\s0 Note that only a few of these rngs are recommended for general use. Please check the \s-1GSL\s0 documentation for more information. .PP Usage: .PP .Vb 1 \& $blessed_ref = PDL::GSL::RNG\->new($RNG_name); .Ve .PP Example: .PP .Vb 1 \& $rng = PDL::GSL::RNG\->new(\*(Aqtaus\*(Aq); .Ve .SS "\fIset_seed()\fP;" .IX Subsection "set_seed();" Sets the \s-1RNG\s0 seed. .PP Usage: .PP .Vb 1 \& $rng\->set_seed($integer); .Ve .PP Example: .PP .Vb 1 \& $rng\->set_seed(666); .Ve .SS "\fImin()\fP" .IX Subsection "min()" Return the minimum value generable by this \s-1RNG.\s0 .PP Usage: .PP .Vb 1 \& $integer = $rng\->min(); .Ve .PP Example: .PP .Vb 1 \& $min = $rng\->min(); $max = $rng\->max(); .Ve .SS "\fImax()\fP" .IX Subsection "max()" Return the maximum value generable by the \s-1RNG.\s0 .PP Usage: .PP .Vb 1 \& $integer = $rng\->max(); .Ve .PP Example: .PP .Vb 1 \& $min = $rng\->min(); $max = $rng\->max(); .Ve .SS "\fIname()\fP" .IX Subsection "name()" Returns the name of the \s-1RNG.\s0 .PP Usage: .PP .Vb 1 \& $string = $rng\->name(); .Ve .PP Example: .PP .Vb 1 \& $name = $rng\->name(); .Ve .SS "\fIget_uniform()\fP" .IX Subsection "get_uniform()" This function creates a piddle with given dimensions or accept an existing piddle and fills it. \fIget_uniform()\fR returns values 0<=x<1, .PP Usage: .PP .Vb 2 \& $piddle = $rng\->get_uniform($list_of_integers) \& $rng\->get_uniform($piddle); .Ve .PP Example: .PP .Vb 2 \& $a = zeroes 5,6; $max=100; \& $o = $rng\->get_uniform(10,10); $rng\->get_uniform($a); .Ve .SS "\fIget_uniform_pos()\fP" .IX Subsection "get_uniform_pos()" This function creates a piddle with given dimensions or accept an existing piddle and fills it. \fIget_uniform_pos()\fR returns values 0get_uniform_pos($list_of_integers) \& $rng\->get_uniform_pos($piddle); .Ve .PP Example: .PP .Vb 2 \& $a = zeroes 5,6; \& $o = $rng\->get_uniform_pos(10,10); $rng\->get_uniform_pos($a); .Ve .SS "\fIget()\fP" .IX Subsection "get()" This function creates a piddle with given dimensions or accept an existing piddle and fills it. \fIget()\fR returns integer values beetween a minimum and a maximum specific to evry \s-1RNG.\s0 .PP Usage: .PP .Vb 2 \& $piddle = $rng\->get($list_of_integers) \& $rng\->get($piddle); .Ve .PP Example: .PP .Vb 2 \& $a = zeroes 5,6; \& $o = $rng\->get(10,10); $rng\->get($a); .Ve .SS "\fIget_int()\fP" .IX Subsection "get_int()" This function creates a piddle with given dimensions or accept an existing piddle and fills it. \fIget_int()\fR returns integer values beetween 0 and \f(CW$max\fR. .PP Usage: .PP .Vb 2 \& $piddle = $rng\->get($max, $list_of_integers) \& $rng\->get($max, $piddle); .Ve .PP Example: .PP .Vb 2 \& $a = zeroes 5,6; $max=100; \& $o = $rng\->get(10,10); $rng\->get($a); .Ve .SS "\fIran_gaussian()\fP" .IX Subsection "ran_gaussian()" These functions return random deviates from given distribution. .PP The general form is .PP .Vb 1 \& ran_[distrib](args) .Ve .PP where distrib can be any of the ones shown below. .PP They accept the parameters of the distribution and a specification of where to put output. This spec can be in form of list of integers that specify the dimensions of the ouput piddle or an existing piddle that will be filled with values inplace. .PP Usage: .PP .Vb 3 \& # gaussian dist \& $piddle = $rng\->ran_gaussian($sigma,[list of integers]); \& $rng\->ran_gaussian($sigma,$piddle); \& \& # gaussian tail \& $piddle = $rng\->ran_ugaussian_tail($tail,[list of integers]); \& $rng\->ran_ugaussian_tail($tail,$piddle); \& \& # exponential dist \& $piddle = $rng\->ran_exponential($mu,[list of integers]); \& $rng\->ran_exponential($mu,$piddle); \& \& # laplacian dist \& $piddle = $rng\->ran_laplace($mu,[list of integers]); \& $rng\->ran_laplace($mu,$piddle); \& \& $piddle = $rng\->ran_exppow($mu,$a,[list of integers]); \& $rng\->ran_exppow($mu,$a,$piddle); \& \& $piddle = $rng\->ran_cauchy($mu,[list of integers]); \& $rng\->ran_cauchy($mu,$piddle); \& \& $piddle = $rng\->ran_rayleigh($sigma,[list of integers]); \& $rng\->ran_rayleigh($sigma,$piddle); \& \& $piddle = $rng\->ran_rayleigh_tail($a,$sigma,[list of integers]); \& $rng\->ran_rayleigh_tail($a,$sigma,$piddle); \& \& $piddle = $rng\->ran_levy($mu,$a,[list of integers]); \& $rng\->ran_levy($mu,$a,$piddle); \& \& $piddle = $rng\->ran_gamma($a,$b,[list of integers]); \& $rng\->ran_gamma($a,$b,$piddle); \& \& $piddle = $rng\->ran_flat($a,$b,[list of integers]); \& $rng\->ran_flat($a,$b,$piddle); \& \& $piddle = $rng\->ran_lognormal($zeta, $sigma,[list of integers]); \& $rng\->ran_lognormal($zeta, $sigma,$piddle); \& \& $piddle = $rng\->ran_chisq($nu,[list of integers]); \& $rng\->ran_chisq($nu,$piddle); \& \& $piddle = $rng\->ran_fdist($nu1, $nu2,[list of integers]); \& $rng\->ran_fdist($nu1, $nu2,$piddle); \& \& $piddle = $rng\->ran_tdist($nu,[list of integers]); \& $rng\->ran_tdist($nu,$piddle); \& \& $piddle = $rng\->ran_beta($a,$b,[list of integers]); \& $rng\->ran_beta($a,$b,$piddle); \& \& $piddle = $rng\->ran_logistic($m,[list of integers]u) \& $rng\->ran_logistic($m,$piddleu) \& \& $piddle = $rng\->ran_pareto($a,$b,[list of integers]); \& $rng\->ran_pareto($a,$b,$piddle); \& \& $piddle = $rng\->ran_weibull($mu,$a,[list of integers]); \& $rng\->ran_weibull($mu,$a,$piddle); \& \& $piddle = $rng\->ran_gumbel1($a,$b,[list of integers]); \& $rng\->ran_gumbel1($a,$b,$piddle); \& \& $piddle = $rng\->ran_gumbel2($a,$b,[list of integers]); \& $rng\->ran_gumbel2($a,$b,$piddle); \& \& $piddle = $rng\->ran_poisson($mu,[list of integers]); \& $rng\->ran_poisson($mu,$piddle); \& \& $piddle = $rng\->ran_bernoulli($p,[list of integers]); \& $rng\->ran_bernoulli($p,$piddle); \& \& $piddle = $rng\->ran_binomial($p,$n,[list of integers]); \& $rng\->ran_binomial($p,$n,$piddle); \& \& $piddle = $rng\->ran_negative_binomial($p,$n,[list of integers]); \& $rng\->ran_negative_binomial($p,$n,$piddle); \& \& $piddle = $rng\->ran_pascal($p,$n,[list of integers]); \& $rng\->ran_pascal($p,$n,$piddle); \& \& $piddle = $rng\->ran_geometric($p,[list of integers]); \& $rng\->ran_geometric($p,$piddle); \& \& $piddle = $rng\->ran_hypergeometric($n1, $n2, $t,[list of integers]); \& $rng\->ran_hypergeometric($n1, $n2, $t,$piddle); \& \& $piddle = $rng\->ran_logarithmic($p,[list of integers]); \& $rng\->ran_logarithmic($p,$piddle); .Ve .PP Example: .PP .Vb 2 \& $o = $rng\->ran_gaussian($sigma,10,10); \& $rng\->ran_gaussian($sigma,$a); .Ve .SS "\fIran_gaussian_var()\fP" .IX Subsection "ran_gaussian_var()" This method is similar to ran_[distrib]() except that it takes the parameters of the distribution as a piddle and returns a piddle of equal dimensions. Of course, you can use the same set of distributions as in the previous method (see also the ran_gaussian entry above). .PP Usage: .PP .Vb 2 \& $piddle = $rng\->ran_[distribution]_var($distr_parameters_list,$piddle_dim_list); \& $rng\->ran_[distribution]_var($distr_parameters_list,$piddle); .Ve .PP Example: .PP .Vb 2 \& $sigma_pdl = rvals zeroes 11,11; \& $o = $rng\->ran_gaussian_var($sigma_pdl); .Ve .SS "\fIran_additive_gaussian()\fP" .IX Subsection "ran_additive_gaussian()" Add Gaussian noise of given sigma to a piddle. .PP Usage: .PP .Vb 1 \& $rng\->ran_additive_gaussian($sigma,$piddle); .Ve .PP Example: .PP .Vb 1 \& $rng\->ran_additive_gaussian(1,$image); .Ve .SS "\fIran_additive_poisson()\fP" .IX Subsection "ran_additive_poisson()" Add Poisson noise of given sigma to a piddle. .PP Usage: .PP .Vb 1 \& $rng\->ran_additive_poisson($mu,$piddle); .Ve .PP Example: .PP .Vb 1 \& $rng\->ran_additive_poisson(1,$image); .Ve .SS "\fIran_feed_poisson()\fP" .IX Subsection "ran_feed_poisson()" This method simulates shot noise, taking the values of piddle as values for mu to be fed in the poissonian \s-1RNG.\s0 .PP Usage: .PP .Vb 1 \& $rng\->ran_feed_poisson($piddle); .Ve .PP Example: .PP .Vb 1 \& $rng\->ran_feed_poisson($image); .Ve .SS "\fIran_bivariate_gaussian()\fP" .IX Subsection "ran_bivariate_gaussian()" Generates \f(CW$n\fR bivariate gaussian random deviates. .PP Usage: .PP .Vb 1 \& $piddle = $rng\->ran_bivariate_gaussian($sigma_x,$sigma_y,$rho,$n); .Ve .PP Example: .PP .Vb 1 \& $o = $rng\->ran_bivariate_gaussian(1,2,0.5,1000); .Ve .SS "\fIran_dir()\fP" .IX Subsection "ran_dir()" Returns \f(CW$n\fR random vectors in \f(CW$ndim\fR dimensions. .PP Usage: .PP .Vb 1 \& $piddle = $rng\->ran_dir($ndim,$n); .Ve .PP Example: .PP .Vb 1 \& $o = $rng\->ran_dir($ndim,$n); .Ve .SS "\fIran_discrete_preproc()\fP" .IX Subsection "ran_discrete_preproc()" This method returns a handle that must be used when calling \&\fIran_discrete()\fR. You specify the probability of the integer number that are returned by \fIran_discrete()\fR. .PP Usage: .PP .Vb 1 \& $discrete_dist_handle = $rng\->ran_discrete_preproc($double_piddle_prob); .Ve .PP Example: .PP .Vb 3 \& $prob = pdl [0.1,0.3,0.6]; \& $ddh = $rng\->ran_discrete_preproc($prob); \& $o = $rng\->ran_discrete($discrete_dist_handle,100); .Ve .SS "\fIran_discrete()\fP" .IX Subsection "ran_discrete()" Is used to get the desired samples once a proper handle has been enstablished (see \fIran_discrete_preproc()\fR). .PP Usage: .PP .Vb 1 \& $piddle = $rng\->ran_discrete($discrete_dist_handle,$num); .Ve .PP Example: .PP .Vb 3 \& $prob = pdl [0.1,0.3,0.6]; \& $ddh = $rng\->ran_discrete_preproc($prob); \& $o = $rng\->ran_discrete($discrete_dist_handle,100); .Ve .SS "\fIran_shuffle()\fP" .IX Subsection "ran_shuffle()" Shuffles values in piddle .PP Usage: .PP .Vb 1 \& $rng\->ran_shuffle($piddle); .Ve .SS "\fIran_shuffle_vec()\fP" .IX Subsection "ran_shuffle_vec()" Shuffles values in piddle .PP Usage: .PP .Vb 1 \& $rng\->ran_shuffle_vec(@vec); .Ve .SS "\fIran_choose()\fP" .IX Subsection "ran_choose()" Chooses values from \f(CW$inpiddle\fR to \f(CW$outpiddle\fR. .PP Usage: .PP .Vb 1 \& $rng\->ran_choose($inpiddle,$outpiddle); .Ve .SS "\fIran_choose_vec()\fP" .IX Subsection "ran_choose_vec()" Chooses \f(CW$n\fR values from \f(CW@vec\fR. .PP Usage: .PP .Vb 1 \& @choosen = $rng\->ran_choose_vec($n,@vec); .Ve .SS "\fIran_ver()\fP" .IX Subsection "ran_ver()" Returns a piddle with \f(CW$n\fR values generated by the Verhulst map from \f(CW$x0\fR and paramater \f(CW$r\fR. .PP Usage: .PP .Vb 1 \& $rng\->ran_ver($x0, $r, $n); .Ve .SS "\fIran_caos()\fP" .IX Subsection "ran_caos()" Returns values from Verhuls map with \f(CW$r\fR=4.0 and randomly choosen \&\f(CW$x0\fR. The values are scaled by \f(CW$m\fR. .PP Usage: .PP .Vb 1 \& $rng\->ran_caos($m,$n); .Ve .SH "BUGS" .IX Header "BUGS" Feedback is welcome. Log bugs in the \s-1PDL\s0 bug database (the database is always linked from ). .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1PDL\s0 .PP The \s-1GSL\s0 documentation is online at .SH "AUTHOR" .IX Header "AUTHOR" This file copyright (C) 1999 Christian Pellegrin Docs mangled by C. Soeller. All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file \&\s-1COPYING\s0 in the \s-1PDL\s0 distribution. If this file is separated from the \&\s-1PDL\s0 distribution, the copyright notice should be included in the file. .PP The \s-1GSL RNG\s0 and randist modules were written by James Theiler.