protected static double weightedDistance ( NumberVector v1 , NumberVector v2 , long [ ] weightVector ) { double sqrDist = 0 ; for ( int i = BitsUtil . nextSetBit ( weightVector , 0 ) ; i >= 0 ; i = BitsUtil . nextSetBit ( weightVector , i + 1 ) ) { double manhattanI = v1 . doubleValue ( i ) - v2 . doubleValue ( i ) ; sqrDist += manhattanI * manhattanI ; } return FastMath . sqrt ( sqrDist ) ; }
Computes the weighted distance between the two specified vectors according to the given preference vector .