[Numpy-discussion] f2py problem with complex inout in subroutine
Sat Jul 24 07:02:50 CDT 2010
On Mon, Jul 19, 2010 at 11:49 AM, Mark Bakker <email@example.com> wrote:
> Thanks for fixing this, Pearu.
> Complex arrays with intent(inout) don't seem to work either.
> They compile, but a problem occurs when calling the routine.
> Did you fix that as well?
I guess so, see below.
> Here's an example that doesn't work (sorry, I cannot update to svn 8478 on
> my machine right now):
> subroutine test3(nlab,omega)
> implicit none
> integer, intent(in) :: nlab
> complex(kind=8), dimension(nlab), intent(inout) :: omega
> integer :: n
> do n = 1,nlab
> omega(n) = cmplx(1,1,kind=8)
> end do
> end subroutine test3
The example works fine here:
$ f2py -c -m foo test3.f90
>>> import foo
>>> from numpy import *
>>> print omega
[ 1.+1.j 1.+1.j 1.+1.j 1.+1.j]
If you cannot update numpy to required revision, you can also modify
the broken file directly. It only involves replacing four lines with
one line in numpy/f2py/cfuncs.py file.
More information about the NumPy-Discussion