dist.3col function

Transform distance matrix to 3-column matrix