[Pyrex] Numeric and Pyrex

Nitin Madnani nmadnani at wam.umd.edu
Mon Sep 19 07:42:32 CEST 2005


Hi Guys

I love Pyrex and I would like to be able to use it for the current AI  
decoder that I am working on. Here's the deal:

I need to be able to create Numeric arrays inside my pyrex function  
and be able to return that created Numeric array as the result of my  
function. I am confused about what kind of declarations I need, in  
order to be able to do that. Currently I have this :

cdef extern from "/nfshomes/nmadnani/local/include/python2.4/Numeric/ 
arrayobject.h":

     ctypedef struct PyArray_Descr:
         int type_num, elsize
         char type

     ctypedef struct PyArrayObject:
         char *data
         int nd
         int *dimensions, *strides
         object base
         PyArray_Descr *descr
         int flags

     PyObject* PyArray_FromDims(int n_dimensions, int dimensions 
[n_dimensions], int type_num)

where the PyArray_FromDims function is what's suggested by the  
documentation on the Numeric C interface. It this even correct? if  
not, I would really appreciate any help.

Thanks !
Nitin



More information about the Pyrex mailing list