[Numpy-discussion] f2py with int8
Paul Anton Letnes
Tue Apr 17 00:53:03 CDT 2012
this probably does not help with your problem. However, I would recommend changing your fortran code to:
print*,'bits = ',bits
end subroutine print_bit_array
In that way you could print shape(bits) to verify that you are getting an array of the size you are expecting. Also, you could compile with -fbounds-check (gfortran) or a similar flag for some extra debugging facilities.
To get better help with your issues, I would recommend also posting your call to the fortran routine, and the compilation command used (f2py -m myfile.f90 -flags....).
On 17. apr. 2012, at 07:32, John Mitchell wrote:
> I am using f2py to pass a numpy array of type numpy.int8 to fortran. It seems like I am misunderstanding something because I just can't make it work.
> Here is what I am doing.
> array([1, 0, 1, 1, 0, 0, 0, 0, 0, 0], dtype=int8)
> subroutine print_bit_array(bits,n)
> use iso_fortran_env
> print*,'bits = ',bits
> end subroutine print_bit_array
> RESULT when calling fortran from python
> bits = 1 0 0 0 0 0 0 0 1 0
> Any Ideas?
> NumPy-Discussion mailing list
More information about the NumPy-Discussion