On Tue, Jul 23, 2013 at 1:05 PM, Charles R Harris
<[email protected]> wrote:
>
>
> On Tue, Jul 23, 2013 at 10:36 AM, Pauli Virtanen <[email protected]> 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
just another survey
scipy: ravel: 136 (including stats) flat: 6 flatten: 37 (not current master)
statsmodels ravel: 137, flat: 0 flatten: 9
I only use ravel (what am I supposed to do with an iterator if I want a view?)
(I think the equivalent of matlab x(:) is x.ravel("F") not flat or flatten)
Josef
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> [email protected]
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion