home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Id: Neural.h 1.14 1995/08/29 23:16:05 daltern Exp $
- *
- * This is the general header file for the program nnn and its
- * associated functions.
- *
- */
-
- /*========================================================================*
- INCLUDES
- *========================================================================*/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <string.h>
- #include <signal.h>
-
- /*
- * Amiga specific includes
- */
-
- #ifdef _AMIGA
-
- #include <dos.h>
-
- #endif
-
- /*========================================================================*
- DEFINITIONS
- *========================================================================*/
-
- #define TRUE 1
- #define FALSE 0
-
- #define RAND_FUNC drand48
- #define SEED_FUNC srand48
-
- #define NUM_RAND_STEPS 20
-
- #define HIGH_STATE 1
- #define LOW_STATE 0
-
- #define MAXCHAR 100
- #define MAX_VECS 1000
- #define MAX_ITS 10000
-
- #define USER_UPDATE 50
-
- static char *DELIMITER[] = {
- "#Weights", /* Start of section storing ANN weights */
- "#Vectors", /* Start of section storing input vectors */
- "#Layers" /* Start of layer size info */
- };
-
- /*========================================================================*
- DATA TYPES
- *========================================================================*/
-
- struct Vectors {
-
- int NumVecs;
- float **InVec;
- float **OutVec;
-
- };
-
- typedef struct Vectors VECTOR;
-
-
- struct Net {
-
- int NumLayers;
- int *LayerSize;
-
- };
-
- typedef struct Net NET;
-
- /*=========================================================================*
- PROTOTYPES
- *=========================================================================*/
-
- extern float NetTransFunc( float,float );
- extern void NetFeedForward( float ***,float **,NET,float );
- extern void NetBackProp( float ***,float ***,float **,NET,float *,float,float,float );
- extern void NetWriteConfig( NET,VECTOR,float ***,float,float,float,float,float,float );
- extern void NetVecRand( VECTOR * );
- extern void NetExit( NET *,VECTOR *,float **, float ***,float *** );
- extern void NetAbort( int );
- extern double drand48( void );
- extern void srand48( long );
-
- /*=========================================================================*
- END OF NEURAL.H
- *=========================================================================*/
-
- /*
- * $Id: Neural.h 1.14 1995/08/29 23:16:05 daltern Exp $
- *
- * This header file defines some macros for array allocation
- * and deallocation.
- *
- */
-
- /*
- * NOTE requires i,j and array to be defined in program
- */
-
- #define MAKE1D(array,type,rows) {\
- array = (type *)malloc(rows * sizeof(type)); \
- }
-
- #define MAKE2D(array,type,rows,cols) {\
- array = (type **)malloc(rows * sizeof(type *)); \
- for (i = 0; i < rows; i++) \
- array[i] = (type *)malloc(cols * sizeof(type)); \
- }
-
- #define MAKE3D(array,type,depth,rows,cols) {\
- array = (type *** )malloc(depth * sizeof(type **));\
- for ( i = 0; i < depth; i++ ) {\
- array[i] = (type **)malloc(rows * sizeof(type *));\
- for ( j = 0; j < rows; j++ )\
- array[i][j] = (type *)malloc(cols * sizeof(type));\
- }\
- }
-
- #define FREE3D(array,depth,rows) {\
- for( i = 0; i < depth; i++ ) {\
- for ( j = 0; j < rows; j++ )\
- free(array[i][j]);\
- free(array[i]);\
- }\
- free(array);\
- }
-
- #define FREE2D(array,rows) {\
- for(i = 0; i < rows; i++) \
- free(array[i]); \
- free(array);\
- }
-
-
-
-
-
-
-