Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

gnn_input.h File Reference

#include "gnn_globals.h"

Include dependency graph for gnn_input.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  _gnn_input

Typedefs

typedef _gnn_input gnn_input
 The datatype for inputs.

typedef int(* gnn_input_reset_type )(gnn_input *set)
 The datatype for gnn_input : Reading and handling of sets of vectors. reset functions.

typedef const gsl_vector *(* gnn_input_get_type )(gnn_input *set, size_t k)
 The datatype for gnn_input : Reading and handling of sets of vectors. get functions.

typedef void(* gnn_input_destroy_type )(gnn_input *set)
 The datatype for gnn_input : Reading and handling of sets of vectors. destructor functions.


Functions

int gnn_input_init (gnn_input *set, size_t size, size_t n, gnn_input_reset_type reset, gnn_input_get_type get, gnn_input_destroy_type destroy)
 Initializes a gnn_input : Reading and handling of sets of vectors..

void gnn_input_destroy (gnn_input *set)
 Destroy a gnn_input : Reading and handling of sets of vectors..

int gnn_input_reset (gnn_input *set)
 Reset a input set.

const gsl_vector * gnn_input_get (gnn_input *set, size_t k)
 Gets the k-th sample.

size_t gnn_input_get_size (gnn_input *set)
 Gets the number of samples in the set.

size_t gnn_input_sample_get_size (gnn_input *set)
 Gets the sample's size.


Function Documentation

void gnn_input_destroy gnn_input   set
 

This function destroys the input reader.

Parameters:
set  A pointer to a gnn_input : Reading and handling of sets of vectors..

Definition at line 207 of file gnn_input.c.

const gsl_vector* gnn_input_get gnn_input   set,
size_t    k
 

This function returns a pointer to a buffer containing the k-th sample vector. The content of the pointed vector will be valid until a next function call on this input set.

Parameters:
set  A pointer to a gnn_input : Reading and handling of sets of vectors..
k  The index of the sample to be retrieved.
Returns:
Returns a pointer to a buffer containing the sample vector, or NULL else.

Definition at line 246 of file gnn_input.c.

size_t gnn_input_get_size gnn_input   set
 

This function returns the set's size.

Parameters:
set  A pointer to a gnn_input : Reading and handling of sets of vectors..
Returns:
Returns the size.

Definition at line 264 of file gnn_input.c.

int gnn_input_init gnn_input   set,
size_t    size,
size_t    n,
gnn_input_reset_type    reset,
gnn_input_get_type    get,
gnn_input_destroy_type    destroy
 

This function initializes a given vector reader, setting its properties and installing its functions.

If the "reset", or "destroy" functions aren't provided, then the default functions gnn_input : Reading and handling of sets of vectors. and gnn_input : Reading and handling of sets of vectors. are installed respectively. The "get" function is mandatory, and should always be provided.

As an example, suppose that you have made your own extension to the gnn_input : Reading and handling of sets of vectors. datatype, one that reads from a serial port, which you called "serial_reader". Also, suppose you have already coded the appropiate "reset", "get" and "destroy" functions for your special reader. Then,

   serial_reader *myinput; // a pointer to the input reader to be created
   gnn_input     *set;     // a pointer to the same structure, but viewed as a
                           // gnn_input

   // allocate memory for the input reader
   myinput = (serial_reader *) malloc (sizeof (serial_reader));
   
   // view as a gnn_input
   set = (gnn_input *) myinput;

   // initialize the input (you know there are only 100 samples)
   gnn_input_init (set, 100, 5, serial_reader_reset,
                                serial_reader_get,
                                serial_reader_destroy);
would initialize your input reader for 100 patterns, whose sample vectors are of size 5.
Parameters:
set  A pointer to a gnn_input : Reading and handling of sets of vectors..
size  The number of samples that it contains.
n  The size of the samples.
reset  A pointer to the input's "reset" function.
get  A pointer to the input's "get" function.
destroy  A pointer to the input's "destroy" function.
Returns:
0 if succeeded.

Definition at line 153 of file gnn_input.c.

int gnn_input_reset gnn_input   set
 

This function resets the input handler.

Parameters:
set  A pointer to a gnn_input : Reading and handling of sets of vectors..
Returns:
0 if succeeded.

Definition at line 225 of file gnn_input.c.

size_t gnn_input_sample_get_size gnn_input   set
 

This function returns the size of the samples.

Parameters:
set  A pointer to a gnn_input : Reading and handling of sets of vectors..
Returns:
Returns the size.

Definition at line 281 of file gnn_input.c.


Generated on Sun Jun 13 20:50:46 2004 for libgnn Gradient Retropropagation Machine Library by doxygen1.2.18