Solution to set rows and cols to zero in a matrix