[Numpy-discussion] finding close together points.
David Goldsmith
d.l.goldsmith at gmail.com
Tue Nov 10 20:22:52 EST 2009
Also, is it not returning distances between points and themselves? Or am I
misinterpreting it?
DG
On Tue, Nov 10, 2009 at 5:17 PM, Christopher Barker
<Chris.Barker at noaa.gov>wrote:
> James Bergstra wrote:
> > In some cases a brute-force approach is also good.
>
> true.
>
> > If r is a matrix of shape Nx2:
> >
> > (r*r).sum(axis=1) -2 * numpy.dot(r, r.T) +
> > (r*r).sum(axis=1).reshape((r.shape[0], 1)) < thresh**2
> >
> > It's brute force, but it takes advantage of fast matrix multiplication.
>
> I'm more concerned about memory -- doesn't this use N^2 memory? Which
> could be an issue here.
>
> -Chris
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R (206) 526-6959 voice
> 7600 Sand Point Way NE (206) 526-6329 fax
> Seattle, WA 98115 (206) 526-6317 main reception
>
> Chris.Barker at noaa.gov
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20091110/85dd9db0/attachment.html>
More information about the NumPy-Discussion
mailing list