[SciPy-user] f2py (scipy_core) array argument issues

Chris Fonnesbeck fonnesbeck at gmail.com
Tue Nov 29 21:36:52 CST 2005


I have some f2py extensions that take array arguments:

      SUBROUTINE poisson(x,mu,n,like)

c Poisson log-likelihood function

cf2py integer dimension(n),intent(in) :: x
cf2py real dimension(n),intent(in) :: mu
cf2py real intent(out) :: like
cf2py integer intent(hide),depend(x) :: n=len(x)

However, when I try and pass a scipy_core array to the function, it fails:

-> 1200         return _poisson(x, mu)
        global _poisson = <fortran object at 0x33221b8>
        x = array([4, 5, 4, 0, 1, 4, 3, 4, 0, 6, 3, 3, 4, 0, 2, 6, 3,
3, 5, 4, 5, 3, 1,
       4, 4, 1, 5, 5, 3, 4, 2, 5, 2, 2, 3, 4, 2, 1, 3, 2, 2, 1, 1, 1, 1, 3,
       0, 0, 1, 0])
        mu = array([ 1.])
   1201

error: failed in converting 2nd argument `mu' of flib.poisson to C/Fortran array

Any ideas?
--
Chris Fonnesbeck
Atlanta, GA



More information about the SciPy-user mailing list