           j = ceil( (float) trainingSize * 
                       float( rand() ) / ( float(RAND_MAX) + 1.0f ) );
 //        j = 3918;
- //       printf("j is %d\n",j);
-
+//       j = (i + 1) % trainingSize;
+ //      printf("j =  %d\n",j+1);
+  //     if( j >= 19 ) exit(911);
+
+        tempSum = 0.0f;
         for( int k = 0; k < trainingSize; k++ )
         {  
           tempSum += ( alphas[k] * y[k] * K[ INDX(k,j,trainingSize) ] );
+//        if( alphas[k] != 0.0f ) 
+ //          printf("k %d alphas %f y %f K %f\n",k+1,alphas[k],
+  //           y[k],K[INDX(k,j,trainingSize)] );
         } /* end for j */
         
         E[j] = b + tempSum - y[j];
+
+//printf("b = %f\n",b);
+//printf("tempsum = %f\n",tempSum);
+//printf("Yj = %f\n",y[j] );
+//printf("E_j = %f\n\n",E[j]);
 
         float alphaIOld = alphas[i];
         float alphaJOld = alphas[j];

   
  } /* end while */

  printf("b is %f\n");

  free(E); 
  free(alphas);

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

extern "C" 
