add mahal_dist function

I found it laying around. I cleaned it up and decided to share.