[Numpy-discussion] Changes to generalized ufunc core dimension checking

Travis Oliphant travis at continuum.io
Wed Mar 16 12:52:08 EDT 2016


Hi everyone,

Can you help me understand why the stricter changes to generalized ufunc
argument checking no now longer allows scalars to be interpreted as 1-d
arrays in the core-dimensions?

Is there a way to specify in the core-signature that scalars should be
allowed and interpreted in those cases as an array with all the elements
the same?   This seems like an important feature.

Here's an example:

myfunc with core-signature (t),(k),(k) -> (t)

called with myfunc(arr1, arr2, scalar2).

This used to work in 1.9 and before and scalar2 was interpreted as a 1-d
array the same size as arr2.   It no longer works with 1.10.0 but I don't
see why that is an improvement.

Thoughts?   Is there a work-around that doesn't involve creating a 1-d
array the same size as arr2 and filling it with scalar2?

Thanks.

-Travis



-- 

*Travis Oliphant, PhD*
*Co-founder and CEO*


@teoliphant
512-222-5440
http://www.continuum.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160316/22624f27/attachment.html>


More information about the NumPy-Discussion mailing list