Travis E. Oliphant wrote: > Neal Becker wrote: >> In arrayobject.c, various complex functions (e.g., array_imag_get) use: >> PyArray_ISCOMPLEX -> PyTypeNum_ISCOMPLEX, >> which is hard coded to 2 predefined types :( >> >> If PyArray_ISCOMPLEX allowed user-defined types, I'm guessing functions >> such as array_imag_get would just work? >> > I don't think that it true. There would need to be some kind of idea > of "complex-ness" that is tested. One way this could work is if your > corresponding scalar inherited from the generic complex scalar type and > then that was tested for. > > -Travis O.
You don't think which is true? Suppose along with registering a type, I can mark whether it is complex. Then we change PyArray_ISCOMPLEX to look at that mark for user-defined types. I believe get_part will just work. I more-or-less copied the code, and made my own functions 'get_real, get_imag', and they work just fine on my types. _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
