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

gnn_output.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *  @file gnn_output.h
00003  *  @brief Output Header File.
00004  *
00005  *  @date   : 21-09-03 20:34
00006  *  @author : Pedro Ortega C. <peortega@dcc.uchile.cl>
00007  *  Copyright  2003  Pedro Ortega C.
00008  ****************************************************************************/
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024 
00025 #ifndef _GNN_OUTPUT_H_
00026 #define _GNN_OUTPUT_H_
00027 
00028 
00029 
00030 /******************************************/
00031 /* Include Files                          */
00032 /******************************************/
00033 
00034 #include "gnn_globals.h"
00035 
00036 
00037 
00038 /******************************************/
00039 /* Typedefs                               */
00040 /******************************************/
00041 
00042 /**
00043  * @brief The datatype for outputs.
00044  * @ingroup gnn_output_doc
00045  *
00046  * This is the datatype that contains the basic elements for the implementation
00047  * of a output vector writer. Every new type of outputs should extend this
00048  * structure.
00049  */
00050 typedef struct _gnn_output gnn_output;
00051 
00052 /**
00053  * @brief The datatype for \ref gnn_output reset functions.
00054  * @ingroup gnn_output_doc
00055  *
00056  * This function type defines the form of the "reset" functions for output
00057  * sets. A "reset" function should prepare the internal properties for
00058  * beginning a new sequence of output pattern writings.
00059  *
00060  * "reset" is usually called after the end of an epoch has been reached.
00061  */
00062 typedef int (*gnn_output_reset_type) (gnn_output *set);
00063 
00064 /**
00065  * @brief The datatype for \ref gnn_output get functions.
00066  * @ingroup gnn_output_doc
00067  *
00068  * This function type defines the form of the "put" functions for output sets.
00069  * A "put" function should save/store the k-th output sample and return
00070  * 0 if suceeded.
00071  */
00072 typedef int (*gnn_output_put_type) (gnn_output *set,
00073                                            size_t k, const gsl_vector *v);
00074 
00075 /**
00076  * @brief The datatype for \ref gnn_output destructor functions.
00077  * @ingroup gnn_output_doc
00078  *
00079  * This function type defines the form of the "destroy" functions for output
00080  * writers. It should deallocate the extension's specific data.
00081  */
00082 typedef void (*gnn_output_destroy_type) (gnn_output *set);
00083 
00084 /**
00085  * @brief Specifies the output device type.
00086  * @ingroup gnn_output_doc
00087  */
00088 typedef enum _gnn_output_type gnn_output_type;
00089 
00090 enum _gnn_output_type {gnnOutputStream, gnnOutputRA};
00091 
00092 struct _gnn_output
00093 {
00094     gnn_output_type mode; /**< Can be a stream or random access device.   */
00095     size_t size;          /**< The number of samples that can be stored.  */
00096     size_t m;             /**< The size of the output samples.            */
00097     gnn_output_reset_type   reset;   /**< The "reset" function pointer.   */
00098     gnn_output_put_type     put;     /**< The "put" function pointer.     */
00099     gnn_output_destroy_type destroy; /**< The "destroy" function pointer. */
00100 };
00101 
00102 
00103 
00104 /******************************************/
00105 /* Public Interface                       */
00106 /******************************************/
00107 
00108 int
00109 gnn_output_init (gnn_output     *set,
00110                  gnn_output_type mode,
00111                  size_t          size,
00112                  size_t          m,
00113                  gnn_output_reset_type   reset,
00114                  gnn_output_put_type     put,
00115                  gnn_output_destroy_type destroy);
00116 
00117 int
00118 gnn_output_stream_init (gnn_output *set,
00119                         gnn_output_reset_type   reset,
00120                         gnn_output_put_type     put,
00121                         gnn_output_destroy_type destroy);
00122 
00123 int
00124 gnn_output_random_access_init (gnn_output  *set,
00125                                size_t       size,
00126                                size_t       m,
00127                                gnn_output_reset_type   reset,
00128                                gnn_output_put_type     put,
00129                                gnn_output_destroy_type destroy);
00130 
00131 void
00132 gnn_output_destroy (gnn_output *set);
00133 
00134 int
00135 gnn_output_reset (gnn_output *set);
00136 
00137 int
00138 gnn_output_put (gnn_output *set, size_t k, const gsl_vector  *v);
00139 
00140 size_t
00141 gnn_output_get_size (gnn_output *set);
00142 
00143 size_t
00144 gnn_output_sample_get_size (gnn_output *set);
00145 
00146 int
00147 gnn_output_is_stream (gnn_output *set);
00148 
00149 int
00150 gnn_output_is_random_access (gnn_output *set);
00151 
00152 
00153 #endif /* _GNN_OUTPUT_H_ */
00154 
00155 
00156 

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