Pairwise Mahalanobis Distance in R
===

I'm trying to calculate a Mahalanobis-type pairwise distance matrix in R. I have 33 individuals, each with 10 variables. The idea is to get a distance matrix D, where 

d_{i,j}=(X_{i}-(X_{j})*W^{-1}*(X_{i}-(X_{j})'

However i haven't been able build a propper code for it. I'd appreciate any help

Thank you!