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

Go to the documentation of this file.
00001 /*********************************************************
00002   LCDNNHFSelectNoVertexGhostZpole.c
00003   --------------------------------------------------------
00004   generated at Fri Sep 28 11:25:36 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[16];
00025   /* Sources definition section */
00026   static pUnit Sources[] =  {
00027 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, 
00028 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, 
00029 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, 
00030 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, 
00031 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, 
00032 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, 
00033 Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, 
00034 Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13, 
00035 Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13, 
00036 
00037   };
00038 
00039   /* Weigths definition section */
00040   static float Weights[] =  {
00041 -1.091470, 1.472280, -10.663780, -14.205880, -35.277870, 8.977430, 
00042 3.353060, 2.296610, 23.082180, -11.771740, -23.037800, -1.114020, 
00043 -1.959030, 1.007720, -71.049477, 4.672230, -27.894140, 15.685980, 
00044 0.722460, -2.683560, 37.604359, -17.773970, -36.315941, 0.840390, 
00045 0.919210, -0.003450, -52.938679, -12.701330, -9.339780, -9.338240, 
00046 2.940960, 20.080669, 0.918720, -1.309030, -2.374110, -1.345020, 
00047 -2.499760, -3.271300, -10.803810, 8.644160, -10.634920, -0.911810, 
00048 1.486460, -2.306990, -1.243920, 2.449150, 1.102330, -3.411190, 0.346620, 
00049 -2.256800, -1.816480, -3.744570, 2.156200, 3.470020, 1.158750, 2.578590, 
00050 
00051   };
00052 
00053   /* unit definition section (see also UnitType) */
00054   static UnitType Units[16] = 
00055   {
00056     { 0.0, 0.0, 0, NULL , NULL },
00057     { /* unit 1 (Old: 1) */
00058       0.0, 1.000000, 0,
00059        &Sources[0] , 
00060        &Weights[0] , 
00061       },
00062     { /* unit 2 (Old: 2) */
00063       0.0, 0.998030, 0,
00064        &Sources[0] , 
00065        &Weights[0] , 
00066       },
00067     { /* unit 3 (Old: 3) */
00068       0.0, 0.916740, 0,
00069        &Sources[0] , 
00070        &Weights[0] , 
00071       },
00072     { /* unit 4 (Old: 4) */
00073       0.0, 0.646710, 0,
00074        &Sources[0] , 
00075        &Weights[0] , 
00076       },
00077     { /* unit 5 (Old: 5) */
00078       0.0, 0.270800, 0,
00079        &Sources[0] , 
00080        &Weights[0] , 
00081       },
00082     { /* unit 6 (Old: 6) */
00083       0.0, 0.817340, 0,
00084        &Sources[0] , 
00085        &Weights[0] , 
00086       },
00087     { /* unit 7 (Old: 7) */
00088       0.0, 3.295970, 6,
00089        &Sources[0] , 
00090        &Weights[0] , 
00091       },
00092     { /* unit 8 (Old: 8) */
00093       0.0, 4.440850, 6,
00094        &Sources[6] , 
00095        &Weights[6] , 
00096       },
00097     { /* unit 9 (Old: 9) */
00098       0.0, 34.072128, 6,
00099        &Sources[12] , 
00100        &Weights[12] , 
00101       },
00102     { /* unit 10 (Old: 10) */
00103       0.0, 2.369710, 6,
00104        &Sources[18] , 
00105        &Weights[18] , 
00106       },
00107     { /* unit 11 (Old: 11) */
00108       0.0, 21.554449, 6,
00109        &Sources[24] , 
00110        &Weights[24] , 
00111       },
00112     { /* unit 12 (Old: 12) */
00113       0.0, 3.018940, 6,
00114        &Sources[30] , 
00115        &Weights[30] , 
00116       },
00117     { /* unit 13 (Old: 13) */
00118       0.0, 11.601570, 6,
00119        &Sources[36] , 
00120        &Weights[36] , 
00121       },
00122     { /* unit 14 (Old: 14) */
00123       0.0, 1.490300, 7,
00124        &Sources[42] , 
00125        &Weights[42] , 
00126       },
00127     { /* unit 15 (Old: 15) */
00128       0.0, -1.755150, 7,
00129        &Sources[49] , 
00130        &Weights[49] , 
00131       }
00132 
00133   };
00134 
00135 
00136 
00137 int LCDNNHFSelectNoVertexGhostZpole(float *in, float *out, int init)
00138 {
00139   int member, source;
00140   float sum;
00141   enum{OK, Error, Not_Valid};
00142   pUnit unit;
00143 
00144 
00145   /* layer definition section (names & member units) */
00146 
00147   static pUnit Input[6] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6}; /* members */
00148 
00149   static pUnit Hidden1[7] = {Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13}; /* members */
00150 
00151   static pUnit Output1[2] = {Units + 14, Units + 15}; /* members */
00152 
00153   static int Output[2] = {14, 15};
00154 
00155   for(member = 0; member < 6; member++) {
00156     Input[member]->act = in[member];
00157   }
00158 
00159   for (member = 0; member < 7; member++) {
00160     unit = Hidden1[member];
00161     sum = 0.0;
00162     for (source = 0; source < unit->NoOfSources; source++) {
00163       sum += unit->sources[source]->act
00164              * unit->weights[source];
00165     }
00166     unit->act = Act_Logistic(sum, unit->Bias);
00167   };
00168 
00169   for (member = 0; member < 2; member++) {
00170     unit = Output1[member];
00171     sum = 0.0;
00172     for (source = 0; source < unit->NoOfSources; source++) {
00173       sum += unit->sources[source]->act
00174              * unit->weights[source];
00175     }
00176     unit->act = Act_Logistic(sum, unit->Bias);
00177   };
00178 
00179   for(member = 0; member < 2; member++) {
00180     out[member] = Units[Output[member]].act;
00181   }
00182 
00183   return(OK);
00184 }

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