[SciPy-dev] f2py numpy array error

Travis Oliphant oliphant.travis at ieee.org
Sun Jan 8 22:00:26 CST 2006

Christopher Fonnesbeck wrote:

> I have some f2py code that takes arrays as arguments. Unfortunately,  
> the didnt seem to survive the move to numpy:
> (Pdb) p p
> array([ 0.1,  0.1])
> (Pdb) _binomial(x, n, p)
> *** TypeError: flib.binomial() 3rd argument (p) can't be converted to  
> float
> As you can see, the third argument (p) is clearly a float, yet it  
> does not work. Here is the corresponding FORTRAN:

The third argument is not a float it is an *array* of floats. Did you 
expect an array of floats to be interpreted as a single float.  What 
value did you expect it to be interpreted as?

>       SUBROUTINE binomial(x,n,p,m,like)
> c Binomial log-likelihood function
> cf2py integer dimension(m),intent(in) :: x
> cf2py integer intent(in) :: n
> cf2py real intent(in) :: p

It looks like p should be a float, *not* an array.   I'm confused as to 
what the problem is here...


More information about the Scipy-dev mailing list