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