Nice!, very interesting. Myself I couldn't quite put my thoughts about this away and have spent too many hours the past days hacking on Cython source, and software architecture-wise it's been very stimulating. If my interest doesn't fade (which it better if I am to hand in my uni assignments in time...) I might have a prototype of my own ideas in a week, taking a few hours in-between now and then. The end-result should be the same thing, however my approach is very different.
While pex is probably the way forward I want to pursue my own attempt a little further because I believe a preprocessor can only do so much before it ends up either lacking wanted capabilities because of missing type knowledge etc. (adding overloaded funtion support?), or duplicating much of what Cython already has. So my approach is instead adding another layer so that it is possible to program Cython at a "higher level" and create plugins for the kinds of thing you would want to preprocess for. (I didn't look up pex yet though....I don't have webaccess now...so I might have jumped to wrong conclusions.) My approach is of course very intrusive and the chances of a high enough success for inclusion in Cython is perhaps 10 percent or so (to make something up, and I'm not familiar with Cython processes...). But if you want to have a look it would still be very interesting to discuss with somebody who have taken a different approach...the notes are on the cython wiki (look on recentlychanged for my name...it is a lot of brain dump but should give an idea.) Dag Sverre Seljebotn -----Original Message----- From: Dan Gindikin <[EMAIL PROTECTED]> Date: Thursday, Mar 6, 2008 4:26 pm Subject: Re: [Cython] Thoughts on numerical computing/NumPy support To: [email protected] Hi Dag, > >I've just finished v1 of a preprocessor for pyrex/cython, called pex, that does >(among other things) precisely what you describe for numpy ndarrays, you can >say: > >cdef matmult(ndarray<double 2d> A, ndarray<double 2d> B): > cdef int i,j,q > > cdef ndarray<double, (A.dimensions[0], B.dimensions[1])> ans > > for i from 0<=i<A.dimensions[0]: > for j from 0<=j<B.dimensions[1]: > for q from 0<=q<A.dimensions[1]: > ans{i,j}=ans{i,j}+A{i,q}*B{q,j} > > return ans > >All of the {} accesses occur at C speed. We've been talking with Robert about >moving this, and perhaps other features of pex into cython. > >-- >Dan >_______________________________________________ >Cython-dev mailing list >[email protected] >http://codespeak.net/mailman/listinfo/cython-dev > _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
