I am finishing a C module which computes a kernel-based probability
density function estimation using a kernel-based approach for
unidimensional and multidimensional PDFs.
The idea is: Given a Numpy array expdata, with the experimental data in a
d-dimensional space (d=1,2,3), we want to make an estimation of the PDF at
grid points 'xpoints' in the same d-dimensional space using a bandwidth h:
The module is written in C, and it needs to return a Numpy array shaped
So, internally, the function which creates the array reads:
PyArrayObject *rarray; /* returned array */
/* More code follows */
I am assuming that I DO NOT have to call Py_INCREF() explicitly in my
function before returning the array to Python, because it is actually
called by PyArray_FromDims(). I would like to know whether it is actually
I am also assuming that, in case malloc() is unable to allocate memory
inside PyArray_FromDims(), it sets the corresponding exception and my only
TO-DO in my function is returning NULL to the caller.
I would appreciate replies these questions by gurus. I have Read The Funny
Manuals on extending (regular and numerical) Python, but I think these
points are not specially clear, at least, I am doubtful after reading
Thanks in advance.
Jon Saenz. | Tfno: +34 946012470
Depto. Fisica Aplicada II | Fax: +34 944648500
Facultad de Ciencias. \\ Universidad del Pais Vasco \\
Apdo. 644 \\ 48080 - Bilbao \\ SPAIN