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

Go to the documentation of this file.
00001 /*********************************************************
00002   LCDNNSeedVertexGhostZH.c
00003   --------------------------------------------------------
00004   generated at Wed Oct  3 10:07:38 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 -5.869110, 5.936460, -9.458780, -6.020320, -25.658480, 
00040 -11.417530, 24.990299, -4.489060, -2.149350, 2.413150, 
00041 -10.565690, -15.414130, -7.729310, -1.309070, 2.701430, 
00042 2.881950, 8.133370, -13.626310, -1.938240, 4.757070, 
00043 8.936280, -4.139960, -1.550350, -11.172940, 9.381650, 
00044 -36.752911, 36.898708, -4.259490, -3.344440, 4.639180, 
00045 -3.801780, 2.276410, -6.366680, 2.325480, 4.090340, -8.688140, 
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, 1.000000, 0,
00055        &Sources[0] , 
00056        &Weights[0] , 
00057       },
00058     { /* unit 2 (Old: 2) */
00059       0.0, 0.998030, 0,
00060        &Sources[0] , 
00061        &Weights[0] , 
00062       },
00063     { /* unit 3 (Old: 3) */
00064       0.0, 0.916740, 0,
00065        &Sources[0] , 
00066        &Weights[0] , 
00067       },
00068     { /* unit 4 (Old: 4) */
00069       0.0, 0.646710, 0,
00070        &Sources[0] , 
00071        &Weights[0] , 
00072       },
00073     { /* unit 5 (Old: 5) */
00074       0.0, 0.270800, 0,
00075        &Sources[0] , 
00076        &Weights[0] , 
00077       },
00078     { /* unit 6 (Old: 6) */
00079       0.0, 11.205680, 5,
00080        &Sources[0] , 
00081        &Weights[0] , 
00082       },
00083     { /* unit 7 (Old: 7) */
00084       0.0, -3.303060, 5,
00085        &Sources[5] , 
00086        &Weights[5] , 
00087       },
00088     { /* unit 8 (Old: 8) */
00089       0.0, 11.387990, 5,
00090        &Sources[10] , 
00091        &Weights[10] , 
00092       },
00093     { /* unit 9 (Old: 9) */
00094       0.0, 0.655450, 5,
00095        &Sources[15] , 
00096        &Weights[15] , 
00097       },
00098     { /* unit 10 (Old: 10) */
00099       0.0, -1.333310, 5,
00100        &Sources[20] , 
00101        &Weights[20] , 
00102       },
00103     { /* unit 11 (Old: 11) */
00104       0.0, -5.683780, 5,
00105        &Sources[25] , 
00106        &Weights[25] , 
00107       },
00108     { /* unit 12 (Old: 12) */
00109       0.0, -1.116850, 6,
00110        &Sources[30] , 
00111        &Weights[30] , 
00112       }
00113 
00114   };
00115 
00116 
00117 
00118 int LCDNNSeedVertexGhostZH(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