### Function Reference: `mahal`

statistics: d = mahal (y, x)

Mahalanobis’ D-square distance.

Return the Mahalanobis’ D-square distance of the points in y from the distribution implied by points x.

Specifically, it uses a Cholesky decomposition to set

      answer(i) = (y(i,:) - mean (x)) * inv (A) * (y(i,:)-mean (x))'

where A is the covariance of x.

The data x and y must have the same number of components (columns), but may have a different number of observations (rows).

Source Code: mahal