genbattle / dkm

A generic C++11 k-means clustering implementation
MIT License
209 stars 47 forks source link

Avoid asking for a discrete_distribution when all weights are zero #22

Open hedtke opened 3 years ago

hedtke commented 3 years ago

I have the case that I sometimes ask for k-means when all input points are identical. Then all distances are zero and thus std::discrete_distribution is called with weight vector containing only zeros. On my platform, that results in a floating-point exception.

This could probably also fix

hedtke commented 3 years ago

this could probably also resolve issue #20, but I do not have access to VS to check that