Solution to Creating a Distance Matrix (pdst)