[Numpy-discussion] [ANN] Cython 0.15

Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Mon Aug 8 05:47:26 EDT 2011


On 08/08/2011 10:21 AM, Sebastian Haase wrote:
> On Sun, Aug 7, 2011 at 11:24 PM, Dag Sverre Seljebotn
> <d.s.seljebotn at astro.uio.no>  wrote:
>> On 08/07/2011 10:31 PM, Paul Anton Letnes wrote:
>>> Looks like you have done some great work! I've been using f2py in the past, but I always liked the idea of cython - gradually wrapping more and more code as the need arises. I read somewhere that fortran wrapping with cython was coming - dare I ask what the status on this is? Is it a goal for cython to support easy fortran wrapping at all?
>>
>> Fwrap scans Fortran sources and generate a Cython wrapper around a
>> iso_c_binding Fortran 2003 wrapper around your Fortran code. Which is a
>> bit more portable than f2py in theory, although it's pretty much the
>> same in practice currently.
>>
>> It doesn't work for all Fortran code, but I think it works for what f2py
>> does and then some more.
>>
>> The big difference is that it allows you to sidestep Python boxing of
>> arguments when calling from Cython.
>>
>> In addition to the main website (use Google) there's been quite a lot
>> more work on it my Github:
>>
>> https://github.com/dagss/fwrap
>>
>> that's not released. I'd like to continue on Fwrap but there's always
>> 2-3 items higher on the priority list. I can't tell you yet whether the
>> project will survive.
>>
>> But anyway, this is the way Fortran+Cython is supported.
>>
>> Dag Sverre
>
> Hi,
> Not to hijack this thread ....
> First, also my congratulations to making such great progress with such
> a great project !
>
> a)  Is there anything that would parse a C/C++ header file and
> generate Cython wrapper code for it ?

This come up now and again and I believe there's several 
half-baked/started solutions out there by Cython users, but nothing that 
is standard or that I know is carried out to completion.

I.e., you should ask on the cython-users list. It'd be good if somebody 
would compile a list of the efforts so far on the wiki as well...

> b) What is the status of supporting multi-type Cython functions -- ala
> C++ templates ?
> This would be one of my top ranked favorites, since I like writing
> simple algorithms (like computing certain statistics over a numpy
> array), and have this support all of e.g. unit8, int32, unit16,
> float32 and float64...   (I'm using some macro-enhanced SWIG for this
> so far)

It's been implemented as part of Mark Florisson's GSoC (he also did the 
OpenMP support!), currently waiting for review AFAIK. We take an 
approach different to C++ though.

http://wiki.cython.org/enhancements/fusedtypes

Dag Sverre



More information about the NumPy-Discussion mailing list