Re: [Numpy-discussion] record arrays initialization

2012-05-03 Thread Keith Goodman
On Wed, May 2, 2012 at 4:46 PM, Kevin Jacobs jac...@bioinformed.com bioinfor...@gmail.com wrote: The cKDTree implementation is more than 4 times faster than the brute-force approach: T = scipy.spatial.cKDTree(targets) In [11]: %timeit foo1(element, targets)   # Brute force 1000 loops, best

Re: [Numpy-discussion] record arrays initialization

2012-05-03 Thread Moroney, Catherine M (388D)
-- Message: 6 Date: Thu, 3 May 2012 10:00:11 -0700 From: Keith Goodman kwgood...@gmail.com Subject: Re: [Numpy-discussion] record arrays initialization To: Discussion of Numerical Python numpy-discussion@scipy.org Message-ID: cab6y536wpl

[Numpy-discussion] record arrays initialization

2012-05-02 Thread Moroney, Catherine M (388D)
Thanks to Perry for some very useful off-list conversation. I realize that I wasn't being clear at all in my earlier description of the problem so here it is in a nutshell: Find the best match in an array t(5000, 7) for a single vector e(7). Now scale it up so e is (128, 512, 7) and I want to

Re: [Numpy-discussion] record arrays initialization

2012-05-02 Thread Stéfan van der Walt
On Wed, May 2, 2012 at 2:45 PM, Moroney, Catherine M (388D) catherine.m.moro...@jpl.nasa.gov wrote: Find the best match in an array t(5000, 7) for a single vector e(7).  Now scale it up so e is (128, 512, 7) and I want to return a (128, 512) array of the t-identifiers that are the best

Re: [Numpy-discussion] record arrays initialization

2012-05-02 Thread Kevin Jacobs jac...@bioinformed.com
On Wed, May 2, 2012 at 5:45 PM, Moroney, Catherine M (388D) catherine.m.moro...@jpl.nasa.gov wrote: Thanks to Perry for some very useful off-list conversation. I realize that I wasn't being clear at all in my earlier description of the problem so here it is in a nutshell: Find the best

Re: [Numpy-discussion] record arrays initialization

2012-05-02 Thread Aronne Merrelli
On Wed, May 2, 2012 at 5:27 PM, Kevin Jacobs jac...@bioinformed.com bioinfor...@gmail.com wrote: On Wed, May 2, 2012 at 5:45 PM, Moroney, Catherine M (388D) catherine.m.moro...@jpl.nasa.gov wrote: Thanks to Perry for some very useful off-list conversation.   I realize that I wasn't being

[Numpy-discussion] record arrays initialization

2012-05-02 Thread Moroney, Catherine M (388D)
On May 2, 2012, at 3:23 PM, numpy-discussion-requ...@scipy.org wrote: A) ?How do I most efficiently construct a record array from a single array? I want to do the following, but it segfaults on me when i try to print b. vtype = [(x, numpy.ndarray)] a = numpy.arange(0, 16).reshape(4,4) b

Re: [Numpy-discussion] record arrays initialization

2012-05-02 Thread Kevin Jacobs jac...@bioinformed.com
On Wed, May 2, 2012 at 7:25 PM, Aronne Merrelli aronne.merre...@gmail.comwrote: In general this is a good suggestion - I was going to mention it earlier - but I think for this particular problem it is not better than the brute force and argmin() NumPy approach. On my laptop, the KDTree query

Re: [Numpy-discussion] record arrays initialization

2012-05-02 Thread Stéfan van der Walt
On Wed, May 2, 2012 at 4:26 PM, Moroney, Catherine M (388D) catherine.m.moro...@jpl.nasa.gov wrote: Using structured arrays is making my code complex when I try to call the vectorized function.  If I stick to the original record arrays, what's the best way of initializing b from a without doing

Re: [Numpy-discussion] record arrays initialization

2012-05-02 Thread Stéfan van der Walt
On Wed, May 2, 2012 at 4:46 PM, Kevin Jacobs jac...@bioinformed.com bioinfor...@gmail.com wrote: A FLANN implementation should be even faster--perhaps by as much as another factor of two. I guess it depends on whether you care about the Approximate in Fast Library for Approximate Nearest

Re: [Numpy-discussion] record arrays initialization

2012-05-02 Thread Benjamin Root
On Wednesday, May 2, 2012, Stéfan van der Walt wrote: On Wed, May 2, 2012 at 4:46 PM, Kevin Jacobs jac...@bioinformed.comjavascript:; bioinfor...@gmail.com javascript:; wrote: A FLANN implementation should be even faster--perhaps by as much as another factor of two. I guess it

Re: [Numpy-discussion] record arrays initialization

2012-05-02 Thread Aronne Merrelli
On Wed, May 2, 2012 at 6:46 PM, Kevin Jacobs jac...@bioinformed.com bioinfor...@gmail.com wrote: On Wed, May 2, 2012 at 7:25 PM, Aronne Merrelli aronne.merre...@gmail.com wrote: In general this is a good suggestion - I was going to mention it earlier - but I think for this particular problem