Kurt Smith skrev:
> 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.
>
>   
Actually,

   fsrc = "array1 = array2**2"

would suffice :-)

That just shows why Fortran 90 is less painful than C for the work 
scientists often do.


Sturla












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

Reply via email to