NODElib Documentation

By Gary William Flake

NAME

dsunion.h - DATASET_METHOD union of other DATASETs

SYNOPSIS

Given multiple existing DATASETs, one can define a new DATASET that is the union of original ones. This is useful for when multiple data sources have to be conceptually merged (e.g., training on multiple files as if thery were one).

#include <dsunion.h>

DSM_UNION *dsm_union(void);

void dsm_union_add(DSM_UNION *dsmunion,
    DATASET *
elem);

void dsm_union_remove(DSM_UNION *dsmunion,
     unsigned 
index);

unsigned dsm_union_count(DSM_UNION *dsmunion);

DATASET *dsm_union_elem(DSM_UNION *dsmunion,
      unsigned 
index);

void dsm_destroy_union(DSM_UNION *dsmunion);

DESCRIPTION

Type Declarations

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

DSM_UNION

typedef ARRAY DSM_UNION;

A DSM_UNION specifies how to reference the union of the data in contained in several DATASETs. The total number of patterns in the union is equal to the sum of the sizes. Accessing patterns by index does does so in the order in that they are added to the union.

Function Definitions

The following function prototypes are given in the header file dsunion.h.

DSM_UNION *dsm_union(void);

Allocates a new union with no members.

void dsm_union_add(DSM_UNION *dsmunion,
    DATASET *
elem);

Adds elem to dsmunion.

void dsm_union_remove(DSM_UNION *dsmunion,
     unsigned 
index);

Removes the DATASET indexed by index from dsmunion. The first element always has index 0.

unsigned dsm_union_count(DSM_UNION *dsmunion);

Returns the total number of elements that hav been added to dsmunion.

DATASET *dsm_union_elem(DSM_UNION *dsmunion,
      unsigned 
index);

Returns the element from dsmunion with index index.

void dsm_destroy_union(DSM_UNION *dsmunion);

Frees up any memory that was allocated with the allocation routine. The member DATASETs are left intact; hence, it is your job to free them up.

AUTHOR

Gary William Flake (gary.flake@usa.net).

SEE ALSO

dsmethod(3), and dataset(3).