1# This file was automatically generated by SWIG (http://www.swig.org). 2# Version 4.0.1 3# 4# Do not make changes to this file unless you know what you are doing--modify 5# the SWIG interface file instead. 6 7package Math::GSL::Histogram2D; 8use base qw(Exporter); 9use base qw(DynaLoader); 10package Math::GSL::Histogram2Dc; 11bootstrap Math::GSL::Histogram2D; 12package Math::GSL::Histogram2D; 13@EXPORT = qw(); 14 15# ---------- BASE METHODS ------------- 16 17package Math::GSL::Histogram2D; 18 19sub TIEHASH { 20 my ($classname,$obj) = @_; 21 return bless $obj, $classname; 22} 23 24sub CLEAR { } 25 26sub FIRSTKEY { } 27 28sub NEXTKEY { } 29 30sub FETCH { 31 my ($self,$field) = @_; 32 my $member_func = "swig_${field}_get"; 33 $self->$member_func(); 34} 35 36sub STORE { 37 my ($self,$field,$newval) = @_; 38 my $member_func = "swig_${field}_set"; 39 $self->$member_func($newval); 40} 41 42sub this { 43 my $ptr = shift; 44 return tied(%$ptr); 45} 46 47 48# ------- FUNCTION WRAPPERS -------- 49 50package Math::GSL::Histogram2D; 51 52*gsl_error = *Math::GSL::Histogram2Dc::gsl_error; 53*gsl_stream_printf = *Math::GSL::Histogram2Dc::gsl_stream_printf; 54*gsl_strerror = *Math::GSL::Histogram2Dc::gsl_strerror; 55*gsl_set_error_handler = *Math::GSL::Histogram2Dc::gsl_set_error_handler; 56*gsl_set_error_handler_off = *Math::GSL::Histogram2Dc::gsl_set_error_handler_off; 57*gsl_set_stream_handler = *Math::GSL::Histogram2Dc::gsl_set_stream_handler; 58*gsl_set_stream = *Math::GSL::Histogram2Dc::gsl_set_stream; 59*gsl_histogram2d_alloc = *Math::GSL::Histogram2Dc::gsl_histogram2d_alloc; 60*gsl_histogram2d_calloc = *Math::GSL::Histogram2Dc::gsl_histogram2d_calloc; 61*gsl_histogram2d_calloc_uniform = *Math::GSL::Histogram2Dc::gsl_histogram2d_calloc_uniform; 62*gsl_histogram2d_free = *Math::GSL::Histogram2Dc::gsl_histogram2d_free; 63*gsl_histogram2d_increment = *Math::GSL::Histogram2Dc::gsl_histogram2d_increment; 64*gsl_histogram2d_accumulate = *Math::GSL::Histogram2Dc::gsl_histogram2d_accumulate; 65*gsl_histogram2d_find = *Math::GSL::Histogram2Dc::gsl_histogram2d_find; 66*gsl_histogram2d_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_get; 67*gsl_histogram2d_get_xrange = *Math::GSL::Histogram2Dc::gsl_histogram2d_get_xrange; 68*gsl_histogram2d_get_yrange = *Math::GSL::Histogram2Dc::gsl_histogram2d_get_yrange; 69*gsl_histogram2d_xmax = *Math::GSL::Histogram2Dc::gsl_histogram2d_xmax; 70*gsl_histogram2d_xmin = *Math::GSL::Histogram2Dc::gsl_histogram2d_xmin; 71*gsl_histogram2d_nx = *Math::GSL::Histogram2Dc::gsl_histogram2d_nx; 72*gsl_histogram2d_ymax = *Math::GSL::Histogram2Dc::gsl_histogram2d_ymax; 73*gsl_histogram2d_ymin = *Math::GSL::Histogram2Dc::gsl_histogram2d_ymin; 74*gsl_histogram2d_ny = *Math::GSL::Histogram2Dc::gsl_histogram2d_ny; 75*gsl_histogram2d_reset = *Math::GSL::Histogram2Dc::gsl_histogram2d_reset; 76*gsl_histogram2d_calloc_range = *Math::GSL::Histogram2Dc::gsl_histogram2d_calloc_range; 77*gsl_histogram2d_set_ranges_uniform = *Math::GSL::Histogram2Dc::gsl_histogram2d_set_ranges_uniform; 78*gsl_histogram2d_set_ranges = *Math::GSL::Histogram2Dc::gsl_histogram2d_set_ranges; 79*gsl_histogram2d_memcpy = *Math::GSL::Histogram2Dc::gsl_histogram2d_memcpy; 80*gsl_histogram2d_clone = *Math::GSL::Histogram2Dc::gsl_histogram2d_clone; 81*gsl_histogram2d_max_val = *Math::GSL::Histogram2Dc::gsl_histogram2d_max_val; 82*gsl_histogram2d_max_bin = *Math::GSL::Histogram2Dc::gsl_histogram2d_max_bin; 83*gsl_histogram2d_min_val = *Math::GSL::Histogram2Dc::gsl_histogram2d_min_val; 84*gsl_histogram2d_min_bin = *Math::GSL::Histogram2Dc::gsl_histogram2d_min_bin; 85*gsl_histogram2d_xmean = *Math::GSL::Histogram2Dc::gsl_histogram2d_xmean; 86*gsl_histogram2d_ymean = *Math::GSL::Histogram2Dc::gsl_histogram2d_ymean; 87*gsl_histogram2d_xsigma = *Math::GSL::Histogram2Dc::gsl_histogram2d_xsigma; 88*gsl_histogram2d_ysigma = *Math::GSL::Histogram2Dc::gsl_histogram2d_ysigma; 89*gsl_histogram2d_cov = *Math::GSL::Histogram2Dc::gsl_histogram2d_cov; 90*gsl_histogram2d_sum = *Math::GSL::Histogram2Dc::gsl_histogram2d_sum; 91*gsl_histogram2d_equal_bins_p = *Math::GSL::Histogram2Dc::gsl_histogram2d_equal_bins_p; 92*gsl_histogram2d_add = *Math::GSL::Histogram2Dc::gsl_histogram2d_add; 93*gsl_histogram2d_sub = *Math::GSL::Histogram2Dc::gsl_histogram2d_sub; 94*gsl_histogram2d_mul = *Math::GSL::Histogram2Dc::gsl_histogram2d_mul; 95*gsl_histogram2d_div = *Math::GSL::Histogram2Dc::gsl_histogram2d_div; 96*gsl_histogram2d_scale = *Math::GSL::Histogram2Dc::gsl_histogram2d_scale; 97*gsl_histogram2d_shift = *Math::GSL::Histogram2Dc::gsl_histogram2d_shift; 98*gsl_histogram2d_fwrite = *Math::GSL::Histogram2Dc::gsl_histogram2d_fwrite; 99*gsl_histogram2d_fread = *Math::GSL::Histogram2Dc::gsl_histogram2d_fread; 100*gsl_histogram2d_fprintf = *Math::GSL::Histogram2Dc::gsl_histogram2d_fprintf; 101*gsl_histogram2d_fscanf = *Math::GSL::Histogram2Dc::gsl_histogram2d_fscanf; 102*gsl_histogram2d_pdf_alloc = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_alloc; 103*gsl_histogram2d_pdf_init = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_init; 104*gsl_histogram2d_pdf_free = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_free; 105*gsl_histogram2d_pdf_sample = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_sample; 106 107############# Class : Math::GSL::Histogram2D::gsl_histogram2d ############## 108 109package Math::GSL::Histogram2D::gsl_histogram2d; 110use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); 111@ISA = qw( Math::GSL::Histogram2D ); 112%OWNER = (); 113%ITERATORS = (); 114*swig_nx_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_nx_get; 115*swig_nx_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_nx_set; 116*swig_ny_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_ny_get; 117*swig_ny_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_ny_set; 118*swig_xrange_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_xrange_get; 119*swig_xrange_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_xrange_set; 120*swig_yrange_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_yrange_get; 121*swig_yrange_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_yrange_set; 122*swig_bin_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_bin_get; 123*swig_bin_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_bin_set; 124sub new { 125 my $pkg = shift; 126 my $self = Math::GSL::Histogram2Dc::new_gsl_histogram2d(@_); 127 bless $self, $pkg if defined($self); 128} 129 130sub DESTROY { 131 return unless $_[0]->isa('HASH'); 132 my $self = tied(%{$_[0]}); 133 return unless defined $self; 134 delete $ITERATORS{$self}; 135 if (exists $OWNER{$self}) { 136 Math::GSL::Histogram2Dc::delete_gsl_histogram2d($self); 137 delete $OWNER{$self}; 138 } 139} 140 141sub DISOWN { 142 my $self = shift; 143 my $ptr = tied(%$self); 144 delete $OWNER{$ptr}; 145} 146 147sub ACQUIRE { 148 my $self = shift; 149 my $ptr = tied(%$self); 150 $OWNER{$ptr} = 1; 151} 152 153 154############# Class : Math::GSL::Histogram2D::gsl_histogram2d_pdf ############## 155 156package Math::GSL::Histogram2D::gsl_histogram2d_pdf; 157use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); 158@ISA = qw( Math::GSL::Histogram2D ); 159%OWNER = (); 160%ITERATORS = (); 161*swig_nx_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_nx_get; 162*swig_nx_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_nx_set; 163*swig_ny_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_ny_get; 164*swig_ny_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_ny_set; 165*swig_xrange_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_xrange_get; 166*swig_xrange_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_xrange_set; 167*swig_yrange_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_yrange_get; 168*swig_yrange_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_yrange_set; 169*swig_sum_get = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_sum_get; 170*swig_sum_set = *Math::GSL::Histogram2Dc::gsl_histogram2d_pdf_sum_set; 171sub new { 172 my $pkg = shift; 173 my $self = Math::GSL::Histogram2Dc::new_gsl_histogram2d_pdf(@_); 174 bless $self, $pkg if defined($self); 175} 176 177sub DESTROY { 178 return unless $_[0]->isa('HASH'); 179 my $self = tied(%{$_[0]}); 180 return unless defined $self; 181 delete $ITERATORS{$self}; 182 if (exists $OWNER{$self}) { 183 Math::GSL::Histogram2Dc::delete_gsl_histogram2d_pdf($self); 184 delete $OWNER{$self}; 185 } 186} 187 188sub DISOWN { 189 my $self = shift; 190 my $ptr = tied(%$self); 191 delete $OWNER{$ptr}; 192} 193 194sub ACQUIRE { 195 my $self = shift; 196 my $ptr = tied(%$self); 197 $OWNER{$ptr} = 1; 198} 199 200 201# ------- VARIABLE STUBS -------- 202 203package Math::GSL::Histogram2D; 204 205*GSL_VERSION = *Math::GSL::Histogram2Dc::GSL_VERSION; 206*GSL_MAJOR_VERSION = *Math::GSL::Histogram2Dc::GSL_MAJOR_VERSION; 207*GSL_MINOR_VERSION = *Math::GSL::Histogram2Dc::GSL_MINOR_VERSION; 208*GSL_POSZERO = *Math::GSL::Histogram2Dc::GSL_POSZERO; 209*GSL_NEGZERO = *Math::GSL::Histogram2Dc::GSL_NEGZERO; 210*GSL_SUCCESS = *Math::GSL::Histogram2Dc::GSL_SUCCESS; 211*GSL_FAILURE = *Math::GSL::Histogram2Dc::GSL_FAILURE; 212*GSL_CONTINUE = *Math::GSL::Histogram2Dc::GSL_CONTINUE; 213*GSL_EDOM = *Math::GSL::Histogram2Dc::GSL_EDOM; 214*GSL_ERANGE = *Math::GSL::Histogram2Dc::GSL_ERANGE; 215*GSL_EFAULT = *Math::GSL::Histogram2Dc::GSL_EFAULT; 216*GSL_EINVAL = *Math::GSL::Histogram2Dc::GSL_EINVAL; 217*GSL_EFAILED = *Math::GSL::Histogram2Dc::GSL_EFAILED; 218*GSL_EFACTOR = *Math::GSL::Histogram2Dc::GSL_EFACTOR; 219*GSL_ESANITY = *Math::GSL::Histogram2Dc::GSL_ESANITY; 220*GSL_ENOMEM = *Math::GSL::Histogram2Dc::GSL_ENOMEM; 221*GSL_EBADFUNC = *Math::GSL::Histogram2Dc::GSL_EBADFUNC; 222*GSL_ERUNAWAY = *Math::GSL::Histogram2Dc::GSL_ERUNAWAY; 223*GSL_EMAXITER = *Math::GSL::Histogram2Dc::GSL_EMAXITER; 224*GSL_EZERODIV = *Math::GSL::Histogram2Dc::GSL_EZERODIV; 225*GSL_EBADTOL = *Math::GSL::Histogram2Dc::GSL_EBADTOL; 226*GSL_ETOL = *Math::GSL::Histogram2Dc::GSL_ETOL; 227*GSL_EUNDRFLW = *Math::GSL::Histogram2Dc::GSL_EUNDRFLW; 228*GSL_EOVRFLW = *Math::GSL::Histogram2Dc::GSL_EOVRFLW; 229*GSL_ELOSS = *Math::GSL::Histogram2Dc::GSL_ELOSS; 230*GSL_EROUND = *Math::GSL::Histogram2Dc::GSL_EROUND; 231*GSL_EBADLEN = *Math::GSL::Histogram2Dc::GSL_EBADLEN; 232*GSL_ENOTSQR = *Math::GSL::Histogram2Dc::GSL_ENOTSQR; 233*GSL_ESING = *Math::GSL::Histogram2Dc::GSL_ESING; 234*GSL_EDIVERGE = *Math::GSL::Histogram2Dc::GSL_EDIVERGE; 235*GSL_EUNSUP = *Math::GSL::Histogram2Dc::GSL_EUNSUP; 236*GSL_EUNIMPL = *Math::GSL::Histogram2Dc::GSL_EUNIMPL; 237*GSL_ECACHE = *Math::GSL::Histogram2Dc::GSL_ECACHE; 238*GSL_ETABLE = *Math::GSL::Histogram2Dc::GSL_ETABLE; 239*GSL_ENOPROG = *Math::GSL::Histogram2Dc::GSL_ENOPROG; 240*GSL_ENOPROGJ = *Math::GSL::Histogram2Dc::GSL_ENOPROGJ; 241*GSL_ETOLF = *Math::GSL::Histogram2Dc::GSL_ETOLF; 242*GSL_ETOLX = *Math::GSL::Histogram2Dc::GSL_ETOLX; 243*GSL_ETOLG = *Math::GSL::Histogram2Dc::GSL_ETOLG; 244*GSL_EOF = *Math::GSL::Histogram2Dc::GSL_EOF; 245 246@EXPORT_OK = qw/ 247 gsl_histogram2d_alloc 248 gsl_histogram2d_calloc 249 gsl_histogram2d_calloc_uniform 250 gsl_histogram2d_free 251 gsl_histogram2d_increment 252 gsl_histogram2d_accumulate 253 gsl_histogram2d_find 254 gsl_histogram2d_get 255 gsl_histogram2d_get_xrange 256 gsl_histogram2d_get_yrange 257 gsl_histogram2d_xmax 258 gsl_histogram2d_xmin 259 gsl_histogram2d_nx 260 gsl_histogram2d_ymax 261 gsl_histogram2d_ymin 262 gsl_histogram2d_ny 263 gsl_histogram2d_reset 264 gsl_histogram2d_calloc_range 265 gsl_histogram2d_set_ranges_uniform 266 gsl_histogram2d_set_ranges 267 gsl_histogram2d_memcpy 268 gsl_histogram2d_clone 269 gsl_histogram2d_max_val 270 gsl_histogram2d_max_bin 271 gsl_histogram2d_min_val 272 gsl_histogram2d_min_bin 273 gsl_histogram2d_xmean 274 gsl_histogram2d_ymean 275 gsl_histogram2d_xsigma 276 gsl_histogram2d_ysigma 277 gsl_histogram2d_cov 278 gsl_histogram2d_sum 279 gsl_histogram2d_equal_bins_p 280 gsl_histogram2d_add 281 gsl_histogram2d_sub 282 gsl_histogram2d_mul 283 gsl_histogram2d_div 284 gsl_histogram2d_scale 285 gsl_histogram2d_shift 286 gsl_histogram2d_fwrite 287 gsl_histogram2d_fread 288 gsl_histogram2d_fprintf 289 gsl_histogram2d_fscanf 290 gsl_histogram2d_pdf_alloc 291 gsl_histogram2d_pdf_init 292 gsl_histogram2d_pdf_free 293 gsl_histogram2d_pdf_sample 294 /; 295%EXPORT_TAGS = ( all => [ @EXPORT_OK ] ); 296 297=encoding utf8 298 299=head1 NAME 300 301Math::GSL::Histogram2D - Create and manipulate histograms of data in 2 dimensions 302 303=head1 SYNOPSIS 304 305 use Math::GSL::Histogram2D qw/:all/; 306 307 # raw interface 308 my $H = gsl_histogram2d_alloc(100, 100); 309 310 gsl_histogram2d_set_ranges_uniform($H,0,101, 0, 101); 311 gsl_histogram2d_increment($H, -50, -12); # ignored 312 gsl_histogram2d_increment($H, 70 ); 313 gsl_histogram2d_increment($H, 85.2 ); 314 315 my $G = gsl_histogram2d_clone($H); 316 my $value = gsl_histogram2d_get($G, 70, 33); 317 my ($max,$min) = (gsl_histogram2d_min_val($H), gsl_histogram2d_max_val($H) ); 318 my $sum = gsl_histogram2d_sum($H); 319 320=cut 321 322=head1 DESCRIPTION 323 324This subsystem allows the creation and manipulation of 2D histograms. Currently, only a raw interface exists. 325 326=over 327 328=item C<gsl_histogram2d_alloc($nx, $ny)> - This function allocates memory for a two-dimensional histogram with $nx bins in the x direction and $ny bins in the y direction. The function returns a pointer to a newly created gsl_histogram2d struct. If insufficient memory is available a null pointer is returned and the error handler is invoked with an error code of $GSL_ENOMEM. The bins and ranges must be initialized with one of the functions below before the histogram is ready for use. 329 330=item C<gsl_histogram2d_calloc > 331 332=item C<gsl_histogram2d_calloc_uniform > 333 334=item C<gsl_histogram2d_free($h)> - This function frees the 2D histogram h and all of the memory associated with it. 335 336=item C<gsl_histogram2d_increment($h, $xmin, $xmax, $ymin, $ymax)> - This function sets the ranges of the existing histogram $h to cover the ranges $xmin to $xmax and $ymin to $ymax uniformly. The values of the histogram bins are reset to zero. 337 338=item C<gsl_histogram2d_accumulate($h, $x, $y, $weight)> - This function is similar to gsl_histogram2d_increment but increases the value of the appropriate bin in the histogram $h by the floating-point number $weight. 339 340=item C<gsl_histogram2d_find($h, $x, $y)> - This function finds indices i and j to the to the bin which covers the coordinates ($x,$y). The bin is located using a binary search. The search includes an optimization for histograms with uniform ranges, and will return the correct bin immediately in this case. If ($x,$y) is found then the function return GSL_SUCCESS, i and j in this order. If ($x,$y) lies outside the valid range of the histogram then the function returns $GSL_EDOM and the error handler is invoked. 341 342=item C<gsl_histogram2d_get($h, $i, $j)> - This function returns the contents of the ($i,$j)-th bin of the histogram $h. If ($i,$j) 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. 343 344=item C<gsl_histogram2d_get_xrange($h, $i)> - This functions finds the upper and lower range limits of the $i-th in the x direction of the histogram $h. The range limits are stored in returned after 0 or 1 in this order : xlower and xupper. The lower limits are inclusive (i.e. events with these coordinates are included in the bin) and the upper limits are exclusive (i.e. events with the value of the upper limit are not included and fall in the neighboring higher bin, if it exists). The functions returns 0 has first value to indicate success. 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. 345 346=item C<gsl_histogram2d_get_yrange($h, $j)> - This functions finds the upper and lower range limits of the $j-th in the y direction of the histogram $h. The range limits are stored in returned after 0 or 1 in this order : ylower and yupper. The lower limits are inclusive (i.e. events with these coordinates are included in the bin) and the upper limits are exclusive (i.e. events with the value of the upper limit are not included and fall in the neighboring higher bin, if it exists). The functions returns 0 has first value to indicate success. If $j lies outside the valid range of indices for the histogram then the error handler is called with an error code of GSL_EDOM. 347 348=item C<gsl_histogram2d_xmax($h)> - This functions returns the maximum upper range limit for the x direction of the histogram $h. 349 350=item C<gsl_histogram2d_xmin($h)> - This functions returns the minimum lower range limit for the x direction of the histogram $h. 351 352=item C<gsl_histogram2d_nx($h)> - This functions the number of bins for the x direction. 353 354=item C<gsl_histogram2d_ymax($h)> - This functions returns the maximum upper range limit for the y direction of the histogram $h. 355 356=item C<gsl_histogram2d_ymin($h)> - This functions returns the minimum lower range limit for the y direction of the histogram $h. 357 358=item C<gsl_histogram2d_ny($h)> - This functions the number of bins for the y direction. 359 360=item C<gsl_histogram2d_reset($h)> - This function resets all the bins of the histogram $h to zero. 361 362=item C<gsl_histogram2d_calloc_range > 363 364=item C<gsl_histogram2d_set_ranges($h, $xrange, $xsize, $yrange, $ysize)> - This function sets the ranges of the existing histogram $h using the arrays $xrange and $yrange of size $xsize and $ysize respectively. The values of the histogram bins are reset to zero. 365 366=item C<gsl_histogram2d_set_ranges_uniform($h, $xmin, $xmax, $ymin, $ymax)> - This function sets the ranges of the existing histogram $h to cover the ranges $xmin to $xmax and $ymin to $ymax uniformly. The values of the histogram bins are reset to zero. 367 368=item C<gsl_histogram2d_memcpy($dest, $src)> - This function copies the histogram $src into the pre-existing histogram $dest, making $dest into an exact copy of $src. The two histograms must be of the same size. 369 370 371=item C<gsl_histogram2d_clone($src)> 372 373This function returns a pointer to a newly created 374Math::GSL::Histogram2D::gsl_histogram2d which is an exact copy of the histogram 375$src. NOTE: Ranges must be set with a function like 376C<gsl_histogram2d_set_ranges_uniform> or this function will return undef. 377 378=item C<gsl_histogram2d_max_val($h)> - This function returns the maximum value contained in the histogram bins. 379 380=item C<gsl_histogram2d_max_bin($h)> - This function finds the indices of the bin containing the maximum value in the histogram $h and returns the result in this order : 0 if the operation succeded, 1 otherwise, i and j. In the case where several bins contain the same maximum value the first bin found is returned. 381 382=item C<gsl_histogram2d_min_val($h)> - This function returns the minimum value contained in the histogram bins. 383 384=item C<gsl_histogram2d_min_bin($h)> - This function finds the indices of the bin containing the minimum value in the histogram $h and returns the result in this order : 0 if the operation succeded, 1 otherwise, i and j. In the case where several bins contain the same minimum value the first bin found is returned. 385 386=item C<gsl_histogram2d_xmean($h)> - This function returns the mean of the histogrammed x variable, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation. 387 388=item C<gsl_histogram2d_ymean($h)> - This function returns the mean of the histogrammed y variable, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation. 389 390=item C<gsl_histogram2d_xsigma($h)> - This function returns the standard deviation of the histogrammed x variable, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation. 391 392=item C<gsl_histogram2d_ysigma($h)> - This function returns the standard deviation of the histogrammed y variable, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation. 393 394=item C<gsl_histogram2d_cov($h)> - This function returns the covariance of the histogrammed x and y variables, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation. 395 396=item C<gsl_histogram2d_sum($h)> - This function returns the sum of all bin values. Negative bin values are included in the sum. 397 398=item C<gsl_histogram2d_equal_bins_p($h1, $h2)> - This function returns 1 if all the individual bin ranges of the two histograms are identical, and 0 otherwise. 399 400=item C<gsl_histogram2d_add($h1, $h2)> - This function adds the contents of the bins in histogram $h2 to the corresponding bins of histogram $h1, i.e. h'_1(i,j) = h_1(i,j) + h_2(i,j). The two histograms must have identical bin ranges. 401 402=item C<gsl_histogram2d_sub($h1, $h2)> - This function subtracts the contents of the bins in histogram $h2 from the corresponding bins of histogram $h1, i.e. h'_1(i,j) = h_1(i,j) - h_2(i,j). The two histograms must have identical bin ranges. 403 404=item C<gsl_histogram2d_mul($h1, $h2)> - This function multiplies the contents of the bins of histogram $h1 by the contents of the corresponding bins in histogram $h2, i.e. h'_1(i,j) = h_1(i,j) * h_2(i,j). The two histograms must have identical bin ranges. 405 406=item C<gsl_histogram2d_div($h1, $h2)> - This function divides the contents of the bins of histogram $h1 by the contents of the corresponding bins in histogram $h2, i.e. h'_1(i,j) = h_1(i,j) / h_2(i,j). The two histograms must have identical bin ranges. 407 408=item C<gsl_histogram2d_scale($h, $scale)> - This function multiplies the contents of the bins of histogram $h by the constant scale, i.e. h'_1(i,j) = h_1(i,j) $scale. 409 410=item C<gsl_histogram2d_shift($h, $offset)> - This function shifts the contents of the bins of histogram $h by the constant offset, i.e. h'_1(i,j) = h_1(i,j) + $offset. 411 412=item C<gsl_histogram2d_fwrite($stream $h)> - This function writes the ranges and bins of the histogram $h to the stream $stream (opened with the gsl_fopen function from the Math::GSL module) in binary format. The return value is 0 for success and $GSL_EFAILED if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures. 413 414=item C<gsl_histogram2d_fread($stream $h)> - This function reads into the histogram $h from the stream $stream (opened with the gsl_fopen function from the Math::GSL module) in binary format. The histogram $h must be preallocated with the correct size since the function uses the number of x and y bins in $h to determine how many bytes to read. The return value is 0 for success and $GSL_EFAILED if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture. 415 416=item C<gsl_histogram2d_fprintf($stream, $h, $range_format, $bin_format)> - This function writes the ranges and bins of the histogram $h line-by-line to the stream $stream (opened with the gsl_fopen function from the Math::GSL module) using the format specifiers $range_format and $bin_format. These should be one of the %g, %e or %f formats for floating point numbers. The function returns 0 for success and $GSL_EFAILED if there was a problem writing to the file. The histogram output is formatted in five columns, and the columns are separated by spaces, like this, 417 418=over 419 420=item xrange[0] xrange[1] yrange[0] yrange[1] bin(0,0) 421 422=item xrange[0] xrange[1] yrange[1] yrange[2] bin(0,1) 423 424=item xrange[0] xrange[1] yrange[2] yrange[3] bin(0,2) 425 426=item .... 427 428=item xrange[0] xrange[1] yrange[ny-1] yrange[ny] bin(0,ny-1) 429 430=item xrange[1] xrange[2] yrange[0] yrange[1] bin(1,0) 431 432=item xrange[1] xrange[2] yrange[1] yrange[2] bin(1,1) 433 434=item xrange[1] xrange[2] yrange[1] yrange[2] bin(1,2) 435 436=item .... 437 438=item xrange[1] xrange[2] yrange[ny-1] yrange[ny] bin(1,ny-1) 439 440=item .... 441 442=item xrange[nx-1] xrange[nx] yrange[0] yrange[1] bin(nx-1,0) 443 444=item xrange[nx-1] xrange[nx] yrange[1] yrange[2] bin(nx-1,1) 445 446=item xrange[nx-1] xrange[nx] yrange[1] yrange[2] bin(nx-1,2) 447 448=item .... 449 450=item xrange[nx-1] xrange[nx] yrange[ny-1] yrange[ny] bin(nx-1,ny-1) 451 452=back 453 454Each line contains the lower and upper limits of the bin and the contents of the 455bin. Since the upper limits of the each bin are the lower limits of the 456neighboring bins there is duplication of these values but this allows the 457histogram to be manipulated with line-oriented tools. 458 459=item C<gsl_histogram2d_fscanf($stream, $h)> 460 461This function reads formatted data from the stream $stream (opened with the 462gsl_fopen function from the Math::GSL module) into the histogram $h. The data is 463assumed to be in the five-column format used by gsl_histogram2d_fprintf. The 464histogram $h must be preallocated with the correct lengths since the function 465uses the sizes of $h to determine how many numbers to read. The function returns 4660 for success and $GSL_EFAILED if there was a problem reading from the file. 467 468=item C<gsl_histogram2d_pdf_alloc($nx, $ny)> 469 470This function allocates memory for a two-dimensional probability distribution of 471size $nx-by-$ny and returns a pointer to a newly initialized gsl_histogram2d_pdf 472struct. If insufficient memory is available a null pointer is returned and the 473error handler is invoked with an error code of $GSL_ENOMEM. 474 475=item C<gsl_histogram2d_pdf_init($p, $h)> 476 477This function initializes the two-dimensional probability distribution 478calculated $p from the histogram $h. If any of the bins of $h are negative then 479the error handler is invoked with an error code of GSL_EDOM because a 480probability distribution cannot contain negative values. 481 482=item C<gsl_histogram2d_pdf_free($p)> 483 484This function frees the two-dimensional probability distribution function $p and 485all of the memory associated with it. 486 487=item C<gsl_histogram2d_pdf_sample($p, $r1, $r2)> 488 489This function uses two uniform random numbers between zero and one, $r1 and $r2, 490to compute a single random sample from the two-dimensional probability 491distribution p. The function returns 0 if the operation succeeded, 1 otherwise 492followed by the x and y values of the sample. 493 494=back 495 496=head1 AUTHORS 497 498Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com> 499 500=head1 COPYRIGHT AND LICENSE 501 502Copyright (C) 2008-2021 Jonathan "Duke" Leto and Thierry Moisan 503 504This program is free software; you can redistribute it and/or modify it 505under the same terms as Perl itself. 506 507=cut 508 5091; 510