[Numpy-discussion] np.dot and 'out' bug

josef.pktd at gmail.com josef.pktd at gmail.com
Thu May 23 12:12:50 EDT 2013


On Thu, May 23, 2013 at 11:14 AM, Nathaniel Smith <njs at pobox.com> wrote:
> On Thu, May 23, 2013 at 3:57 PM, Matthieu Brucher
> <matthieu.brucher at gmail.com> wrote:
>> In my point of view, you should never use an output argument equal to an
>> input argument. It can impede a lot of optimizations.
>
> This is a fine philosophy in some cases, but a non-starter in others.
> Python doesn't have optimizations in the first place, and in-place
> operations are often critical for managing memory usage. '+=' is an
> important operator, and in numpy it's just 'np.add(a, b, out=a)' under
> the hood.

Isn't dot handled by Lapack, and whatever optimized version is available?

Josef

>
> On Thu, May 23, 2013 at 3:50 PM, Nicolas Rougier
> <Nicolas.Rougier at inria.fr> wrote:
>> Also, from a user point of view it is difficult to sort out which functions currently allow 'out=a' or  out=b' since nothing in the 'dot' documentation warned me about such problem.
>
> That's because AFAIK all functions allow out=a and out=b, except for
> those which contain bugs :-).
>
> Can you file a bug in the bug tracker so this won't get lost?
>
> -n
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion



More information about the NumPy-Discussion mailing list