"In GRASS GIS there is no such function as far as I am aware, but in R there is, with the perhaps unsurprising name mahalanobis." . . . .