                     &cost, theta1Grad, theta2Grad, 
                     tempMatrix );
 
-//      printf("iter %d j %d cost is %.3e val %f\n",iter,j,cost,Y[j]);
-
       for( int i = 0; i < theta1Rows*theta1Cols; i++ )
         theta1[i] -= lambda * theta1Grad[i];
 
       for( int i = 0; i < theta2Rows*theta2Cols; i++ )
         theta2[i] -= lambda * theta2Grad[i];
-//      printf("j %d val %f\n",j,Y[j]);
-//     exit(911);
     } 
- // } /* end for i */
-  iter++;
+    iter++;
     printf("|");
     fflush(stdout);
     if( iter % 72 == 0 ) printf("\n");

                                theta2Rows * theta2Cols );

  tempMatrix = (floatType_t *) malloc( sizeof(floatType_t) *
                               ( Xexamples * (theta1Rows+1) + 
                                 Xexamples * (theta1Rows+1) +
                                 Xexamples * (theta2Rows+1) + 
                                 theta2Cols + 11) );

  for( int i = 0; i < Xexamples; i++ ) 
    X[INDX(0,i,Xfeatures)] = (floatType_t) 1.0;

  *cost = jTemp;
#endif
#endif

  floatType_t *delta3;
  delta3 = yTemp;

#if 1
  for( int row = 0; row < Xexamples; row++ )
  { 
    memset( &delta3[INDX(0,row,11)], 0, sizeof( floatType_t) * 11 );
    delta3[INDX((int)Y[row],row,11)] = (floatType_t) 1.0;
    for( int j = 0; j < 10; j++ ) 
    {
      delta3[INDX(j+1,row,11)] = a3[INDX(row,j,Xexamples)] 
                               - delta3[INDX(j+1,row,11)];
    } /* end for j */
  } /* end for */

  if( sizeof( floatType_t ) == 4 )
  {

    cblas_sgemm( CblasColMajor, CblasTrans, CblasNoTrans,
                 theta2Cols, Xexamples, theta2Rows,
                 1.0f, theta2, theta2Rows,
                 &delta3[1],11, 0.0f,
                 delta2,theta1Rows+1);

    for( int row = 0; row < Xexamples; row++ )
    { 
      for( int j = 0; j <= theta1Rows; j++ )
      {
        delta2[INDX(j,row,theta1Rows+1)] *= 
                sigmoidGradient_f( z2[INDX(row,j,Xexamples)] );
      } /* end for */
    } /* end for */
  } /* end if */
  else
  { 
  } /* end else */

  floatType_t recip = (floatType_t) 1.0 / (floatType_t) Xexamples;

  cblas_sgemm( CblasColMajor, CblasNoTrans, CblasTrans,
               theta1Rows, theta1Cols, Xexamples,
               recip, (float *) &delta2[1], theta1Rows+1,
               X, Xfeatures,
               0.0f, (float *) theta1Grad, theta1Rows );

  cblas_sgemm( CblasColMajor, CblasNoTrans, CblasNoTrans,
               theta2Rows, theta2Cols, Xexamples,
               recip, (float *) &delta3[1], 11,
               (float *) a2, Xexamples, 0.0f,
               (float *) theta2Grad, theta2Rows );


#endif
} /* end costFunction */

