[Numpy-discussion] A little help please?
Travis E. Oliphant
oliphant@enthought....
Tue Feb 26 09:13:54 CST 2008
Neal Becker wrote:
> My user-defined type project has mostly gone well, but I'm stuck on
> mixed-type arithmetic.
>
> I have 2 types: cmplx_int32 and cmplx_int64. I have added basic arithmetic
> for those types, and for mix of those arrays and their respective scalars.
> But mixed arithmetic only partly works
This is an area that needs testing and possible fixes. The relevant
code is in ufuncobject.c (select_types) and in multiarraymodule.c
(PyArray_CanCoerceScalar). If you can go through that code you may be
able to see what the problem is and let us know.
I tried to support this kind of thing you are doing, but I'm not sure
how well I succeeded because I didn't have time or the code to test it
with. Thus, there is still some work to do.
The fact that radd is not called is because ufuncs try to handle
everything (the ufunc is more general than just the functions with "r"
prefixes. I think one problem may be due to the fact that the first
argument to a ufunc is the one that defines the search for the correctly
registered function and there may be no code to allow other arguments to
direct the search should that one fail.
I'm actually pleased you've gotten this far. I'll keep trying to help
as I get time.
-Travis O.
More information about the Numpy-discussion
mailing list