* * $Id$ * * $Log$ * Revision 1.1 2000/06/19 20:00:34 eugenio * Initial revision * * Revision 1.1.1.1 1994/10/08 02:21:28 zfiles * first version of qqlib in CVS * * #include "sys/CLEO_machine.h" #include "pilot.h" *CMZ : 1.03/14 03/07/91 15.23.53 by Peter C Kim *CMZ : 1.01/00 17/09/90 23.22.38 by Paul Avery *CMZ : 1.00/00 04/06/90 18.55.44 by Jorge L. Rodriguez *-- Author : SUBROUTINE EVGENH(FUNCTN,X00,X11,ANSWER) IMPLICIT DOUBLE PRECISION(A-H,K,O-Z) REAL RANP EXTERNAL RANP DOUBLE PRECISION FUNCTN EXTERNAL FUNCTN DATA EPS1/1.D-6/ DATA EPS2/1.D-4/ F(X)=SGNN*FUNCTN(X) SGNN=+1.D0 X0=DMIN1(X00,X11) X1=DMAX1(X00,X11) DIFF=1.D00 EPS=EPS1 DEL0=DABS(X1-X0)*1.D-6 DEL1=0.1*DEL0 F0=F(X0) Y0=X0 F1=F(X1) Y1=X1 IF(F0 .LE. F1)GOTO 10021 F0=-F0 F1=-F1 SGNN=-1.D0 10021 CONTINUE DEL000=F1-F0 VAL=DEL000*RANP(0)+F0 J=0 10030 M=1 GOTO 10033 10031 M=M+1 10033 IF((M).GT.(6))GOTO 10032 JJ=J 10040 DO 10041 I=1,6 AAA0=ANSWER ANSWER=0.5D0*(Y1+Y0) FM=F(ANSWER) IF(FM.EQ.VAL) GOTO 10050 IF(FM .GE. VAL)GOTO 10071 Y0=ANSWER F0=FM GOTO 10081 10071 CONTINUE Y1=ANSWER F1=FM 10081 CONTINUE 10061 CONTINUE 10041 CONTINUE 10042 CONTINUE DIFF=ANSWER-AAA0 ANSWER=0.5D0*(Y1+Y0) 10090 J=JJ+1 GOTO 10093 10091 J=J+1 10093 IF((J).GT.(7))GOTO 10092 FM=F(ANSWER) ERROLD=ERROR ERROR=DABS(VAL-FM)/DEL000 IF (ERROR.LE.EPS) GOTO 10050 IF(ERROR.GT.ERROLD.AND.J.GT.3)GOTO 10092 DELTA=DMIN1(DEL0,DABS(DIFF)) ANO=ANSWER ANN=ANO+DELTA IF(ANN .LE. X1)GOTO 10111 EPS=EPS2 DELTA=0.5*DELTA ANN=X1 FM=F(ANN-DELTA) 10111 CONTINUE FM1=(F(ANN)-FM)/DELTA IF(FM1 .NE. 0.D0)GOTO 10131 ANSWER=ANO GOTO 10092 10131 CONTINUE DIFF=(FM-VAL)/FM1 ANSWER=ANO-DIFF IF((ANSWER .GE. Y0) .AND. (ANSWER .LE. Y1))GOTO 10151 ANSWER=ANO GOTO 10092 10151 CONTINUE IF (DABS(DIFF).LT.DEL1) GOTO 10050 GOTO 10091 10092 CONTINUE GOTO 10031 10032 CONTINUE 10050 CONTINUE RETURN END