removed copy of loss matrix for shift because we can overwrite loss matrix