def _compute_row_norms(data):
 norms = np.sqrt(np.sum((data ** 2), axis=1))
 norms[(norms == 0)] = 1.0
 return norms

def _compute_row_norms ( data ) : norms = np . sqrt ( np . sum ( ( data ** 2 ) , axis = 1 ) ) norms [ ( norms == 0 ) ] = 1.0 return norms
compute scaling based on estimated norm .