allocate_3D_short_array - Allocates a 3D array of shorts


#include "l/l_3D_arr.h"

Example compile flags (system dependent):
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 

short ***allocate_3D_short_array
	int num_blocks,
	int num_rows,
	int num_cols


This routine returns a pointer P to a three-dimensional array of shorts. P can be de-referenced by P[block][row][col] to obtain the storage of a short. P[0][0] points to a contiguous area of memory which contains the entire array. Thus the array can be accessed sequentually starting at P[0][0], or explicitly by block, row and column. (Note that this is not the common way of setting up a three-dimensional array--see below). If TEST is #defined (unix only) then this routine is #define'd to be debug_allocate_3D_short_array, which is the version available in the developement library. In developement code, memory is tracked so that memory leaks can be found more easily. Furthermore, all memory free'd is checked that it was allocated by a KJB library routine. Finally, memory is checked for overuns. The routine free_3D_short_array should be used to dispose of the storage once it is no longer needed.


On error, this routine returns NULL, with an error message being set. On success it returns a pointer to the array.


The structure of the returned array is somewhat different than a more common form of a three-dimensional array in "C" where each block, and each row within each block, is allocated separately. Here the storage area is contiguous. This allows for certain operations to be done quickly, but note the following IMPORTANT point: Blocks and rows cannot be swapped by simply swapping row pointers!


This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.


Kobus Barnard


Kobus Barnard


allocate_3D_byte_array , free_3D_byte_array , free_3D_short_array , allocate_3D_int_array , free_3D_int_array , allocate_3D_long_array , free_3D_long_array , allocate_3D_float_array , free_3D_float_array , allocate_3D_double_array , free_3D_double_array , allocate_3D_ptr_array , free_3D_ptr_array