[Numpy-discussion] product of arrays of different lengths

Simon Palmer simon.palmer@gmail....
Mon Sep 15 13:55:54 CDT 2008


Thanks very much everyone, this has been very helpful.  I have been doing
some timing of my own and the order of magnitude difference that numpy
provides wins.  I'm learning python as I go so some of my questions come
from a lack of language skillls, but it is good to get to know the numpy
dialect too.

On Mon, Sep 15, 2008 at 6:48 PM, Alan G Isaac <aisaac@american.edu> wrote:

> SimonPalmer wrote:
> > what is the overhead associated with importing a new module (whichever
> > includes izip)?
> > I am wondering whether it is actually more efficient for me to put my
> > aesthetics aside and stick with my ugly but efficient loop
>
> If you do not want to use izip, you can still avoid array
> creation by using ``dot``::
>
>     max_idx = min(len(A), len(B))
>      np.dot(A[:max_idx], B[:max_idx])
>
> Cheers,
> Alan Isaac
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080915/1d674b8f/attachment.html 


More information about the Numpy-discussion mailing list