[f2py] fortran module crahes from time to time

Marek Wojciechowski mwojc at p.lodz.pl
Mon Nov 12 18:12:30 EET 2007


Dnia poniedziałek 12 listopad 2007, volker napisał:
> FORTRAN CODE
>
>         subroutine chsign(ar_in,ar_out,n,i)
>         integer n,i,ar_out(0:n-1)
>         real*8 ar_in(0:n-1)
> Cf2py   intent(in) ar_in
> Cf2py   intent(out) ar_out
>         do i=0,n-1
>             if ((ar_in(i).lt.0).and.(ar_in(i+1).gt.0)) then
>                 ar_out(i+1)=1
>             elseif ((ar_in(i).gt.0).and.(ar_in(i+1).lt.0)) then
>                 ar_out(i+1)=1
>             else
>                 ar_out(i+1)=0
>             endif
>         enddo
>         return
>         end

You have error in fortran code:
you declared: 
>         integer ar_out(0:n-1)
but then you write:
>         do i=0,n-1
>                 ar_out(i+1)=0
>...............................................

Normally such a crashes means you have errors in fortran code, so write 
programs carefully...

-- 
Marek Wojciechowski


More information about the f2py-users mailing list