[Numpy-discussion] pyrex numarray

Perry Greenfield perry at stsci.edu
Thu Feb 3 09:55:47 CST 2005


On Feb 3, 2005, at 12:05 PM, Francesc Altet wrote:

> A Dimarts 01 Febrer 2005 02:16, Simon Burton va escriure:
>> Has anyone considered using pyrex to implement numarray ?
>
> None that I'm aware of. But this issue has been already discussed in
> this list at least a couple of times before. See, for example:
>
> http://sourceforge.net/mailarchive/message.php?msg_id=8080203
>
>> I don't know a lot of the details but it seems to me that pyrex could
>> unify numarray's python/c source code mixture and smooth the 
>> transition
>> from python (==untyped pyrex) code to c (==typed pyrex) code. It 
>> would also
>> help clueless users like me understand, and perhaps contribute to, the
>> codebase.
>
> Well, after the past discussions, I've got the feeling that the main
> problems to do that are:
>
> 1.- Construct general Ufuncs that can handle many different
>   combinations of arrays and types. I think that this is currently
>   done through a use of some C preprocesor than creates specific C
>   files from kind of template (correct me if I'm wrong there). Do the
>   same thing with Pyrex may potentially need such a preprocessor as
>   well.

I meant to respond this earlier but left it hanging due to other 
distractions. Francesc points out that this has been raised in the 
past, and he also correctly mentions the biggest issue. How do you 
handle all the possible numeric types? If handling all that results in 
large amounts of C or psuedo C code, what is pyrex buying you, really? 
I think there are various aspects of arrays that get confused sometime. 
One is thinking that pyrex would make it easy to code a C loop over an 
array in a fairly simple way. And it would--for a case where you have 
fixed the types of the arrays being operated on. But what about all 
possible types for arguments? That's a different story (at least I 
think so; if someone has a clever idea that solves these problems let's 
hear it).

Perry





More information about the Numpy-discussion mailing list