/Home/aooliver/hepsoft/lcdroot/LCDRootApps/PhUtil/src/LCDNNSeedVertexOneProngGhostZpole.c

Go to the documentation of this file.
00001 /*********************************************************
00002   LCDNNSeedVertexOneProngGhostZpole.c
00003   --------------------------------------------------------
00004   generated at Mon Jul 30 17:20:35 2001
00005   by snns2c ( Bernward Kett 1995 ) 
00006 *********************************************************/
00007 
00008 #include <math.h>
00009 
00010 #define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
00011 #ifndef NULL
00012 #define NULL (void *)0
00013 #endif
00014 
00015 typedef struct UT {
00016           float act;         /* Activation       */
00017           float Bias;        /* Bias of the Unit */
00018           int   NoOfSources; /* Number of predecessor units */
00019    struct UT   **sources; /* predecessor units */
00020           float *weights; /* weights from predecessor units */
00021         } UnitType, *pUnit;
00022 
00023   /* Forward Declaration for all unit types */
00024   static UnitType Units[9];
00025   /* Sources definition section */
00026   static pUnit Sources[] =  {
00027 Units + 1, Units + 2, Units + 3, 
00028 Units + 1, Units + 2, Units + 3, 
00029 Units + 1, Units + 2, Units + 3, 
00030 Units + 1, Units + 2, Units + 3, 
00031 Units + 4, Units + 5, Units + 6, Units + 7, 
00032 
00033   };
00034 
00035   /* Weigths definition section */
00036   static float Weights[] =  {
00037 10.623890, -15.589810, 1.442860, 
00038 18.245501, 3.384990, 17.455681, 
00039 3.099190, -0.075360, 21.866150, 
00040 5.390570, 1.859890, 2.005130, 
00041 -3.352290, 7.801670, -2.961030, -5.050520, 
00042 
00043   };
00044 
00045   /* unit definition section (see also UnitType) */
00046   static UnitType Units[9] = 
00047   {
00048     { 0.0, 0.0, 0, NULL , NULL },
00049     { /* unit 1 (Old: 1) */
00050       0.0, 0.449700, 0,
00051        &Sources[0] , 
00052        &Weights[0] , 
00053       },
00054     { /* unit 2 (Old: 2) */
00055       0.0, 0.608580, 0,
00056        &Sources[0] , 
00057        &Weights[0] , 
00058       },
00059     { /* unit 3 (Old: 3) */
00060       0.0, 0.280890, 0,
00061        &Sources[0] , 
00062        &Weights[0] , 
00063       },
00064     { /* unit 4 (Old: 4) */
00065       0.0, -7.014560, 3,
00066        &Sources[0] , 
00067        &Weights[0] , 
00068       },
00069     { /* unit 5 (Old: 5) */
00070       0.0, -18.757490, 3,
00071        &Sources[3] , 
00072        &Weights[3] , 
00073       },
00074     { /* unit 6 (Old: 6) */
00075       0.0, -18.780190, 3,
00076        &Sources[6] , 
00077        &Weights[6] , 
00078       },
00079     { /* unit 7 (Old: 7) */
00080       0.0, -5.942020, 3,
00081        &Sources[9] , 
00082        &Weights[9] , 
00083       },
00084     { /* unit 8 (Old: 8) */
00085       0.0, -2.768370, 4,
00086        &Sources[12] , 
00087        &Weights[12] , 
00088       }
00089 
00090   };
00091 
00092 
00093 
00094 int LCDNNSeedVertexOneProngGhostZpole(float *in, float *out, int init)
00095 {
00096   int member, source;
00097   float sum;
00098   enum{OK, Error, Not_Valid};
00099   pUnit unit;
00100 
00101 
00102   /* layer definition section (names & member units) */
00103 
00104   static pUnit Input[3] = {Units + 1, Units + 2, Units + 3}; /* members */
00105 
00106   static pUnit Hidden1[4] = {Units + 4, Units + 5, Units + 6, Units + 7}; /* members */
00107 
00108   static pUnit Output1[1] = {Units + 8}; /* members */
00109 
00110   static int Output[1] = {8};
00111 
00112   for(member = 0; member < 3; member++) {
00113     Input[member]->act = in[member];
00114   }
00115 
00116   for (member = 0; member < 4; member++) {
00117     unit = Hidden1[member];
00118     sum = 0.0;
00119     for (source = 0; source < unit->NoOfSources; source++) {
00120       sum += unit->sources[source]->act
00121              * unit->weights[source];
00122     }
00123     unit->act = Act_Logistic(sum, unit->Bias);
00124   };
00125 
00126   for (member = 0; member < 1; member++) {
00127     unit = Output1[member];
00128     sum = 0.0;
00129     for (source = 0; source < unit->NoOfSources; source++) {
00130       sum += unit->sources[source]->act
00131              * unit->weights[source];
00132     }
00133     unit->act = Act_Logistic(sum, unit->Bias);
00134   };
00135 
00136   for(member = 0; member < 1; member++) {
00137     out[member] = Units[Output[member]].act;
00138   }
00139 
00140   return(OK);
00141 }

Generated on Tue Jul 18 18:33:59 2006 for LCDROOT by  doxygen 1.4.6