[Numpy-discussion] Add/multiply reduction confusion

Stéfan van der Walt stefan at sun.ac.za
Sun Jul 5 12:37:55 EDT 2009


Hi Andrew

2009/7/5 Andrew Friedley <afriedle at indiana.edu>:
> I figured this out in case anyone is interested.
>
> I found the check that does the type 'upcasting' in
> umath_ufunc_object.inc around line 3072 (NumPy 1.3.0).  Turns out all I
> need to do is make sure my add and multiply ufuncs are actually named
> 'add' and 'multiply' and arrays will be upcasted appropriately.
>
> Maybe this is worth documenting somewhere, maybe in the UFunc C API?  Or
> is it documented already, and I just missed it?

I'm sorry nobody came to your rescue earlier.  There aren't that many
people who are familiar with the details of the underlying numpy
implementation.

Would you please be so kind as to add your findings here:

http://docs.scipy.org/numpy/docs/numpy-docs/reference/index.rst/#reference-index

I haven't read through that document recently, so it may be in there already.

Regards
Stéfan



More information about the NumPy-Discussion mailing list