[Numpy-discussion] finding close together points.
Christopher Barker
Chris.Barker@noaa....
Thu Nov 12 13:52:39 CST 2009
Robert Kern wrote:
> Didn't we already do this?
>
> http://www.mail-archive.com/numpy-discussion@scipy.org/msg21010.html
Indeed we did. What I posted then ( and have improved a bit now). Is a
Python version. Written in Python, it has an advantage of using less
memory for a big array, but is slower in other respects than a Python
list. This is probably why we all use lists for this when we need it!
What I'd like (and I have seen interest from others) is a C version, one
that could be used from C code directly as well. I can't benchmark that,
as it hasn't been written!
I'm afraid I'm out of my depth as to how to write such a thing in C (at
least so that it is well integrated into numpy). I suppose I could write
a simple C accumulating array, and only convert it into a numpy array at
the end (indeed, I have done that in the past), and benchmark that.
Charles R Harris wrote:
> I'm rapidly losing interest here.
Maybe that's why it hasn't been done yet -- it's not an interesting
enough problem!
> Why not just a class using an array that
> doubles the array size when an index is out of bounds and copies over
> the old data.
Yes, it pretty much is that simple -- that's my point. Simple and
useful, and why should we all re-invent this wheel each time (even it if
is a simple wheel)? At the C(ython) level, it's not that hard to simply
do your accumulating in regular old C, and then convert to a numpy
array, but it would be nice for it to be easier, particularly for
various data-neutral code, particularly numpy custom-defined ones.
-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@noaa.gov
More information about the NumPy-Discussion
mailing list