updated normalize_mat func to include functionality for normalizing over both rows and cols