NAME
allocate_2D_vp_array - Creates a 2D array of vector pointers
SYNOPSIS
#include "m/m_vector.h"
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-I/home/kobus/include
-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
Vector ***allocate_2D_vp_array
(
int num_rows,
int num_cols
);
DESCRIPTION
This routine returns a pointer P to a two-dimensional array of vector
pointers. P can be de-referenced by P[row][col] to obtain the storage of a
Vector*. P[0] points to a contiguous area of memory which contains the
entire array. P[1] is a short-cut pointer to the first element of the second
row, and so on. Thus the array can be accessed sequentually starting at
P[0], or explicitly by row and column. (Note that this is not the common way
of setting up a two-dimensional array--see below).
This routine sets all the pointers to NULL.
If TEST is #defined (unix only) then this routine is #define'd to be
debug_allocate_2D_vp_array, which is the version available in the
development library. In development 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_2D_vp_array_and_vectors should be used to dispose of the
storage once it is no longer needed.
RETURNS
On error, this routine returns NULL, with an error message being set.
On success it returns a pointer to the array.
WARNING
The structure of the returned array is somewhat different than a more
common form of a two-dimensional array in "C" where each row is allocated
separately. Here the storage area is contiguous. This allows for certain
operations to be done quickly, but note the following IMPORTANT point:
num_rows cannot be swapped by simply swapping row pointers!
NOTE
Naming convention--this routine is called "allocate_2D_vp_array" rather
than "create_2D_vp_array" or "create_vector_matrix" because we are not
creating an abstract data type, but rather just allocating raw storage.
For many puposes this routine is a hack waiting for a
create_vector_matrix routine to be written, but it has uses outside of
this as well.
DISCLAIMER
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
AUTHOR
Kobus Barnard
DOCUMENTER
Kobus Barnard
SEE ALSO
get_unity_vector
,
get_zero_vector
,
get_initialized_vector
,
get_target_vector
,
free_vector
,
get_random_vector
,
get_random_vector_2
,
get_random_unit_vector
,
vp_get_indexed_vector
,
get_zero_indexed_vector
,
get_random_indexed_vector
,
get_target_indexed_vector
,
free_indexed_vector
,
ascend_sort_indexed_vector
,
descend_sort_indexed_vector
,
get_target_vector_vector
,
free_vector_vector
,
free_2D_vp_array_and_vectors
,
get_target_v3
,
free_v3
,
get_target_v4
,
free_v4