[Numpy-discussion] speed of numpy.ndarray comparedtoNumeric.array

EMMEL Thomas Thomas.EMMEL at 3ds.com
Mon Jan 10 04:42:10 EST 2011


> -----Original Message-----
> From: numpy-discussion-bounces at scipy.org [mailto:numpy-discussion-
> bounces at scipy.org] On Behalf Of David Cournapeau
> Sent: Montag, 10. Januar 2011 10:15
> To: Discussion of Numerical Python
> Subject: Re: [Numpy-discussion] speed of numpy.ndarray compared
> toNumeric.array
> 
> On Mon, Jan 10, 2011 at 6:04 PM, EMMEL Thomas <Thomas.EMMEL at 3ds.com>
> wrote:
> 
> >
> > Yes, of course and my real implementation uses exactly these methods,
> > but there are still issues with the arrays.
> 
> Did you try kd-trees in scipy ?
> 
> David

David,

No, I didn't, however, my method is very similar and as far as I understood
kd-trees, they need some time for pre-conditioning the search-area and this is 
the same as I did. In fact I think my method is more or less the same as a kd-tree.
The problem remains that I need to calculate the distance of some points at
a certain point in my code (when I am in a leaf of a kd-tree). 
For example when I use 100000 points I end up in a leaf of my kd-tree where I need
to calculate the distance for only 100 points or less (depends on the tree).
The problem still remains and I use cProfile to get into the details.
Most of the time it takes is in vec2Norm, everything else is very short but
I need to call it as often as I have points (again 100000) and this is why
100000*0.001s takes some time. For numpy.ndarray this is 0.002s-0.003s,
for Numeric.array 0.001-0.002s and for tuple ~0.001s (values from cProfile).

And, by the way, the same problem appears when I need to calculate the cross-product
of several vectors.
In this case I have a geometry in 3D with a surface of thousands of triangles 
and I need to calculate the normal of each of these triangles.
Again, doing a loop over tuples is faster than arrays, although in this case
numpy.cross is twice as fast as Numeric.cross_product.

Thomas


This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged.  If you are not one of the named recipients or have received this email in error, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this email and all attachments, (iii) Dassault Systemes does not accept or assume any liability or responsibility for any use of or reliance on this email.For other languages, go to http://www.3ds.com/terms/email-disclaimer.


This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged.  If you are not one of the named recipients or have received this email in error, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this email and all attachments, (iii) Dassault Systemes does not accept or assume any liability or responsibility for any use of or reliance on this email.For other languages, go to http://www.3ds.com/terms/email-disclaimer.



More information about the NumPy-Discussion mailing list