# How to compute the correlation between two distance matrices

I have $N$ samples, each described by a vector of $M$ features. I can compute the symmetric distance matrix $D_1(i, j)$ representing the pairwise distances between the samples, using a distance measure. Now let's say that I change the conditions under whch the features are extracted, producing new feature vectors and thus a different matrix $D_2(i, j)$. I am interested in understanding if the differences between samples remained more or less the same (i.e. samples that were similar before are still similar to each other).

• How can I compare $D_1$ and $D_2$? Would the canonical correlation a suitable measure?
• Is there a statistical test to assess if the difference between $D_1$ and $D_2$ is significant?