private void normalizeL2 ( double [ ] scores ) { double square_sum = 0.0 ; for ( int i = 0 ; i < scores . length ; i ++ ) { square_sum += ( scores [ i ] * scores [ i ] ) ; } double norm = Math . sqrt ( square_sum ) ; if ( norm != 0 ) for ( int i = 0 ; i < scores . length ; i ++ ) { scores [ i ] = scores [ i ] / norm ; } }
Returns the L2 norm factor of this vector s values .