[Numpy-discussion] Preliminary thoughts on implementing __matmul__
Charles R Harris
charlesr.harris at gmail.com
Tue Aug 5 21:19:00 EDT 2014
I've been looking to implement the "@" operator from Python 3.5. Looking at
the current implementation of the dot function, it only uses a vector inner
product, which is either that defined in arraytypes.c.src or a version
using cblas defined in _dotblas for the float, cfloat, double, cdouble
types. I note that the versions defined in arraytypes.c.src include all the
numeric types plus boolean, datetime, timedelta, and object. I'm not clear
why datetime and timedelta should have dot products, except perhaps for
scalar multiplication. The boolean version has the advantage that it can
short circuit. I also note that all the operations proposed for "@" can
easily be done with einsum except for objects. So I'm wondering if one easy
way to implement the functions is to extend einsum to work with objects and
make it use blas when available.
Another thing that may be worth looking into would be some way to multiply
by the complex conjugate, as that is easy to implement at the low level.
I'd welcome any thoughts as to how that might be done.
Anyway, I'm just looking for a discussion and ideas here. Any input is
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion