update dist matrix generation