[Numpy-discussion] Half baked C API?

konrad.hinsen at laposte.net konrad.hinsen at laposte.net
Tue Mar 15 00:23:39 CST 2005


On 15.03.2005, at 02:50, Ralf Juengling wrote:

> I recently took a closer at Numeric's and numarray's C APIs for
> the first time and was surprised not to find the counterparts
> for all the array functions that are available in the Python API.
>
> Did I overlook anything, or do I really have to re-implement
> things like 'sum', 'argmax', 'convolve', 'cos' in C?

Can you think of a real-life situation where you would want to call  
these from C? Usually, C modules using arrays are written to add  
functionality that can not be expressed efficiently in terms of  
existing array operations. If you want to compose things like sum and  
argmax, you can do that in Python.

Note also that if you do need to call these routines from your C code,  
you can always do so via the generic Python API for calling Python  
functions. However, reimplementing them in C may often turn out to be  
simpler - doing sum() in C is really a trivial piece of work.

Konrad.
--
------------------------------------------------------------------------ 
-------
Konrad Hinsen
Laboratoire Leon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr
------------------------------------------------------------------------ 
-------





More information about the Numpy-discussion mailing list