00001 /*************************************************************************** 00002 * @file gnn_input.h 00003 * @brief Input Header File. 00004 * 00005 * @date : 21-09-03 19:47 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 00026 00027 #ifndef _GNN_INPUT_H_ 00028 #define _GNN_INPUT_H_ 00029 00030 00031 00032 /******************************************/ 00033 /* Include Files */ 00034 /******************************************/ 00035 00036 #include "gnn_globals.h" 00037 00038 00039 00040 /******************************************/ 00041 /* Typedefs */ 00042 /******************************************/ 00043 00044 /** 00045 * @brief The datatype for inputs. 00046 * @ingroup gnn_input_doc 00047 * 00048 * This is the datatype that contains the basic elements for the implementation 00049 * of a inputvector reader. Every new type of inputs should extend this 00050 * structure. 00051 */ 00052 typedef struct _gnn_input gnn_input; 00053 00054 /** 00055 * @brief The datatype for \ref gnn_input reset functions. 00056 * @ingroup gnn_input_doc 00057 * 00058 * This function type defines the form of the "reset" functions for input 00059 * sets. A "reset" function should prepare the internal properties for 00060 * beginning a new sequence of input pattern drawings. 00061 * 00062 * "reset" is usually called after the end of an epoch has been reached. 00063 */ 00064 typedef int (*gnn_input_reset_type) (gnn_input *set); 00065 00066 /** 00067 * @brief The datatype for \ref gnn_input get functions. 00068 * @ingroup gnn_input_doc 00069 * 00070 * This function type defines the form of the "get" functions for input sets. 00071 * A "get" function should return the k-th pattern. The returned vector is 00072 * not intended to be modified. The pointed vector should persist until 00073 * a call on "reset", "get" or "destroy". 00074 */ 00075 typedef const gsl_vector * (*gnn_input_get_type) (gnn_input *set, size_t k); 00076 00077 /** 00078 * @brief The datatype for \ref gnn_input destructor functions. 00079 * @ingroup gnn_input_doc 00080 * 00081 * This function type defines the form of the "destroy" functions for input 00082 * sets. It should deallocate the extension's specific data. 00083 */ 00084 typedef void (*gnn_input_destroy_type) (gnn_input *set); 00085 00086 struct _gnn_input 00087 { 00088 size_t size; /**< The number of patterns in the dataset. */ 00089 size_t n; /**< The size of the input patterns. */ 00090 gnn_input_reset_type reset; /**< The "reset" function pointer. */ 00091 gnn_input_get_type get; /**< The "get" function pointer. */ 00092 gnn_input_destroy_type destroy; /**< The "destroy" function pointer. */ 00093 }; 00094 00095 00096 00097 /******************************************/ 00098 /* Public Interface */ 00099 /******************************************/ 00100 00101 int 00102 gnn_input_init (gnn_input *set, 00103 size_t size, 00104 size_t n, 00105 gnn_input_reset_type reset, 00106 gnn_input_get_type get, 00107 gnn_input_destroy_type destroy); 00108 00109 void 00110 gnn_input_destroy (gnn_input *set); 00111 00112 int 00113 gnn_input_reset (gnn_input *set); 00114 00115 const gsl_vector * 00116 gnn_input_get (gnn_input *set, 00117 size_t k); 00118 00119 size_t 00120 gnn_input_get_size (gnn_input *set); 00121 00122 size_t 00123 gnn_input_sample_get_size (gnn_input *set); 00124 00125 00126 00127 #endif /* _GNN_INPUT_H_ */ 00128 00129 00130
1.2.18