1-dimensional k-means clustering c++

@crackwitz you were right. I changed my initial vector from a vector of doubles to a vector of floats. Then I removed the memcpy function and I added the data directly in the input matrix like this:
Mat points(avg_intensities_float.size(), 1, CV_32FC1, avg_intensities_float.data());
and I changed the new centers vector to a vector of floats as well, as @berak suggested. Now the values of my centers make sense. The compactness value now is way too high (14900.9) but I guess this is irrelevant with this topic. If I get it right, the cause of the problem was using floats (32 bit float) and doubles (64 bit float) in the memcpy function. Since they capture different size in memory, the copied values were messed up. Is that correct?