I have 2 user-defined types, and simple arithmetic working for the cases I registered with PyUFunc_RegisterLoopForType.

I'd like to use automatic conversion to do mixed arithmetic between these 2 types. I did PyArray_RegisterCastFunc, and it seems this allows explicit conversion:

a

array([(0,0), (1,0), (2,0), (3,0), (4,0), (5,0), (6,0), (7,0), (8,0), (9,0)], dtype=cmplx_int32)

b

array([(0,0), (1,0), (2,0), (3,0), (4,0), (5,0), (6,0), (7,0), (8,0), (9,0)], dtype=cmplx_int64)

array (a,dtype=b.dtype)

array([(0,0), (1,0), (2,0), (3,0), (4,0), (5,0), (6,0), (7,0), (8,0), (9,0)], dtype=cmplx_int64)

But mixed mode arithmetic gives:

a+b TypeError: function not supported for these types, and can't coerce safely to supported types

I've been trying to understand this 'coerce' without much luck. Any clues what I need to do here?