Added metric option

This patch would allow kmeans to use a different distance metric through a "metric=" option. 

I am testing/using this now for CosineDist() metric.  That seems to work, although every once/while the objective function increases in a step.