add two methods to Matrix,  extract a super class for KDTree, and
complete k-means