On Tue, Jul 23, 2013 at 10:36 AM, Pauli Virtanen <p...@iki.fi> wrote:

> 23.07.2013 19:22, Charles R Harris kirjoitti:
> [clip]
> > Grepping in my code, I find a lot of things like
> >
> > dfx = van.dot((ax2 - ax1).flat)
> >
> > IIRC, the flat version was faster than other methods.
>
> That goes through the same code path as
> `van.dot(np.asarray((ax2 - ax1).flat))`, which calls the `__array__`
> attribute of the flatiter object. If it's faster than .ravel(), that is
> surprising.
>
>
Well, I never use ravel, there are zero examples in my code ;) So you may
be correct.

I'm not sure the example I gave is the one where '*.flat' wins, but I
recall such a case and have just used flat a lot ever since.

Chuck
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to