# [SciPy-user] numpy and f2py

Ryan Krauss ryanlists at gmail.com
Mon Jan 30 17:45:56 CST 2006

```Is there a secret to making f2py and the new numpy play together?
Here is the begining of a fortran file that worked great with old
scipy.  I just tried installing numpy/new scipy and it no longer works
- the output is a vector of nan's

(I have not re-installed f2py since installing new scipy).

subroutine bodevect(svect,ucv,outvect,n1,n2)
Cf2py integer intent(hide),depend(svect) :: n1 = len(svect)
Cf2py integer intent(hide),depend(ucv) :: n2 = len(ucv)
Cf2py intent(in) svect, ucv
Cf2py intent(out) outvect
integer n1, n2, i
double complex svect(n1),outvect(n1), bode
double precision ucv(n2)
DO i=1,n1
outvect(i) = bode(svect(i),ucv,n1)
ENDDO
END

double complex function zcosh(z)
double complex z
zcosh = 0.5*(exp(z)+exp(-z))
RETURN
END

double complex function zsinh(z)
double complex z
zsinh = 0.5*(exp(z)-exp(-z))
RETURN
END

double complex function bode(s,ucv,n)
double complex s
double complex zsinh, zcosh
Cf2py intent(in) s, ucv
Cf2py intent(out) bode
Cf2py integer intent(hide),depend(ucv) :: n = len(ucv)
integer n
double precision ucv(n)
double precision kbase, cbase, mubeam, EIbeam, Lbeam, rl0, Ll0,
@    ml0, Il0, kj1, cj1, rl1, Ll1, ml1, Il1, Kact, tauact, kj2,
@    cj2, rl2, Ll2, ml2, Il2, kj3, cj3, rl36, Ll36, ml36, Il36,
@    gainbode1, abeam, gainbode0
double complex c1beam, c2beam, c3beam, c4beam, betabeam, a_1, a_2,
@    a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12, a_13,
@    a_14, a_15, a_16, a_17, a_18, a_19, a_20, a_21, a_22, a_23,
@    a_24, a_25, a_26, a_27, a_28, a_29, a_30, a_31, a_32, a_33,
@    a_34, a_35, a_36, a_37, a_38, a_39, a_40, a_41, a_42, a_43,
@    a_44, a_45, a_46, a_47, a_48, a_49, a_50, a_51, a_52, a_53,
@    a_54, a_55, a_56, a_57, a_58, a_59, a_60, a_61, a_62, a_63,
@    a_64, a_65, a_66, a_67, a_68, a_69, a_70, a_71, a_72, a_73,
@    a_74, a_75, a_76, a_77, a_78, a_79, a_80, a_81, a_82, a_83,
@    a_84, a_85, a_86, a_87, a_88, a_89, a_90, a_91
kbase=ucv(1)

Thanks,

Ryan

```