private double distance ( Instance inst1 , double [ ] inst2 ) { double distance = 0.0 ; for ( int i = 0 ; i < numDims ; i ++ ) { double d = inst1 . value ( i ) - inst2 [ i ] ; distance += d * d ; } return Math . sqrt ( distance ) ; }
Calculates Euclidian distance