Hi,
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.
PYTHON
b=numpy.array(numpy.zeros(shape=(10,),dtype=numpy.int8),order='F')
b[0]=1
b[2]=1
b[3]=1
b
array([1, 0, 1, 1, 0, 0, 0, 0, 0, 0], dtype=int8)
FORTRAN
subroutine print_bit_array(bits,n)
use iso_fortran_env
integer,intent(in)::n
integer(kind=int8),intent(in),dimension(n)::bits
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?
thanks,
John