[Numpy-discussion] Cython numerical syntax revisited

Sturla Molden sturla@molden...
Thu Mar 5 04:18:34 CST 2009


On 3/5/2009 8:51 AM, Dag Sverre Seljebotn wrote:

> What's your take on Blitz++? Around here when you say C++ and numerical 
> in the same sentence, Blitz++ is what they mean.

I have not looked at it for a long time (8 years or so). It is based on 
profane C++ templates that makes debugging impossible. The compiler does 
not emit meaningful diagnostic messages, and very often the compiler 
cannot tell on which line the error occurred. It was efficient for small 
arrays if loops could be completely unrolled by the template 
metaprogram. For large arrays, it produced intermediate arrays as no C++ 
compiler could do escape analysis.

> Introducing this syntax would actually mean less time to focus on "real 
> usability issues" like that. OTOH, if the syntax I propose is superior, 
> it's better to introduce it early in a long-term perspective.

There is not much difference between

    cdef int[:,:] array

and

    cdef numpy.ndarray[int, dim=2] array

except that the latter is a Python object. The only minor issue with 
that is the GIL. On the other hand, the former is not a Python object, 
which means it is not garbage collected.


S.M.


More information about the Numpy-discussion mailing list