[SciPy-dev] f2py numpy array error
Christopher Fonnesbeck
chris at trichech.us
Sun Jan 8 20:45:08 CST 2006
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:
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
cf2py integer intent(hide),depend(x) :: m=len(x)
cf2py real intent(out) :: like
REAL like,p
INTEGER n,m,i
INTEGER x(m)
like = 0.0
do i=1,m
like = like + x(i)*log(p) + (n-x(i))*log(1.-p)
like = like + factln(n)-factln(x(i))-factln(n-x(i))
enddo
return
END
--
Christopher J. Fonnesbeck
Population Ecologist, Marine Mammal Section
Fish & Wildlife Research Institute (FWC)
St. Petersburg, FL
Adjunct Assistant Professor
Warnell School of Forest Resources
University of Georgia
Athens, GA
T: 727.235.5570
E: chris at trichech.us
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20060108/12d89a86/attachment.bin
More information about the Scipy-dev
mailing list