question: public static double coefficient ( double [ ] x , double [ ] y ) { final int xdim = x . length ; final int ydim = y . length ; if ( xdim != ydim ) { throw new IllegalArgumentException ( "Invalid arguments: arrays differ in length." ) ; } double sumXX = 0. , sumYY = 0. , sumXY = 0. ; double meanX = x [ 0 ] , meanY = y [ 0 ] ; int i = 1 ; while ( i < xdim ) { final double xv = x [ i ] , yv = y [ i ] ; final double deltaX = xv - meanX ; final double deltaY = yv - meanY ; ++ i ; meanX += deltaX / i ; meanY += deltaY / i ; final double neltaX = xv - meanX ; final double neltaY = yv - meanY ; sumXX += deltaX * neltaX ; sumYY += deltaY * neltaY ; sumXY += deltaX * neltaY ; } if ( ! ( sumXX > 0. && sumYY > 0. ) ) { return ( sumXX == sumYY ) ? 1. : 0. ; } return sumXY / Math . sqrt ( sumXX * sumYY ) ; }
target:  Compute the Pearson product-moment correlation coefficient for two FeatureVectors.