Added computation of error distance matrix