Help with user-defined data type
a,b = testit (256) a
I'm trying out user-defined data type for numpy, but I'm a bit stuck. Maybe
someone can spot the problem?
I'm creating a descr like this:
PyArray_Descr * d = (PyArray_Descr*)(PyObject_New (PyArray_Descr,
&PyArrayDescr_Type));
d->typeobj = typeptr;
d->kind = 'O'; // ???
d->type = 'z';
d->byteorder = '=';
d->hasobject = 0;
d->elsize = sizeof (cmplx_int_t);
d->alignment = __alignof__ (cmplx_int_t);
d->subarray = 0;
d->fields = 0;
d->names = 0;
PyArray_ArrFuncs * f = new PyArray_ArrFuncs;
PyArray_InitArrFuncs (f);
f->copyswapn = ©swapn
Are there any examples of user-defined data types that I could get hold of?
On Feb 17, 2008 3:27 PM, Neal Becker
Are there any examples of user-defined data types that I could get hold of?
I think you may be the first. The problems you encounter may well be bugs rather than problems with your code. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Robert Kern wrote:
On Feb 17, 2008 3:27 PM, Neal Becker
wrote: Are there any examples of user-defined data types that I could get hold of?
I think you may be the first. The problems you encounter may well be bugs rather than problems with your code.
There is mention in several places about 'inheritance' from existing scalar objects. What is this about? Why would I want my type to inherit from an existing type, and what does this imply about numpy handling of my type?
participants (2)
-
Neal Becker
-
Robert Kern