protected void check(){
  double tsum;
  int i, j;
  double s=0;
  for (i=0; i < examples_total; i++) {
    tsum=0;
    s+=alphas[i];
    for (j=0; j < examples.count_examples(); j++) {
      tsum+=alphas[j] * kernel.calculate_K(i,j);
    }
    ;
    if (Math.abs(tsum - sum[i]) > is_zero) {
      logln(1,"ERROR: sum[" + i + "] off by "+ (tsum - sum[i])+ " (is "+ sum[i]+ ", should be "+ tsum);
    }
    ;
  }
  ;
  tsum=0.0;
  for (j=0; j < examples.count_examples(); j++) {
    tsum+=alphas[j];
  }
  ;
  if (Math.abs(tsum - 1) > is_zero) {
    logln(1,"ERROR: sum over all alphas is off by " + (tsum - 1));
  }
  if (Math.abs(s + sum_alpha - 1) > is_zero) {
    logln(1,"ERROR: sum_alpha is off by " + (s + sum_alpha - 1));
  }
  ;
}

protected void check ( ) { double tsum ; int i , j ; double s = 0 ; for ( i = 0 ; i < examples_total ; i ++ ) { tsum = 0 ; s += alphas [ i ] ; for ( j = 0 ; j < examples . count_examples ( ) ; j ++ ) { tsum += alphas [ j ] * kernel . calculate_K ( i , j ) ; } ; if ( Math . abs ( tsum - sum [ i ] ) > is_zero ) { logln ( 1 , "ERROR: sum[" + i + "] off by " + ( tsum - sum [ i ] ) + " (is " + sum [ i ] + ", should be " + tsum ) ; } ; } ; tsum = 0.0 ; for ( j = 0 ; j < examples . count_examples ( ) ; j ++ ) { tsum += alphas [ j ] ; } ; if ( Math . abs ( tsum - 1 ) > is_zero ) { logln ( 1 , "ERROR: sum over all alphas is off by " + ( tsum - 1 ) ) ; } if ( Math . abs ( s + sum_alpha - 1 ) > is_zero ) { logln ( 1 , "ERROR: sum_alpha is off by " + ( s + sum_alpha - 1 ) ) ; } ; }
check internal variables , for debugging only
