The Mahalanobis distance is a measure between a sample point and
a distribution.

The Mahalanobis distance from a vector *x* to a distribution with
mean *μ* and covariance *Σ* is

This distance represents how far *x* is from the
mean in number of standard deviations.

`mahal`

returns the squared Mahalanobis distance *d*^{2} from an observation in `X`

to a mixture
component in `gm`

.