private static double dotProduct ( DoubleVector u , DoubleVector v ) { double dot = 0 ; for ( int i = 0 ; i < u . length ( ) ; ++ i ) { double a = u . get ( i ) ; double b = v . get ( i ) ; dot += u . get ( i ) * v . get ( i ) ; } return dot ; }
Compute the dot product between two vectors .