Math::GSL::Histogram2D - Create and manipulate histograms of data in 2 dimensions
use Math::GSL::Histogram2D qw/:all/; # raw interface my $H = gsl_histogram2d_alloc(100, 100); gsl_histogram2d_set_ranges_uniform($H,0,101, 0, 101); gsl_histogram2d_increment($H, -50, -12); # ignored gsl_histogram2d_increment($H, 70 ); gsl_histogram2d_increment($H, 85.2 ); my $G = gsl_histogram2d_clone($H); my $value = gsl_histogram2d_get($G, 70, 33); my ($max,$min) = (gsl_histogram2d_min_val($H), gsl_histogram2d_max_val($H) ); my $sum = gsl_histogram2d_sum($H);
This subsystem allows the creation and manipulation of 2D histograms. Currently, only a raw interface exists.
gsl_histogram2d_alloc($nx, $ny)
gsl_histogram2d_calloc
gsl_histogram2d_calloc_uniform
gsl_histogram2d_free($h)
gsl_histogram2d_increment($h, $xmin, $xmax, $ymin, $ymax)
gsl_histogram2d_accumulate($h, $x, $y, $weight)
gsl_histogram2d_find($h, $x, $y)
gsl_histogram2d_get($h, $i, $j)
gsl_histogram2d_get_xrange($h, $i)
gsl_histogram2d_get_yrange($h, $j)
gsl_histogram2d_xmax($h)
gsl_histogram2d_xmin($h)
gsl_histogram2d_nx($h)
gsl_histogram2d_ymax($h)
gsl_histogram2d_ymin($h)
gsl_histogram2d_ny($h)
gsl_histogram2d_reset($h)
gsl_histogram2d_calloc_range
gsl_histogram2d_set_ranges($h, $xrange, $xsize, $yrange, $ysize)
gsl_histogram2d_set_ranges_uniform($h, $xmin, $xmax, $ymin, $ymax)
gsl_histogram2d_memcpy($dest, $src)
gsl_histogram2d_clone($src)
This function returns a pointer to a newly created Math::GSL::Histogram2D::gsl_histogram2d which is an exact copy of the histogram $src. NOTE: Ranges must be set with a function like gsl_histogram2d_set_ranges_uniform or this function will return undef.
gsl_histogram2d_set_ranges_uniform
gsl_histogram2d_max_val($h)
gsl_histogram2d_max_bin($h)
gsl_histogram2d_min_val($h)
gsl_histogram2d_min_bin($h)
gsl_histogram2d_xmean($h)
gsl_histogram2d_ymean($h)
gsl_histogram2d_xsigma($h)
gsl_histogram2d_ysigma($h)
gsl_histogram2d_cov($h)
gsl_histogram2d_sum($h)
gsl_histogram2d_equal_bins_p($h1, $h2)
gsl_histogram2d_add($h1, $h2)
gsl_histogram2d_sub($h1, $h2)
gsl_histogram2d_mul($h1, $h2)
gsl_histogram2d_div($h1, $h2)
gsl_histogram2d_scale($h, $scale)
gsl_histogram2d_shift($h, $offset)
gsl_histogram2d_fwrite($stream $h)
gsl_histogram2d_fread($stream $h)
gsl_histogram2d_fprintf($stream, $h, $range_format, $bin_format)
Each line contains the lower and upper limits of the bin and the contents of the bin. Since the upper limits of the each bin are the lower limits of the neighboring bins there is duplication of these values but this allows the histogram to be manipulated with line-oriented tools.
gsl_histogram2d_fscanf($stream, $h)
This function reads formatted data from the stream $stream (opened with the gsl_fopen function from the Math::GSL module) into the histogram $h. The data is assumed to be in the five-column format used by gsl_histogram2d_fprintf. The histogram $h must be preallocated with the correct lengths since the function uses the sizes of $h to determine how many numbers to read. The function returns 0 for success and $GSL_EFAILED if there was a problem reading from the file.
gsl_histogram2d_pdf_alloc($nx, $ny)
This function allocates memory for a two-dimensional probability distribution of size $nx-by-$ny and returns a pointer to a newly initialized gsl_histogram2d_pdf struct. If insufficient memory is available a null pointer is returned and the error handler is invoked with an error code of $GSL_ENOMEM.
gsl_histogram2d_pdf_init($p, $h)
This function initializes the two-dimensional probability distribution calculated $p from the histogram $h. If any of the bins of $h are negative then the error handler is invoked with an error code of GSL_EDOM because a probability distribution cannot contain negative values.
gsl_histogram2d_pdf_free($p)
This function frees the two-dimensional probability distribution function $p and all of the memory associated with it.
gsl_histogram2d_pdf_sample($p, $r1, $r2)
This function uses two uniform random numbers between zero and one, $r1 and $r2, to compute a single random sample from the two-dimensional probability distribution p. The function returns 0 if the operation succeeded, 1 otherwise followed by the x and y values of the sample.
Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
Copyright (C) 2008-2013 Jonathan "Duke" Leto and Thierry Moisan
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Math::GSL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::GSL
CPAN shell
perl -MCPAN -e shell install Math::GSL
For more information on module installation, please visit the detailed CPAN module installation guide.