scikit-learn/scikit-learn — pull request #2506 by larsmans (2013-10-09 20:46:02+00:00)
Title: [MRG] Refactor norm computations

k-means and metrics.pairwise both had optimized code to compute row-wise (squared) norms, but k-means optimized the sparse case while metrics optimized the dense case. This PR moves the best of both to the extmath module so that dense k-means no longer copies its entire `X`. Ping @ogrisel, @mblondel, @GaelVaroquaux.

I also changed the KDE code to use the new `row_norms` function, even though it doesn't really seem to be dealing with norms, conceptually. @jakevdp, is this a good idea? Otherwise I can remove the last commit.