[Numpy-discussion] Cython numerical syntax revisited

Dag Sverre Seljebotn dagss at student.matnat.uio.no
Thu Mar 5 02:51:36 EST 2009


Sturla Molden wrote:
>> arr = np.zeros(..)
>> cdef int[:,:] buf = arr # 2D buffer
>>
>> Here, buf would be something else than arr; it is a seperate view to the
>> array for low-level purposes.
> 
> I like your proposal. The reason we use Fortran for numerical computing is
> that Fortran makes it easy to manipulate arrays. C or C++ sucks terribly
> for anything related to numerical computing, and arrays in particular.

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

> Cython is currently not better than C. The ndarray syntax you added last
> summer is useless if we need to pass the array or a view/slice to another
> function. That is almost always the case. While the syntax is there, the

This can be fixed with the existing syntax:

http://trac.cython.org/cython_trac/ticket/177

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.

> Fortran 90/95 does this already, which is a major reason for chosing it
> for numerical computing. If you have something like this working, I
> believe many scientists would be happy to retire Fortran. It's not that
> anyone likes it that much. Anyhow, I don't see myself retiring Fortran and
> f2py any time soon.

That's certainly an interesting perspective. Requires a lot of work 
though :-)

-- 
Dag Sverre



More information about the NumPy-Discussion mailing list