public void unitize ( ) { for ( Datum < SparseArray > row : this ) { double sum = 0.0 ; for ( SparseArray . Entry e : row . x ) { sum += Math . sqr ( e . x ) ; } sum = Math . sqrt ( sum ) ; for ( SparseArray . Entry e : row . x ) { e . x /= sum ; } } }
Unitize each row so that L2 norm of x = 1 .