public static double [ ] normalizeEquals ( final double [ ] v1 ) { final double norm = 1. / euclideanLength ( v1 ) ; if ( norm < Double . POSITIVE_INFINITY ) { for ( int row = 0 ; row < v1 . length ; row ++ ) { v1 [ row ] *= norm ; } } return v1 ; }
Normalizes v1 to the length of 1 . 0 in place .