matrix rescaling solved