This optimization is limited to L_2 norms just as you say. But it really effective there!
On Wed, Jan 27, 2010 at 12:06 PM, Jake Mannix <jake.man...@gmail.com> wrote: > Of course, just calling vector.getDistanceSquared(other) allows the vector > impl to take care of these optimizations themself. Unfortunately, this > only > does SquaredEuclideanDistanceMeasure. (On the other hand, the whole > idea of optimizing via (x-y)^2 = x^2 + y^2 - 2x.y depends completely > on the distance measure being defined in terms of dot products, and > doesn't apply to the general case [Manhattan, Tanimoto, Cosine]). > -- Ted Dunning, CTO DeepDyve