[f2py] Problem with inplace modification of an integer array

Chris Strickland <christophermarkstrickland-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
I am trying to modify an integer array in Fortran, which I am passing from
Python. Essentially my problem can be seen in the following code.

Fortran77 code:

c       temp.f

         subroutine tgam(gam,k)
         implicit none
         integer k, gam(k)
cf2py intent(inout) gam
cf2py intent(in) k
         gam(2)=1
         end

I am running 64 bit Ubuntu and compiling the code:
f2py -c temp.f -m temp

I am calling this code from Python 2.6.4 as follows:
import temp
from numpy import*

gamvec=array([1,0,0])
temp.tgam(gamvec)
print gamvec

I receive the following error message:
Traceback (most recent call last):
  File "testtemp.py", line 5, in <module>
    temp.tgam(gamvec)
ValueError: failed to initialize intent(inout) array -- expected elsize=4
but got 8

Any help with this problem will be greatly appreciated.
Regards,
Chris.

_______________________________________________
f2py-users mailing list
f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
http://cens.ioc.ee/mailman/listinfo/f2py-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.