11 croak
("Argument $argnum is not a reference.");
12 if
(SvTYPE
(SvRV
($input
)) != SVt_PVAV
)
13 croak
("Argument $argnum is not an array.");
15 tempav
= (AV
*)SvRV
($input
);
17 $
1 = (int
**) malloc
((len
+2)*sizeof
(int
*));
18 for
(i
= 0; i
<= len
; i
++) {
19 tv
= av_fetch
(tempav
, i
, 0);
21 memset
((int
*)($
1+i
), x
, 1);
22 //printf
("curr = %d\n", (int
)($
1+i
) );
25 %typemap
(freearg
) void
* {
30 #include
"/usr/local/include/gsl/gsl_randist.h"
32 %include
"/usr/local/include/gsl/gsl_randist.h"
36 our @EXPORT_OK
= qw
/gsl_ran_bernoulli gsl_ran_bernoulli_pdf gsl_ran_beta
37 gsl_ran_beta_pdf gsl_ran_binomial gsl_ran_binomial_knuth
38 gsl_ran_binomial_tpe gsl_ran_binomial_pdf gsl_ran_exponential
39 gsl_ran_exponential_pdf gsl_ran_exppow gsl_ran_exppow_pdf
40 gsl_ran_cauchy gsl_ran_cauchy_pdf gsl_ran_chisq
41 gsl_ran_chisq_pdf gsl_ran_dirichlet gsl_ran_dirichlet_pdf
42 gsl_ran_dirichlet_lnpdf gsl_ran_erlang gsl_ran_erlang_pdf
43 gsl_ran_fdist gsl_ran_fdist_pdf gsl_ran_flat
44 gsl_ran_flat_pdf gsl_ran_gamma gsl_ran_gamma_int
45 gsl_ran_gamma_pdf gsl_ran_gamma_mt gsl_ran_gamma_knuth
46 gsl_ran_gaussian gsl_ran_gaussian_ratio_method gsl_ran_gaussian_ziggurat
47 gsl_ran_gaussian_pdf gsl_ran_ugaussian gsl_ran_ugaussian_ratio_method
48 gsl_ran_ugaussian_pdf gsl_ran_gaussian_tail gsl_ran_gaussian_tail_pdf
49 gsl_ran_ugaussian_tail gsl_ran_ugaussian_tail_pdf gsl_ran_bivariate_gaussian
50 gsl_ran_bivariate_gaussian_pdf gsl_ran_landau gsl_ran_landau_pdf
51 gsl_ran_geometric gsl_ran_geometric_pdf gsl_ran_hypergeometric
52 gsl_ran_hypergeometric_pdf gsl_ran_gumbel1 gsl_ran_gumbel1_pdf
53 gsl_ran_gumbel2 gsl_ran_gumbel2_pdf gsl_ran_logistic
54 gsl_ran_logistic_pdf gsl_ran_lognormal gsl_ran_lognormal_pdf
55 gsl_ran_logarithmic gsl_ran_logarithmic_pdf gsl_ran_multinomial
56 gsl_ran_multinomial_pdf gsl_ran_multinomial_lnpdf
57 gsl_ran_negative_binomial gsl_ran_negative_binomial_pdf gsl_ran_pascal
58 gsl_ran_pascal_pdf gsl_ran_pareto gsl_ran_pareto_pdf
59 gsl_ran_poisson gsl_ran_poisson_array
60 gsl_ran_poisson_pdf gsl_ran_rayleigh gsl_ran_rayleigh_pdf
61 gsl_ran_rayleigh_tail gsl_ran_rayleigh_tail_pdf gsl_ran_tdist
62 gsl_ran_tdist_pdf gsl_ran_laplace gsl_ran_laplace_pdf
63 gsl_ran_levy gsl_ran_levy_skew gsl_ran_weibull
64 gsl_ran_weibull_pdf gsl_ran_dir_2d gsl_ran_dir_2d_trig_method
65 gsl_ran_dir_3d gsl_ran_dir_nd gsl_ran_shuffle
66 gsl_ran_choose gsl_ran_sample
67 gsl_ran_discrete_t gsl_ran_discrete_free
68 gsl_ran_discrete gsl_ran_discrete_pdf
72 all
=> [ @EXPORT_OK
],
73 logarithmic
=> [ gsl_ran_logarithmic
, gsl_ran_logarithmic_pdf
],
74 choose
=> [ gsl_ran_choose
],
75 exponential
=> [ gsl_ran_exponential
, gsl_ran_exponential_pdf
],
76 gumbel1
=> [ gsl_ran_gumbel1
, gsl_ran_gumbel1_pdf
],
77 exppow
=> [ gsl_ran_exppow
, gsl_ran_exppow_pdf
],
78 sample
=> [ gsl_ran_sample
],
79 logistic
=> [ gsl_ran_logistic
, gsl_ran_logistic_pdf
],
81 gsl_ran_gaussian
, gsl_ran_gaussian_ratio_method
, gsl_ran_gaussian_ziggurat
,
82 gsl_ran_gaussian_pdf
, gsl_ran_gaussian_tail
, gsl_ran_gaussian_tail_pdf
84 poisson
=> [ gsl_ran_poisson
, gsl_ran_poisson_array
, gsl_ran_poisson_pdf
],
85 binomial
=> [ gsl_ran_binomial
, gsl_ran_binomial_knuth
, gsl_ran_binomial_tpe
,
86 gsl_ran_binomial_pdf
],
87 fdist
=> [ gsl_ran_fdist
, gsl_ran_fdist_pdf
],
88 chisq
=> [ gsl_ran_chisq
, gsl_ran_chisq_pdf
],
89 gamma
=> [ gsl_ran_gamma
, gsl_ran_gamma_int
, gsl_ran_gamma_pdf
, gsl_ran_gamma_mt
, gsl_ran_gamma_knuth
],
90 hypergeometric
=> [ gsl_ran_hypergeometric
, gsl_ran_hypergeometric_pdf
],
91 dirichlet
=> [ gsl_ran_dirichlet
, gsl_ran_dirichlet_pdf
, gsl_ran_dirichlet_lnpdf
],
92 negative
=> [ gsl_ran_negative_binomial
, gsl_ran_negative_binomial_pdf
],
93 flat
=> [ gsl_ran_flat
, gsl_ran_flat_pdf
],
94 geometric
=> [ gsl_ran_geometric
, gsl_ran_geometric_pdf
],
95 discrete
=> [ gsl_ran_discrete
, gsl_ran_discrete_pdf
],
96 tdist
=> [ gsl_ran_tdist
, gsl_ran_tdist_pdf
],
97 ugaussian
=> [ gsl_ran_ugaussian
, gsl_ran_ugaussian_ratio_method
, gsl_ran_ugaussian_pdf
,
98 gsl_ran_ugaussian_tail
, gsl_ran_ugaussian_tail_pdf
],
99 rayleigh
=> [ gsl_ran_rayleigh
, gsl_ran_rayleigh_pdf
, gsl_ran_rayleigh_tail
,
100 gsl_ran_rayleigh_tail_pdf
],
101 dir
=> [ gsl_ran_dir_2d
, gsl_ran_dir_2d_trig_method
, gsl_ran_dir_3d
, gsl_ran_dir_nd
],
102 pascal
=> [ gsl_ran_pascal
, gsl_ran_pascal_pdf
],
103 gumbel2
=> [ gsl_ran_gumbel2
, gsl_ran_gumbel2_pdf
],
104 shuffle
=> [ gsl_ran_shuffle
],
105 landau
=> [ gsl_ran_landau
, gsl_ran_landau_pdf
],
106 bernoulli
=> [ gsl_ran_bernoulli
, gsl_ran_bernoulli_pdf
],
107 weibull
=> [ gsl_ran_weibull
, gsl_ran_weibull_pdf
],
108 multinomial
=> [ gsl_ran_multinomial
, gsl_ran_multinomial_pdf
, gsl_ran_multinomial_lnpdf
],
109 beta
=> [ gsl_ran_beta
, gsl_ran_beta_pdf
],
110 lognormal
=> [ gsl_ran_lognormal
, gsl_ran_lognormal_pdf
],
111 laplace
=> [ gsl_ran_laplace
, gsl_ran_laplace_pdf
],
112 erlang
=> [ gsl_ran_erlang
, gsl_ran_erlang_pdf
],
113 cauchy
=> [ gsl_ran_cauchy
, gsl_ran_cauchy_pdf
],
114 levy
=> [ gsl_ran_levy
, gsl_ran_levy_skew
],
115 bivariate
=> [ gsl_ran_bivariate_gaussian
, gsl_ran_bivariate_gaussian_pdf
],
116 pareto
=> [ gsl_ran_pareto
, gsl_ran_pareto_pdf
]
123 Math
::GSL
::Randist
- Probability Distributions
127 use Math
::GSL
::Randist qw
/put_functions_here
/;
131 Here is a list of all the functions included in this module
:
133 gsl_ran_bernoulli gsl_ran_bernoulli_pdf gsl_ran_beta
134 gsl_ran_beta_pdf gsl_ran_binomial gsl_ran_binomial_knuth
135 gsl_ran_binomial_tpe gsl_ran_binomial_pdf gsl_ran_exponential
136 gsl_ran_exponential_pdf gsl_ran_exppow gsl_ran_exppow_pdf
137 gsl_ran_cauchy gsl_ran_cauchy_pdf gsl_ran_chisq
138 gsl_ran_chisq_pdf gsl_ran_dirichlet gsl_ran_dirichlet_pdf
139 gsl_ran_dirichlet_lnpdf gsl_ran_erlang gsl_ran_erlang_pdf
140 gsl_ran_fdist gsl_ran_fdist_pdf gsl_ran_flat
141 gsl_ran_flat_pdf gsl_ran_gamma gsl_ran_gamma_int
142 gsl_ran_gamma_pdf gsl_ran_gamma_mt gsl_ran_gamma_knuth
143 gsl_ran_gaussian gsl_ran_gaussian_ratio_method gsl_ran_gaussian_ziggurat
144 gsl_ran_gaussian_pdf gsl_ran_ugaussian gsl_ran_ugaussian_ratio_method
145 gsl_ran_ugaussian_pdf gsl_ran_gaussian_tail gsl_ran_gaussian_tail_pdf
146 gsl_ran_ugaussian_tail gsl_ran_ugaussian_tail_pdf gsl_ran_bivariate_gaussian
147 gsl_ran_bivariate_gaussian_pdf gsl_ran_landau gsl_ran_landau_pdf
148 gsl_ran_geometric gsl_ran_geometric_pdf gsl_ran_hypergeometric
149 gsl_ran_hypergeometric_pdf gsl_ran_gumbel1 gsl_ran_gumbel1_pdf
150 gsl_ran_gumbel2 gsl_ran_gumbel2_pdf gsl_ran_logistic
151 gsl_ran_logistic_pdf gsl_ran_lognormal gsl_ran_lognormal_pdf
152 gsl_ran_logarithmic gsl_ran_logarithmic_pdf gsl_ran_multinomial
153 gsl_ran_multinomial_pdf gsl_ran_multinomial_lnpdf
154 gsl_ran_negative_binomial gsl_ran_negative_binomial_pdf gsl_ran_pascal
155 gsl_ran_pascal_pdf gsl_ran_pareto gsl_ran_pareto_pdf
156 gsl_ran_poisson gsl_ran_poisson_array
157 gsl_ran_poisson_pdf gsl_ran_rayleigh gsl_ran_rayleigh_pdf
158 gsl_ran_rayleigh_tail gsl_ran_rayleigh_tail_pdf gsl_ran_tdist
159 gsl_ran_tdist_pdf gsl_ran_laplace gsl_ran_laplace_pdf
160 gsl_ran_levy gsl_ran_levy_skew gsl_ran_weibull
161 gsl_ran_weibull_pdf gsl_ran_dir_2d gsl_ran_dir_2d_trig_method
162 gsl_ran_dir_3d gsl_ran_dir_nd gsl_ran_shuffle
163 gsl_ran_choose gsl_ran_sample
164 gsl_ran_discrete gsl_ran_discrete_pdf
166 You have to add the functions you want to use inside the qw
/put_funtion_here
/. You can also write
168 use Math
::GSL
::Randist qw
/:name_of_tag
/
170 to use all avaible functions of the module. Other tags are also avaible
, here is a complete list of all tags for this module
:
211 For example the beta tag contains theses functions
: gsl_ran_beta
, gsl_ran_beta_pdf.
213 For more informations on the functions
, we refer you to the GSL offcial documentation
: http
://www.gnu.org
/software
/gsl
/manual
/html_node
/
214 Tip
: search on google
: site
:http
://www.gnu.org
/software
/gsl
/manual
/html_node
/ name_of_the_function_you_want
216 You might also want to write
218 use Math
::GSL
::RNG qw
/:all
/;
220 since a lot of the functions of Math
::GSL
::Randist take as argument a structure that is created by Math
::GSL
::RNG. Refer to Math
::GSL
::RNG documentation to see how to create such a structure.
222 Math
::GSL
::CDF also contains a structure named gsl_ran_discrete_t. An example is given in the EXAMPLES part on how to use the function related to this structure.
227 use Math
::GSL
::Randist qw
/:all
/;
228 print gsl_ran_exponential_pdf
(5,2) .
"\n";
230 use Math
::GSL
::Randist qw
/:all
/;
231 $x
= Math
::GSL
::gsl_ran_discrete_t
::new
;
236 Jonathan Leto
<jonathan@leto.net
> and Thierry Moisan
<thierry.moisan@gmail.com
>
238 =head1 COPYRIGHT
AND LICENSE
240 Copyright
(C
) 2008 Jonathan Leto and Thierry Moisan
242 This program is free software
; you can redistribute it and
/or modify it
243 under the same terms as Perl itself.