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

Go to the documentation of this file.
00001 /*********************************************************
00002   LCDNNSeedVertexGhostZpole.c
00003   --------------------------------------------------------
00004   generated at Fri Jul 27 10:22:11 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[13];
00025   /* Sources definition section */
00026   static pUnit Sources[] =  {
00027 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, 
00028 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, 
00029 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, 
00030 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, 
00031 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, 
00032 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, 
00033 Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, 
00034 
00035   };
00036 
00037   /* Weigths definition section */
00038   static float Weights[] =  {
00039 -3.882730, -11.128990, -1.552260, 1.097860, -1.082930, 
00040 -8.477330, 5.212630, 2.524730, -2.874820, -31.249710, 
00041 -45.045879, 44.484032, -2.042260, -0.181990, -0.404870, 
00042 -9.830090, 10.233000, -12.212890, 20.309271, -2.085340, 
00043 -0.704160, -4.216290, 4.788130, 34.409191, 13.641250, 
00044 11.903910, 5.722210, -36.021919, -6.007910, 9.924050, 
00045 -9.497470, -2.559170, -23.623409, -5.136000, 11.024650, 1.340620, 
00046 
00047   };
00048 
00049   /* unit definition section (see also UnitType) */
00050   static UnitType Units[13] = 
00051   {
00052     { 0.0, 0.0, 0, NULL , NULL },
00053     { /* unit 1 (Old: 1) */
00054       0.0, 0.207070, 0,
00055        &Sources[0] , 
00056        &Weights[0] , 
00057       },
00058     { /* unit 2 (Old: 2) */
00059       0.0, -0.680970, 0,
00060        &Sources[0] , 
00061        &Weights[0] , 
00062       },
00063     { /* unit 3 (Old: 3) */
00064       0.0, 0.293330, 0,
00065        &Sources[0] , 
00066        &Weights[0] , 
00067       },
00068     { /* unit 4 (Old: 4) */
00069       0.0, 0.106830, 0,
00070        &Sources[0] , 
00071        &Weights[0] , 
00072       },
00073     { /* unit 5 (Old: 5) */
00074       0.0, 0.362610, 0,
00075        &Sources[0] , 
00076        &Weights[0] , 
00077       },
00078     { /* unit 6 (Old: 6) */
00079       0.0, 5.558230, 5,
00080        &Sources[0] , 
00081        &Weights[0] , 
00082       },
00083     { /* unit 7 (Old: 7) */
00084       0.0, 6.822320, 5,
00085        &Sources[5] , 
00086        &Weights[5] , 
00087       },
00088     { /* unit 8 (Old: 8) */
00089       0.0, -7.845120, 5,
00090        &Sources[10] , 
00091        &Weights[10] , 
00092       },
00093     { /* unit 9 (Old: 9) */
00094       0.0, 8.612170, 5,
00095        &Sources[15] , 
00096        &Weights[15] , 
00097       },
00098     { /* unit 10 (Old: 10) */
00099       0.0, -2.701270, 5,
00100        &Sources[20] , 
00101        &Weights[20] , 
00102       },
00103     { /* unit 11 (Old: 11) */
00104       0.0, 11.499900, 5,
00105        &Sources[25] , 
00106        &Weights[25] , 
00107       },
00108     { /* unit 12 (Old: 12) */
00109       0.0, -2.062570, 6,
00110        &Sources[30] , 
00111        &Weights[30] , 
00112       }
00113 
00114   };
00115 
00116 
00117 
00118 int LCDNNSeedVertexGhostZpole(float *in, float *out, int init)
00119 {
00120   int member, source;
00121   float sum;
00122   enum{OK, Error, Not_Valid};
00123   pUnit unit;
00124 
00125 
00126   /* layer definition section (names & member units) */
00127 
00128   static pUnit Input[5] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5}; /* members */
00129 
00130   static pUnit Hidden1[6] = {Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11}; /* members */
00131 
00132   static pUnit Output1[1] = {Units + 12}; /* members */
00133 
00134   static int Output[1] = {12};
00135 
00136   for(member = 0; member < 5; member++) {
00137     Input[member]->act = in[member];
00138   }
00139 
00140   for (member = 0; member < 6; member++) {
00141     unit = Hidden1[member];
00142     sum = 0.0;
00143     for (source = 0; source < unit->NoOfSources; source++) {
00144       sum += unit->sources[source]->act
00145              * unit->weights[source];
00146     }
00147     unit->act = Act_Logistic(sum, unit->Bias);
00148   };
00149 
00150   for (member = 0; member < 1; member++) {
00151     unit = Output1[member];
00152     sum = 0.0;
00153     for (source = 0; source < unit->NoOfSources; source++) {
00154       sum += unit->sources[source]->act
00155              * unit->weights[source];
00156     }
00157     unit->act = Act_Logistic(sum, unit->Bias);
00158   };
00159 
00160   for(member = 0; member < 1; member++) {
00161     out[member] = Units[Output[member]].act;
00162   }
00163 
00164   return(OK);
00165 }

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