Computing the nearest Euclidean distance matrix with low embedding dimensions