[Numpy-discussion] @ operator
sebastian at sipsolutions.net
Wed Sep 10 11:11:49 EDT 2014
On Di, 2014-09-09 at 13:52 -0600, Charles R Harris wrote:
> Hi All,
> I'm in the midst of implementing the '@' operator (PEP 465), and there
> are some behaviors that are unspecified by the PEP.
> 1. Should the operator accept array_like for one of the
To be in line with all the other operators, I would say yes
> 1. Does it need to handle __numpy_ufunc__, or will
> __array_priority__ serve?
> 2. Do we want PyArray_Matmul in the numpy API?
Don't care much either way, but I would say yes (why not).
> 1. Should a matmul function be supplied by the multiarray module?
We could possibly put it to the linalg module. But I think we should
provide such a function.
> If 3 and 4 are wanted, should they use the __numpy_ufunc__ machinery,
> or will __array_priority__ serve?
> Note that the type number operators, __add__ and such, currently use
> __numpy_ufunc__ in combination with __array_priority__, this in
> addition to the fact that they are by default using ufuncs that do the
> same. I'd rather that the __*__ operators simply rely on
Hmmm, that is a difficult one. For the operators I agree, numpy_ufunc
should not be necessary, since we have NotImplemented there, and the
array priority does nothing except tell numpy to stop handling all array
likes (i.e. other array-likes could actually say: you have an
array-priority > 0 -> return NotImplemented). So yeah, why do the
operators use numpy_ufunc at all? (unless due to implementation)
If we have a function numpy_ufunc would probably make sense, since that
circumvents the python dispatch mechanism.
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: This is a digitally signed message part
More information about the NumPy-Discussion