[f2py] problems with array

Al Niessner <[email protected]> Wed, 11 Aug 2010 10:56:09 -0700
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
I have a function that returns an array but it crashes when I call the
function.

f2py -c kinds.f90 mathsub.f90 -m mathsub

n [1]: import mathsub

In [2]: i = mathsub.math_mod.eye(3)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call
last)

/home/niessner/Scratch/Example/<ipython console> in <module>()

ValueError: failed to create intent(cache|hide)|optional array-- must
have defined dimensions but got (-1,-1,)

-- 
Al Niessner
818.354.0859

--------
|  dS  | >= 0
--------

_______________________________________________
f2py-users mailing list
f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
http://cens.ioc.ee/mailman/listinfo/f2py-users
kinds.f90 (text/x-fortran, 174 B)
MODULE Kinds
   INTEGER, PARAMETER :: dp  = KIND( 1.0d0 )  ! Double precision, real
   INTEGER, PARAMETER :: pr  = dp             ! Default precision, real
END MODULE Kinds
mathsub.f90 (text/x-fortran, 462 B)
    MODULE math_mod
      USE Kinds

      IMPLICIT NONE

      CONTAINS

        REAL(8) FUNCTION Eye(N)

          IMPLICIT NONE
          INTEGER, INTENT(IN) :: N
          DIMENSION           :: Eye(ABS(N),ABS(N))

          INTEGER :: i
          ! - - - - - - - - - - - - - - - - - - - - - - - - -

            Eye = 0e0_pr
            DO i=1,ABS(N)
              Eye(i,i) = 1e0_pr
            END DO

        END FUNCTION Eye

       END MODULE math_mod