NAME
dsdblptr.h - DATASET_METHOD for double pointer matrix types
SYNOPSIS
These routines define methods for accessing matrices that are dynamically allocated as pointers to pointers of doubles. With this module, a DATASET can consist of a single matrix or two matrices.
#include <dsdblptr.h>
DSM_DBLPTR *dsm_c_dblptr(double **x,
unsigned xcols, unsigned ycols,
unsigned rows);
DSM_DBLPTR *dsm_c_dblptrs(double **x,
double **y, unsigned xcols, unsigned ycols,
unsigned rows);
void *dsm_destroy_dblptr(DSM_DBLPTR *mtx);
DESCRIPTION
Type Declarations
The following types are defined in the header file dsdblptr.h.
DSM_DBLPTR
typedef struct DSM_DBLPTR {
double **x, **y;
unsigned xcols;
unsigned ycols;
unsigned rows;
} DSM_DBLPTR;
The DSM_DBLPTR type specififies how a double pointer matrix should be interpreted. There are two possibilities that we handle. First, there may be one or two matrices. If there is just one, then the inputs reside on the left-hand side of the rows, and the targets reside on the right. In this case, xcols and xcols should sum to the total number of columns in the single matrix. If there are two matrices, then xcols and ycols specify their respective number of columns. They must have the same number of rows, however.
Function Definitions
The following function prototypes are given in the header file dsdblptr.h.
DSM_DBLPTR *dsm_c_dblptr(double **x,
unsigned xcols, unsigned ycols,
unsigned rows);
Declare a single C pointer matrix to be a source for data.
DSM_DBLPTR *dsm_c_dblptrs(double **x,
double **y, unsigned xcols, unsigned ycols,
unsigned rows);
Declare two C pointer matrices to be a source for data.
void *dsm_destroy_dblptr(DSM_DBLPTR *mtx);
Free up any memory that was allocated with one of the two allocation routines. The pointers that are passed to the DSM_DBLPTR creation routines are left intact; hence, it is your job to free them up. The value of mtx->x is returned.
AUTHOR
Gary William Flake (gary.flake@usa.net).
SEE ALSO
dsmethod(3), and dataset(3).