@Override public double calculateDistance(double[] x1,double[] x2){
  double result=0;
  int zeros=x1.length;
  for (int i=0; i < x1.length; i++) {
    double factor=x1[i] - x2[i];
    result+=Math.exp(gamma * factor * factor);
    if (Tools.isNotEqual(x1[i],0.0d) || Tools.isNotEqual(x2[i],0.0d)) {
      zeros--;
    }
  }
  result+=zeros;
  return Math.pow(result,degree);
}

@ Override public double calculateDistance ( double [ ] x1 , double [ ] x2 ) { double result = 0 ; int zeros = x1 . length ; for ( int i = 0 ; i < x1 . length ; i ++ ) { double factor = x1 [ i ] - x2 [ i ] ; result += Math . exp ( gamma * factor * factor ) ; if ( Tools . isNotEqual ( x1 [ i ] , 0.0d ) || Tools . isNotEqual ( x2 [ i ] , 0.0d ) ) { zeros -- ; } } result += zeros ; return Math . pow ( result , degree ) ; }
calculates kernel value of vectors x and y .
