Adding documentation and a few typemaps to Statistics
[Math-GSL.git] / Statistics.i
blobaa3572c5bcbb0ce084aa32c21dc2e9c9eebe5e84
1 %module "Math::GSL::Statistics"
3 %include "typemaps.i"
4 %include "gsl_typemaps.i"
6 %apply double *OUTPUT { double * min, double * max };
8 %apply int *OUTPUT { size_t * min_index, size_t * max_index };
11 #include "gsl/gsl_statistics_double.h"
12 #include "gsl/gsl_statistics_int.h"
13 #include "gsl/gsl_statistics_char.h"
16 %include "gsl/gsl_statistics_double.h"
17 %include "gsl/gsl_statistics_int.h"
18 %include "gsl/gsl_statistics_char.h"
21 %perlcode %{
22 @EXPORT_OK = qw/
23 gsl_stats_mean
24 gsl_stats_variance
25 gsl_stats_sd
26 gsl_stats_variance_with_fixed_mean
27 gsl_stats_sd_with_fixed_mean
28 gsl_stats_tss
29 gsl_stats_tss_m
30 gsl_stats_absdev
31 gsl_stats_skew
32 gsl_stats_kurtosis
33 gsl_stats_lag1_autocorrelation
34 gsl_stats_covariance
35 gsl_stats_correlation
36 gsl_stats_variance_m
37 gsl_stats_sd_m
38 gsl_stats_absdev_m
39 gsl_stats_skew_m_sd
40 gsl_stats_kurtosis_m_sd
41 gsl_stats_lag1_autocorrelation_m
42 gsl_stats_covariance_m
43 gsl_stats_wmean
44 gsl_stats_wvariance
45 gsl_stats_wsd
46 gsl_stats_wvariance_with_fixed_mean
47 gsl_stats_wsd_with_fixed_mean
48 gsl_stats_wtss
49 gsl_stats_wtss_m
50 gsl_stats_wabsdev
51 gsl_stats_wskew
52 gsl_stats_wkurtosis
53 gsl_stats_wvariance_m
54 gsl_stats_wsd_m
55 gsl_stats_wabsdev_m
56 gsl_stats_wskew_m_sd
57 gsl_stats_wkurtosis_m_sd
58 gsl_stats_pvariance
59 gsl_stats_ttest
60 gsl_stats_max
61 gsl_stats_min
62 gsl_stats_minmax
63 gsl_stats_max_index
64 gsl_stats_min_index
65 gsl_stats_minmax_index
66 gsl_stats_median_from_sorted_data
67 gsl_stats_quantile_from_sorted_data
69 our @EXPORT_int = qw/
70 gsl_stats_int_mean
71 gsl_stats_int_variance
72 gsl_stats_int_sd
73 gsl_stats_int_variance_with_fixed_mean
74 gsl_stats_int_sd_with_fixed_mean
75 gsl_stats_int_tss
76 gsl_stats_int_tss_m
77 gsl_stats_int_absdev
78 gsl_stats_int_skew
79 gsl_stats_int_kurtosis
80 gsl_stats_int_lag1_autocorrelation
81 gsl_stats_int_covariance
82 gsl_stats_int_correlation
83 gsl_stats_int_variance_m
84 gsl_stats_int_sd_m
85 gsl_stats_int_absdev_m
86 gsl_stats_int_skew_m_sd
87 gsl_stats_int_kurtosis_m_sd
88 gsl_stats_int_lag1_autocorrelation_m
89 gsl_stats_int_covariance_m
90 gsl_stats_int_pvariance
91 gsl_stats_int_ttest
92 gsl_stats_int_max
93 gsl_stats_int_min
94 gsl_stats_int_minmax
95 gsl_stats_int_max_index
96 gsl_stats_int_min_index
97 gsl_stats_int_minmax_index
98 gsl_stats_int_median_from_sorted_data
99 gsl_stats_int_quantile_from_sorted_data
101 our @EXPORT_char = qw/
102 gsl_stats_char_mean
103 gsl_stats_char_variance
104 gsl_stats_char_sd
105 gsl_stats_char_variance_with_fixed_mean
106 gsl_stats_char_sd_with_fixed_mean
107 gsl_stats_char_tss
108 gsl_stats_char_tss_m
109 gsl_stats_char_absdev
110 gsl_stats_char_skew
111 gsl_stats_char_kurtosis
112 gsl_stats_char_lag1_autocorrelation
113 gsl_stats_char_covariance
114 gsl_stats_char_correlation
115 gsl_stats_char_variance_m
116 gsl_stats_char_sd_m
117 gsl_stats_char_absdev_m
118 gsl_stats_char_skew_m_sd
119 gsl_stats_char_kurtosis_m_sd
120 gsl_stats_char_lag1_autocorrelation_m
121 gsl_stats_char_covariance_m
122 gsl_stats_char_pvariance
123 gsl_stats_char_ttest
124 gsl_stats_char_max
125 gsl_stats_char_min
126 gsl_stats_char_minmax
127 gsl_stats_char_max_index
128 gsl_stats_char_min_index
129 gsl_stats_char_minmax_index
130 gsl_stats_char_median_from_sorted_data
131 gsl_stats_char_quantile_from_sorted_data
133 push @EXPORT_OK, @EXPORT_int, @EXPORT_char;
134 %EXPORT_TAGS = (
135 all => \@EXPORT_OK,
136 int => \@EXPORT_int,
137 char => \@EXPORT_char
139 __END__
141 =head1 NAME
143 Math::GSL::Statistics - Statistical functions
145 =head1 SYNOPSIS
147 use Math::GSL::Statistics qw /:all/;
149 =head1 DESCRIPTION
151 Here is a list of all the functions in this module :
153 =over 2
155 =item * C<gsl_stats_mean($data, $stride, $n)> - This function returns the arithmetic mean of the array reference $data, a dataset of length $n with stride $stride. The arithmetic mean, or sample mean, is denoted by \Hat\mu and defined as, \Hat\mu = (1/N) \sum x_i where x_i are the elements of the dataset $data. For samples drawn from a gaussian distribution the variance of \Hat\mu is \sigma^2 / N.
157 =item * C<gsl_stats_variance($data, $stride, $n)>
159 =item * C<gsl_stats_sd($data, $stride, $n)>
161 =item * C<gsl_stats_sd_m($data, $stride, $n, $mean)>
163 =item * C<gsl_stats_variance_with_fixed_mean($data, $stride, $n, $mean)>
165 =item * C<gsl_stats_sd_with_fixed_mean($data, $stride, $n, $mean)>
167 =item * C<gsl_stats_tss($data, $stride, $n)>
169 =item * C<gsl_stats_tss_m($data, $stride, $n, $mean)>
171 =item * C<gsl_stats_absdev($data, $stride, $n)>
173 =item * C<gsl_stats_skew($data, $stride, $n)>
175 =item * C<gsl_stats_skew_m_sd($data, $stride, $n, $mean, $sd)>
177 =item * C<gsl_stats_kurtosis($data, $stride, $n)>
179 =item * C<gsl_stats_kurtosis_m_sd($data, $stride, $n, $mean, $sd)>
181 =item * C<gsl_stats_lag1_autocorrelation($data, $stride, $n)>
183 =item * C<gsl_stats_lag1_autocorrelation_m($data, $stride, $n, $mean)>
185 =item * C<gsl_stats_covariance($data1, $stride1, $data2, $stride2, $n)>
187 =item * C<gsl_stats_covariance_m($data1, $stride1, $data2, $stride2, $n, $mean1, $mean2)>
189 =item * C<gsl_stats_correlation($data1, $stride1, $data2, $stride2, $n)>
191 =item * C<gsl_stats_variance_m($data, $stride, $n, $mean)>
193 =item * C<gsl_stats_absdev_m >
195 =item * C<gsl_stats_wmean($w, $wstride, $data, $stride, $n)> - This function returns the weighted mean of the dataset $data array reference with stride $stride and length $n, using the set of weights $w, which is an array reference, with stride $wstride and length $n. The weighted mean is defined as, \Hat\mu = (\sum w_i x_i) / (\sum w_i)
197 =item * C<gsl_stats_wvariance($w, $wstride, $data, $stride, $n)>
199 =item * C<gsl_stats_wsd($w, $wstride, $data, $stride, $n)>
201 =item * C<gsl_stats_wsd_m($w, $wstride, $data, $stride, $n, $wmean)>
203 =item * C<gsl_stats_wvariance_with_fixed_mean($w, $wstride, $data, $stride, $n, $mean)>
205 =item * C<gsl_stats_wsd_with_fixed_mean($w, $wstride, $data, $stride, $n, $mean)>
207 =item * C<gsl_stats_wtss($w, $wstride, $data, $stride, $n)>
209 =item * C<gsl_stats_wtss_m($w, $wstride, $data, $stride, $n, $wmean)>
211 =item * C<gsl_stats_wabsdev($w, $wstride, $data, $stride, $n)>
213 =item * C<gsl_stats_wabsdev_m($w, $wstride, $data, $stride, $n, $wmean)>
215 =item * C<gsl_stats_wskew($w, $wstride, $data, $stride, $n)>
217 =item * C<gsl_stats_wskew_m_sd($w, $wstride, $data, $stride, $n, $wmean, $wsd)>
219 =item * C<gsl_stats_wkurtosis($w, $wstride, $data, $stride, $n)>
221 =item * C<gsl_stats_wvariance_m($w, $wstride, $data, $stride, $n, $wmean, $wsd)>
223 =item * C<gsl_stats_wkurtosis_m_sd($w, $wstride, $data, $stride, $n, $wmean, $wsd)>
225 =item * C<gsl_stats_pvariance >
227 =item * C<gsl_stats_ttest >
229 =item * C<gsl_stats_max($data, $stride, $n)> - This function returns the maximum value in the $data array reference, a dataset of length $n with stride $stride. The maximum value is defined as the value of the element x_i which satisfies x_i >= x_j for all j. If you want instead to find the element with the largest absolute magnitude you will need to apply fabs or abs to your data before calling this function.
231 =item * C<gsl_stats_min($data, $stride, $n)>
233 =item * C<gsl_stats_minmax($data, $stride, $n)> - This function finds both the minimum and maximum values in $data, which is an array reference, in a single pass and returns them in this order.
235 =item * C<gsl_stats_max_index($data, $stride, $n)>
237 =item * C<gsl_stats_min_index($data, $stride, $n)>
239 =item * C<gsl_stats_minmax_index($data, $stride, $n)>
241 =item * C<gsl_stats_median_from_sorted_data($data, $stride, $n)>
243 =item * C<gsl_stats_quantile_from_sorted_data($data, $stride, $n, $f)>
245 =back
247 The following function are simply variants for int and char of the last functions:
249 =over 4
251 =item * C<gsl_stats_int_mean >
253 =item * C<gsl_stats_int_variance >
255 =item * C<gsl_stats_int_sd >
257 =item * C<gsl_stats_int_variance_with_fixed_mean >
259 =item * C<gsl_stats_int_sd_with_fixed_mean >
261 =item * C<gsl_stats_int_tss >
263 =item * C<gsl_stats_int_tss_m >
265 =item * C<gsl_stats_int_absdev >
267 =item * C<gsl_stats_int_skew >
269 =item * C<gsl_stats_int_kurtosis >
271 =item * C<gsl_stats_int_lag1_autocorrelation >
273 =item * C<gsl_stats_int_covariance >
275 =item * C<gsl_stats_int_correlation >
277 =item * C<gsl_stats_int_variance_m >
279 =item * C<gsl_stats_int_sd_m >
281 =item * C<gsl_stats_int_absdev_m >
283 =item * C<gsl_stats_int_skew_m_sd >
285 =item * C<gsl_stats_int_kurtosis_m_sd >
287 =item * C<gsl_stats_int_lag1_autocorrelation_m >
289 =item * C<gsl_stats_int_covariance_m >
291 =item * C<gsl_stats_int_pvariance >
293 =item * C<gsl_stats_int_ttest >
295 =item * C<gsl_stats_int_max >
297 =item * C<gsl_stats_int_min >
299 =item * C<gsl_stats_int_minmax >
301 =item * C<gsl_stats_int_max_index >
303 =item * C<gsl_stats_int_min_index >
305 =item * C<gsl_stats_int_minmax_index >
307 =item * C<gsl_stats_int_median_from_sorted_data >
309 =item * C<gsl_stats_int_quantile_from_sorted_data >
311 =item * C<gsl_stats_char_mean >
313 =item * C<gsl_stats_char_variance >
315 =item * C<gsl_stats_char_sd >
317 =item * C<gsl_stats_char_variance_with_fixed_mean >
319 =item * C<gsl_stats_char_sd_with_fixed_mean >
321 =item * C<gsl_stats_char_tss >
323 =item * C<gsl_stats_char_tss_m >
325 =item * C<gsl_stats_char_absdev >
327 =item * C<gsl_stats_char_skew >
329 =item * C<gsl_stats_char_kurtosis >
331 =item * C<gsl_stats_char_lag1_autocorrelation >
333 =item * C<gsl_stats_char_covariance >
335 =item * C<gsl_stats_char_correlation >
337 =item * C<gsl_stats_char_variance_m >
339 =item * C<gsl_stats_char_sd_m >
341 =item * C<gsl_stats_char_absdev_m >
343 =item * C<gsl_stats_char_skew_m_sd >
345 =item * C<gsl_stats_char_kurtosis_m_sd >
347 =item * C<gsl_stats_char_lag1_autocorrelation_m >
349 =item * C<gsl_stats_char_covariance_m >
351 =item * C<gsl_stats_char_pvariance >
353 =item * C<gsl_stats_char_ttest >
355 =item * C<gsl_stats_char_max >
357 =item * C<gsl_stats_char_min >
359 =item * C<gsl_stats_char_minmax >
361 =item * C<gsl_stats_char_max_index >
363 =item * C<gsl_stats_char_min_index >
365 =item * C<gsl_stats_char_minmax_index >
367 =item * C<gsl_stats_char_median_from_sorted_data >
369 =item * C<gsl_stats_char_quantile_from_sorted_data >
371 =back
373 You have to add the functions you want to use inside the qw /put_funtion_here /.
374 You can also write use Math::GSL::Randist qw/:all/; to use all avaible functions of the module.
375 Other tags are also avaible, here is a complete list of all tags for this module :
377 =over
379 =item all
381 =item int
383 =item char
385 =back
387 For more informations on the functions, we refer you to the GSL offcial
388 documentation: L<http://www.gnu.org/software/gsl/manual/html_node/>
390 Tip : search on google: site:http://www.gnu.org/software/gsl/manual/html_node/ name_of_the_function_you_want
393 =head1 AUTHORS
395 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
397 =head1 COPYRIGHT AND LICENSE
399 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
401 This program is free software; you can redistribute it and/or modify it
402 under the same terms as Perl itself.
404 =cut