[f2py] results are nearly the same
fernando gamba <[email protected]>
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Hi everybody
I'm new to f2py, I have used successfully for a several fortran
functions but now i'm running on an issue.
I have fortran function that uses another auxiliar function and it
seems not so complicated
FUNCTION VNORM(P,SI,XM)
DOUBLE PRECISION TI,TJ,FO,PREC,PAS,T1,FTI,FTJ,DTI,DER,TI2
FO=2.*P-1.D0
PREC=.00000001D0
S=1
T1=1.D0
TI2=.0000001D0
TJ=0
IF(FO)1,90,2
1 S=-1
FO=S*FO
2 TJ=4.2D0
3 PAS=.5D0
GO TO 11
10 T1=T1*PAS
11 TJ=TJ*T1
FTJ=DER(TJ)
IF(DABS(FTJ-FO)-PREC)90,90,13
13 IF(FTJ-FO)18,90,10
18 TI=TJ*PAS
FTI=DER(TI)
20 TI2=TI*TI
DTI=2./DEXP(TI2)/1.7724538509
TI=TI+(FO-FTI)/DTI
FTI=DER(TI)
IF(DABS(FTI-FO)-PREC)90,90,21
21 TJ=TJ-(FTJ-FO)/(FTI-FTJ)*(TI-TJ)
FTJ=DER(TJ)
22 IF(DABS(FTJ-FO)-PREC)91,91,20
90 TO=TJ
GO TO 92
91 TO=TI
92 Z=SI/XM
A=ALOG(1.+(Z**2))
T=S*TO*1.414214
FK=(EXP(SQRT(A)*T-A/2.)-1.)/Z
VNORM=SI*FK + XM
RETURN
END
this is the function der():
FUNCTION DER(X)
DOUBLE PRECISION B1,B2,B3,B4,B5,A,DER,X,U,ZX,ZT,T,P,ARGUM
B1= 0.319381530D0
B2=-0.356563782D0
B3=1.781477937D0
B4=-1.821255978D0
B5=1.330274429D0
ARGUM=2*3.141592654
A=1.D0/DSQRT(ARGUM)
ARGUM=2.
U=X*DSQRT(ARGUM)
IF(U) 100,101,102
101 DER=0.D0
RETURN
100 U=DABS(U)
IER=1
GO TO 103
102 IER=0
103 ZX=A*DEXP(-U*U/2.D0)
T=1.D0/(1.D0+.2316419D0*U)
ZT=B1*T+B2*T*T+B3*T*T*T+B4*T*T*T*T+B5*T*T*T*T*T
P=1.D0-(ZX*ZT)
IF(IER) 107,107,108
108 P=1.D0-P
107 DER=2.D0*P-1.D0
RETURN
END
F2PY compiles all ok, but results are not the same or in an aceptable
range from the originals.
I'm pretty newby with python and F2PY and i don't know how to debug
the generated code....this is the options i use:
python c:\python25\Scripts\f2py.py -c --fcompiler=gnu95
--compiler=mingw32 -lmsvcr71 -m pearson pearson.f90
How can i debug or identify the problem
thanks a lot