On Tue, Jul 13, 2010 at 3:04 PM, Fernando Perez <[email protected]> wrote:
> On Tue, Jul 13, 2010 at 10:02 AM, Robert Bradshaw
> <[email protected]> wrote:
>>
>> Cool, thanks for the report. I heard second hand that Cython was a
>> common topic at SciPy in Texas last week too.
>
> There is no question whatsoever that Cython is a *major* piece of the
> puzzle for scientific/numerical work in Python, and I think every
> single one of us is both grateful for the great work you guys have
> done, and rooting for you to be able to continue successfully.
>
> The discussions I had at Scipy2010 with Kurt on weave (following up on
> the conversations with Robert) were  a small example of that, as we
> all see Cython replacing the disparate set of tools we've had for
> low-level language access with a well integrated machinery via Cython
> that exposes C, C++ and Fortran in the most consistent way possible.

Thanks for mentioning it -- I've been wanting to get that moving along
and see what Robert & everyone else's thoughts are.  Fwrap is taking
all my disposable time right now, but I'll invest some time on a
mock-up soon.  I'll be able to leverage much of what's in fwrap
currently for the project, I think.

It will be possible to do something like this with fwrap at some future date:

in a regular Python file, run with the Python interpreter:

def array_func_to_speedup(array1, array2):
    # array1 & array2 are 2D numpy arrays
    # still figuring out the exact syntax, inspired by scipy.weave
    from fwrap import weave
    fsrc = '''\
    integer i,j
    do j = 1, array1_d2
        do i = 1, array1_d1
            array1(i, j) = array2(i, j)**2
        enddo
    enddo
    '''
    weave.inline(fsrc, ['array1', 'array2'], <other necessary bits>)
    assert np.all(array1 == array2**2)

The 1st-class array support in Fortran 90/95 is a really nice fit
here, I think, and the syntax is fairly natural.

It won't be too difficult to take the infrastructure in fwrap &
scipy.weave and do the above but with C code rather than Fortran 90.

But this belongs in another thread.

Kurt
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to