Adding basic documentation to Interp
[Math-GSL.git] / Histogram.i
blob3aae21136198053cfd40577d801d75d3968fbe2e
1 %module "Math::GSL::Histogram"
2 %include "typemaps.i"
3 %include "gsl_typemaps.i"
5 FILE * fopen(char *, char *);
6 int fclose(FILE *);
8 %{
9 #include "gsl/gsl_histogram.h"
12 %include "gsl/gsl_histogram.h"
15 %perlcode %{
16 @EXPORT_OK = qw/fopen fclose
17 gsl_histogram_alloc
18 gsl_histogram_calloc
19 gsl_histogram_calloc_uniform
20 gsl_histogram_free
21 gsl_histogram_increment
22 gsl_histogram_accumulate
23 gsl_histogram_find
24 gsl_histogram_get
25 gsl_histogram_get_range
26 gsl_histogram_max
27 gsl_histogram_min
28 gsl_histogram_bins
29 gsl_histogram_reset
30 gsl_histogram_calloc_range
31 gsl_histogram_set_ranges
32 gsl_histogram_set_ranges_uniform
33 gsl_histogram_memcpy
34 gsl_histogram_clone
35 gsl_histogram_max_val
36 gsl_histogram_max_bin
37 gsl_histogram_min_val
38 gsl_histogram_min_bin
39 gsl_histogram_equal_bins_p
40 gsl_histogram_add
41 gsl_histogram_sub
42 gsl_histogram_mul
43 gsl_histogram_div
44 gsl_histogram_scale
45 gsl_histogram_shift
46 gsl_histogram_sigma
47 gsl_histogram_mean
48 gsl_histogram_sum
49 gsl_histogram_fwrite
50 gsl_histogram_fread
51 gsl_histogram_fprintf
52 gsl_histogram_fscanf
53 gsl_histogram_pdf_alloc
54 gsl_histogram_pdf_init
55 gsl_histogram_pdf_free
56 gsl_histogram_pdf_sample
58 %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
60 =head1 NAME
62 Math::GSL::Histogram - Create and manipulate histograms of data
64 =head1 SYNOPSIS
66 use Math::GSL::Histogram qw/:all/;
68 my $H = gsl_histogram_alloc(100);
69 gsl_histogram_set_ranges_uniform($H,0,101);
70 gsl_histogram_increment($H, -50 ); # ignored
71 gsl_histogram_increment($H, 70 );
72 gsl_histogram_increment($H, 85.2 );
74 my $G = gsl_histogram_clone($H);
75 my $value = gsl_histogram_get($G, 70);
76 my ($max,$min) = (gsl_histogram_min_val($H), gsl_histogram_max_val($H) );
77 my $sum = gsl_histogram_sum($H);
79 =cut
81 =head1 DESCRIPTION
83 Here is a list of all the functions included in this module :
85 =over 1
87 =item C<gsl_histogram_alloc($n)> - This function allocates memory for a histogram with $n bins, and returns a pointer to a newly created gsl_histogram struct. The bins and ranges are not initialized, and should be prepared using one of the range-setting functions below in order to make the histogram ready for use.
89 =item C<gsl_histogram_calloc >
91 =item C<gsl_histogram_calloc_uniform >
93 =item C<gsl_histogram_free($h)> - This function frees the histogram $h and all of the memory associated with it.
95 =item C<gsl_histogram_increment >
97 =item C<gsl_histogram_accumulate($h, $x, $weight)> - This function is similar to gsl_histogram_increment but increases the value of the appropriate bin in the histogram $h by the floating-point number weight.
99 =item C<gsl_histogram_find >
101 =item C<gsl_histogram_get($h, $i)> - This function returns the contents of the $i-th bin of the histogram $h. If $i lies outside the valid range of indices for the histogram then the error handler is called with an error code of GSL_EDOM and the function returns 0.
103 =item C<gsl_histogram_get_range >
105 =item C<gsl_histogram_max($h)> - This function returns the maximum upper limit of the histogram $h. It provides a way of determining this value without accessing the gsl_histogram struct directly.
107 =item C<gsl_histogram_min($h)> - This function returns the minimum lower range limit of the histogram $h. It provides a way of determining this value without accessing the gsl_histogram struct directly.
109 =item C<gsl_histogram_bins($h)> - This function returns the number of bins of the histogram $h limit. It provides a way of determining this value without accessing the gsl_histogram struct directly.
111 =item C<gsl_histogram_reset($h)> - This function resets all the bins in the histogram $h to zero.
113 =item C<gsl_histogram_calloc_range >
115 =item C<gsl_histogram_set_ranges >
117 =item C<gsl_histogram_set_ranges_uniform($h, $xmin, $xmax)> - This function sets the ranges of the existing histogram $h to cover the range $xmin to $xmax uniformly. The values of the histogram bins are reset to zero. The bin ranges are shown in the table below,
118 =over
120 =item bin[0] corresponds to xmin <= x < xmin + d
122 =item bin[1] corresponds to xmin + d <= x < xmin + 2 d
124 =item ......
126 =item bin[n-1] corresponds to xmin + (n-1)d <= x < xmax
128 =back
130 where d is the bin spacing, d = (xmax-xmin)/n.
132 =over
134 =item C<gsl_histogram_memcpy>
136 =item C<gsl_histogram_clone >
138 =item C<gsl_histogram_max_val >
140 =item C<gsl_histogram_max_bin >
142 =item C<gsl_histogram_min_val >
144 =item C<gsl_histogram_min_bin >
146 =item C<gsl_histogram_equal_bins_p >
148 =item C<gsl_histogram_add >
150 =item C<gsl_histogram_sub >
152 =item C<gsl_histogram_mul >
154 =item C<gsl_histogram_div >
156 =item C<gsl_histogram_scale >
158 =item C<gsl_histogram_shift >
160 =item C<gsl_histogram_sigma >
162 =item C<gsl_histogram_mean >
164 =item C<gsl_histogram_sum >
166 =item C<gsl_histogram_fwrite >
168 =item C<gsl_histogram_fread >
170 =item C<gsl_histogram_fprintf >
172 =item C<gsl_histogram_fscanf >
174 =item C<gsl_histogram_pdf_alloc >
176 =item C<gsl_histogram_pdf_init >
178 =item C<gsl_histogram_pdf_free >
180 =item C<gsl_histogram_pdf_sample >
182 =back
184 =head1 AUTHORS
186 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
188 =head1 COPYRIGHT AND LICENSE
190 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
192 This program is free software; you can redistribute it and/or modify it
193 under the same terms as Perl itself.
195 =cut