home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume28 / backprop / part03 / ibp.h next >
C/C++ Source or Header  |  1992-02-23  |  3KB  |  87 lines

  1. /* ****************************************************** */
  2. /* file ibp.h: contains definitions for programs that use */
  3. /*             16-bit integer weights                     */
  4. /*                                                        */
  5. /* Copyright (c) 1991 by Donald R. Tveter                 */
  6. /*                                                        */
  7. /* ****************************************************** */
  8.  
  9. #ifdef DOS16
  10. #define INT32 long
  11. #define MAXINT 32767
  12. #else
  13. #define INT32 int
  14. #define MAXINT 2147483647
  15. #endif
  16.  
  17. #define maxformat 21          /* maximum number of format breaks */
  18. #define buffsize 257          /* maximum size of an input line */
  19. #define WTTYPE short          /* a 16-bit integer */
  20. #define WTSIZE 2              /* shorts are two bytes */
  21. #define MAXSHORT 32767        /* largest short */
  22. #define MINSHORT -32768       /* smallest short */
  23. #define OUTSTRSIZE 257        /* max size of output string */
  24. #define HCODE -32768          /* code number for a layer h (2) unit */
  25. #define ICODE -32767          /* code number for a layer i (3) unit */
  26. #define JCODE -32766          /* code number for a layer j (4) unit */
  27. #define KCODE -32765          /* code number for a layer k (5) unit */
  28. #define GT 0                  /* a symbol meaning > */
  29. #define GE 1                  /* a symbol meaning >= */
  30.  
  31. #ifdef FLOAT
  32. #define REAL float
  33. #else
  34. #define REAL double
  35. #endif
  36.  
  37. typedef struct seednode
  38.    {
  39.      unsigned val;            /* a seed value */
  40.      struct seednode *next;   /* pointer to next node */
  41.    } SEEDNODE;
  42. typedef struct patlist
  43.    {
  44.      int bypass;              /* number of times to bypass pattern */
  45.      WTTYPE *pats;            /* the list of patterns */
  46.      struct patlist *next;    /* pointer to the next pattern */
  47.    } PATLIST;
  48. typedef struct unit
  49.    {
  50.      short layernumber;       /* layer number of the unit */
  51.      short unitnumber;        /* position within layer */
  52.      INT32 error;             /* to sum error factors */
  53.      WTTYPE oj;               /* state of activation of node */
  54.      WTTYPE tj;               /* output target of a node */
  55.      struct wtnode *wtlist;   /* the list of weights */
  56.      struct unit *next;       /* link to next unit in this layer */
  57.    } UNIT;
  58.  
  59. typedef struct wtnode
  60.    {
  61. #ifdef SYMMETRIC
  62.      WTTYPE *weight;          /* ptr to weight */
  63.      WTTYPE *olddw;           /* ptr to delta wji */
  64.      WTTYPE *eta;             /* ptr to eta for the DBD method */
  65.      INT32 *total;            /* ptr to total of weight changes */
  66.      WTTYPE *slope;           /* previous slope */
  67. #else
  68.      WTTYPE weight;           /* weight from here to backunit */
  69.      WTTYPE olddw;            /* delta wji from previous iteration */
  70.      WTTYPE eta;              /* the eta for the DBD method */
  71.      INT32 total;             /* total weight changes for batch mode */
  72.      WTTYPE slope;            /* previous slope */
  73. #endif
  74.      struct wtnode *next;     /* link to next node */
  75.      UNIT *backunit;          /* ptr to unit the weight comes from */
  76.    } WTNODE;
  77.  
  78. typedef struct layer
  79.    {
  80.      int unitcount;           /* number of units in this layer */
  81.      struct layer *backlayer; /* pointer to previous layer */
  82.      struct layer *next;      /* pointer to next layer */
  83.      UNIT *units;             /* start of list of units in this layer */
  84.      PATLIST *patstart;       /* to the list of patterns */
  85.      PATLIST *currentpat;     /* the current pattern */
  86.    } LAYER;
  87.