The functions for allocating memory to a 2D histogram follow the style
of malloc
and free
. In addition they also perform their
own error checking. If there is insufficient memory available to
allocate a histogram then the functions call the error handler (with
an error number of GSL_ENOMEM
) in addition to returning a null
pointer. Thus if you use the library error handler to abort your program
then it isn't necessary to check every 2D histogram alloc
.
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 ofGSL_ENOMEM
. The bins and ranges must be initialized with one of the functions below before the histogram is ready for use.
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.