add dist matrix