worked on C++ implementation of covDist