1 %module
"Math::GSL::Histogram"
3 %include
"gsl_typemaps.i"
5 FILE * fopen
(char
*, char
*);
9 #include
"gsl/gsl_histogram.h"
12 %include
"gsl/gsl_histogram.h"
16 @EXPORT_OK
= qw
/fopen fclose
19 gsl_histogram_calloc_uniform
21 gsl_histogram_increment
22 gsl_histogram_accumulate
25 gsl_histogram_get_range
30 gsl_histogram_calloc_range
31 gsl_histogram_set_ranges
32 gsl_histogram_set_ranges_uniform
39 gsl_histogram_equal_bins_p
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
] );
62 Math
::GSL
::Histogram
- Create and manipulate histograms of data
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
);
83 Here is a list of all the functions included in this module
:
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
>
95 =item C
<gsl_histogram_increment
>
97 =item C
<gsl_histogram_accumulate
>
99 =item C
<gsl_histogram_find
>
101 =item C
<gsl_histogram_get
>
103 =item C
<gsl_histogram_get_range
>
105 =item C
<gsl_histogram_max
>
107 =item C
<gsl_histogram_min
>
109 =item C
<gsl_histogram_bins
>
111 =item C
<gsl_histogram_reset
>
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
,
120 =item bin
[0] corresponds to xmin
<= x
< xmin
+ d
122 =item bin
[1] corresponds to xmin
+ d
<= x
< xmin
+ 2 d
126 =item bin
[n-1
] corresponds to xmin
+ (n-1
)d
<= x
< xmax
130 where d is the bin spacing
, d
= (xmax-xmin
)/n.
132 =item C
<gsl_histogram_memcpy
>
134 =item C
<gsl_histogram_clone
>
136 =item C
<gsl_histogram_max_val
>
138 =item C
<gsl_histogram_max_bin
>
140 =item C
<gsl_histogram_min_val
>
142 =item C
<gsl_histogram_min_bin
>
144 =item C
<gsl_histogram_equal_bins_p
>
146 =item C
<gsl_histogram_add
>
148 =item C
<gsl_histogram_sub
>
150 =item C
<gsl_histogram_mul
>
152 =item C
<gsl_histogram_div
>
154 =item C
<gsl_histogram_scale
>
156 =item C
<gsl_histogram_shift
>
158 =item C
<gsl_histogram_sigma
>
160 =item C
<gsl_histogram_mean
>
162 =item C
<gsl_histogram_sum
>
164 =item C
<gsl_histogram_fwrite
>
166 =item C
<gsl_histogram_fread
>
168 =item C
<gsl_histogram_fprintf
>
170 =item C
<gsl_histogram_fscanf
>
172 =item C
<gsl_histogram_pdf_alloc
>
174 =item C
<gsl_histogram_pdf_init
>
176 =item C
<gsl_histogram_pdf_free
>
178 =item C
<gsl_histogram_pdf_sample
>
184 Jonathan Leto
<jonathan@leto.net
> and Thierry Moisan
<thierry.moisan@gmail.com
>
186 =head1 COPYRIGHT
AND LICENSE
188 Copyright
(C
) 2008 Jonathan Leto and Thierry Moisan
190 This program is free software
; you can redistribute it and
/or modify it
191 under the same terms as Perl itself.