NODElib Documentation

By Gary William Flake

NAME

dsmatrix.h - DATASET_METHOD for matrix types

SYNOPSIS

These routines define methods for accessing matrices. With this module, a DATASET can consist of a single matrix or two matrices.

#include <dsmatrix.h>

DSM_MATRIX *dsm_c_matrix(double *x,
      unsigned 
xcols, unsigned ycols,
      unsigned 
rows);

DSM_MATRIX *dsm_c_matrices(double *x,
      double *
y, unsigned xcols, unsigned ycols,
      unsigned 
rows);

void *dsm_destroy_matrix(DSM_MATRIX *mtx);

DESCRIPTION

Type Declarations

The following types are defined in the header file dsmatrix.h.

DSM_MATRIX

typedef struct DSM_MATRIX {
  double *x, *y;
  unsigned xcols;
  unsigned ycols;
  unsigned rows;
} DSM_MATRIX;

The DSM_MATRIX type specififies how a 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 dsmatrix.h.

DSM_MATRIX *dsm_c_matrix(double *x,
      unsigned 
xcols, unsigned ycols,
      unsigned 
rows);

Declare a single C matrix to be a source for data.

DSM_MATRIX *dsm_c_matrices(double *x,
      double *
y, unsigned xcols, unsigned ycols,
      unsigned 
rows);

Declare a two C matrices to be a source for data.

void *dsm_destroy_matrix(DSM_MATRIX *mtx);

Free up any memory that was allocated with one of the two allocation routines. The pointers that are passed to the DSM_MATRIX 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).