00001 /*************************************************************************** 00002 * @file gnn_phandle.h 00003 * @brief gnn_phandle Header File. 00004 * 00005 * @date : 15-08-03 01:44 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_PHANDLE_H_ 00028 #define _GNN_PHANDLE_H_ 00029 00030 /******************************************/ 00031 /* Include Files */ 00032 /******************************************/ 00033 00034 #include "gnn_globals.h" 00035 00036 00037 00038 /******************************************/ 00039 /* Typedefs */ 00040 /******************************************/ 00041 00042 /** 00043 * @brief A type for update flags. 00044 * @ingroup gnn_phandle_doc 00045 * 00046 * This flag type is used for keeping track of the updates that are necessary. 00047 */ 00048 typedef enum _phandle_update phandle_update; 00049 00050 enum _phandle_update 00051 { 00052 PHandleCountFlags = 1, 00053 PHandleUseFlags = 2 00054 }; 00055 00056 /** 00057 * @brief The gnn_phandle type. 00058 * @ingroup gnn_phandle_doc 00059 * 00060 * This type holds the necessary information for handling parameters. It stores 00061 * the actual parameter vector, an additional vector for the parameter gradient 00062 * values, and a last vector for marking the frozen parameters. 00063 */ 00064 typedef struct 00065 { 00066 size_t rc; /**< Reference counter. */ 00067 size_t l; /**< Number of the phandle's parameters. */ 00068 size_t free; /**< Number of free parameters. */ 00069 phandle_update modified; /**< Modification flags. */ 00070 gsl_vector *w; /**< Pointer to the parameter vector. */ 00071 gsl_vector *dw; /**< Pointer to the parameter gradient vector. */ 00072 gsl_vector_int *f; /**< Pointer to the parameter freeze flags. */ 00073 } gnn_phandle; 00074 00075 00076 00077 /******************************************/ 00078 /* Public Interface */ 00079 /******************************************/ 00080 00081 gnn_phandle * 00082 gnn_phandle_new (size_t size); 00083 00084 int 00085 gnn_phandle_unref (gnn_phandle *ph); 00086 00087 int 00088 gnn_phandle_ref (gnn_phandle *ph); 00089 00090 gsl_vector * 00091 gnn_phandle_get_w (gnn_phandle *ph); 00092 00093 gsl_vector * 00094 gnn_phandle_get_dw (gnn_phandle *ph); 00095 00096 gsl_vector_int * 00097 gnn_phandle_get_f (gnn_phandle *ph); 00098 00099 int 00100 gnn_phandle_update (gnn_phandle *ph); 00101 00102 00103 00104 #endif /* _GNN_PHANDLE_H_ */ 00105 00106 00107
1.2.18