[Numpy-discussion] Incomplete support in certain Numeric emulation functions in numarray

Francesc Alted falted at openlc.org
Wed Jan 22 01:53:01 EST 2003


Hi,

I have discovered that the Numeric emulation functions in numarray doesn't
accept a character typecode as type parameter.

This is not immediately apparent because type parameter is of type 'int',
and passing it a 'char' maybe not a good practice. But the fact is that
Numeric *do* accept the charcodes in the type parameter. 

For example, this is the normal way to call the PyArray_FromDims function:

arr = PyArray_FromDims(self.rank, self.dimensions, tFloat64)

but, in Numeric, this other manner also works:

arr = PyArray_FromDims(self.rank, self.dimensions, 'd')

Now, in numarray, if you pass a character to the type parameter, a
"segmentation fault" is issued.

Look at the end of Numeric-22.0/Src/arraytypes.c, to see how characters are
handled as types in Numeric. I think something like this should be added to
the deferred_libnumarray_init in numarray-0.4/Src/newarray.ch.

Another thing. It seems to me that NA_New and NA_Empty functions are not
well documented in the numarray documentation as they differ from the
definitions in numarray-0.4/Src/newarray.ch. I hope that the latter will
stay, because I prefer them a lot more than the documented ones :-)

Bye,

-- 
Francesc Alted




More information about the NumPy-Discussion mailing list