Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to calculate ~1 billion distances between points with ~100 dimensions each. I think calculating these distances (or even distance squared) would be very expensive. How can I approximate the distance using a faster algorithm?

The algorithms I've found online mostly only work in two dimensions.


share|cite|improve this question
The factor of a billion will play a bigger role than the factor of a hundred in the computational cost. What do you want these measurements for? If it is ultimately to compute statistics, then you may get good enough accuracy by taking a random sample (e.g. $10^6$) of the distances. – John Bentin Nov 25 '12 at 22:11
@JohnBentin: I'm trying to run k-means clustering on a set of 100 million points, where k = 5. – badatmath Nov 25 '12 at 22:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.