* SUBROUTINE TIUB26 ALL SYSTEMS 16/12/01 C PORTABILITY : ALL SYSTEMS C 16/12/01 LU : ORIGINAL VERSION * * PURPOSE : * INITIAL VALUES OF THE VARIABLES AND STRUCTURE OF THE SPARSE HESSIAN * MATRIX FOR UNCONSTRAINED MINIMIZATION. * * PARAMETERS : * II N NUMAER OF VARIABLES. * II NA NUMAER OF ELEMENTS OF THE SPARSE MATRIX. * II MA NUMAER OF ELEMENTS OF THE SPARSE JACOBIAN MATRIX. * RO X(N) VECTOR OF VARIABLES. * IO IA(N+1) POINTERS OF THE DIAGONAL ELEMENTS OF THE HESSIAN MATRIX. * IO JA(M) INDICES OF THE NONZERO ELEMENTS OF THE HESSIAN MATRIX IN * THE PACKED ROW. * II NEXT NUMBER OF THE TEST PROBLEM. * IO IERR ERROR INDICATOR. * SUBROUTINE TIUB26(N,NA,MA,X,IA,JA,FMIN,XMAX,NEXT,IERR) INTEGER N,NA,MA,NEXT,IEXT,IERR INTEGER IA(NA+1),JA(*) REAL*8 X(N),FMIN,XMAX INTEGER I,J,K,L,M,I1,I2,II,J1,J2,JJ,KA,KK,LL,MM,N1,ND REAL*8 T,S,PAR REAL*8 Y(20) COMMON /EMPR15/ Y COMMON /EMPR18/ PAR,M REAL*8 ETA9 PARAMETER (ETA9=1.0D 60) FMIN=0.0D 0 XMAX=1.0D 3 IEXT=0 IERR=0 GOTO(10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160, & 170,180,190,200,210,220, & 230,240,250,260,270,280,290,310,340,360, & 370,380,390,400,410,420,430,440,450,460,470,480,490,500,520, & 510,540,550,560,570,590,600,610,620,630,640,650,660), & NEXT 10 IF (N.LT.2) GO TO 999 N=N-MOD(N,2) DO 11 I=1,N IF(MOD(I,2).EQ.1) THEN X(I)=-1.2D 0 ELSE X(I)=1.0D 0 ENDIF 11 CONTINUE DO 12 I=1,N-1 L=3*(I-1)+1 JA(L)=I JA(L+1)=I+1 JA(L+2)=I K=2*(I-1)+1 IA(K)=L IA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+7)=I+2 K=5*(I-2)/2+1 IA(K)=L IA(K+1)=L+2 IA(K+2)=L+4 IA(K+3)=L+6 IA(K+4)=L+7 42 CONTINUE IA(K+5)=L+8 NA=K+4 MA=L+7 XMAX=1.0D 1 RETURN 50 IF (N.LT.3) GO TO 999 DO 51 I=1,N X(I)=-1.0D 0 51 CONTINUE JA(1)=1 JA(2)=2 IA(1)=1 DO 52 I=2,N-1 K=3*(I-2)+3 JA(K)=I-1 JA(K+1)=I JA(K+2)=I+1 IA(I)=K 52 CONTINUE JA(K+3)=N-1 JA(K+4)=N IA(N)=K+3 IA(N+1)=IA(N)+2 NA=N MA=3*N-2 RETURN 60 IF (N.LT.6) GO TO 999 DO 61 I=1,N X(I)=-1.0D 0 61 CONTINUE L=1 DO 62 I=1,5 IA(I)=L DO 63 K=1,I+1 JA(L)=K L=L+1 63 CONTINUE 62 CONTINUE DO 64 I=6,N-1 IA(I)=L DO 65 K=I-5,I+1 JA(L)=K L=L+1 65 CONTINUE 64 CONTINUE IA(N)=L DO 66 K=N-5,N JA(L)=K L=L+1 66 CONTINUE IA(N+1)=L NA=N MA=L-1 RETURN 70 IF (N.LT.2) GO TO 999 DO 71 I=1,N-1 X(I)=0.5D 0 K=4*(I-1)+1 JA(K)=I JA(K+1)=I+1 JA(K+2)=I JA(K+3)=I+1 L=2*(I-1)+1 IA(L)=K IA(L+1)=K+2 71 CONTINUE X(N)=-2.0D 0 IA(L+2)=IA(L+1)+2 NA=2*(N-1) MA=2*NA RETURN 80 IF (N.LT.4) GO TO 999 N=N-MOD(N,4) DO 81 I=1,N X(I)=SIN(DBLE(I))**2 81 CONTINUE MM=5*N K=1 DO 82 KA=1,MM I=MOD(KA,N/2)+1 J=I+N/2 K=2*(KA-1)+1 JA(K)=I JA(K+1)=J IA(KA)=K 82 CONTINUE IA(MM+1)=K+2 NA=MM MA=2*MM RETURN 90 IF (N.LT.4) GO TO 999 N=N-MOD(N,2) DO 91 I=1,N X(I)=5.0D 0 91 CONTINUE DO 93 I=2,N-2,2 L=12*(I-2)+1 DO 92 J=1,6 K=(J-1)*4 JA(L+K)=I-1 JA(L+K+1)=I JA(L+K+2)=I+1 JA(L+K+3)=I+2 92 CONTINUE K=3*(I-2)+1 IA(K)=L IA(K+1)=L+4 IA(K+2)=L+8 IA(K+3)=L+12 IA(K+4)=L+16 IA(K+5)=L+20 93 CONTINUE IA(K+6)=L+24 NA=K+5 MA=L+23 RETURN 100 IF (N.LT.2) GO TO 999 DO 101 I=1,N X(I)=0.2D 0 101 CONTINUE MM=2*N-2 JA(1)=1 JA(2)=2 JA(3)=1 JA(4)=2 IA(1)=1 IA(2)=3 K=5 L=3 DO 102 KA=3,MM,2 I=(KA+1)/2-1 JA(K)=I JA(K+1)=I+1 JA(K+2)=I+2 JA(K+3)=I+1 JA(K+4)=I+2 IA(L)=K IA(L+1)=K+3 K=K+5 L=L+2 102 CONTINUE JA(K)=N-1 JA(K+1)=N IA(L)=K IA(L+1)=K+2 NA=L MA=K+1 RETURN 110 CONTINUE IF (N.LT.2) GO TO 999 N=N-MOD(N,2) DO 111 I=1,N IF(MOD(I,2).EQ.1) THEN X(I)=-0.8D 0 ELSE X(I)=-0.8D 0 ENDIF 111 CONTINUE IA(1)=1 NA=2*(N-1) MA=1 L=1 DO 112 K=1,N-1 JA(MA)=K MA=MA+1 JA(MA)=K+1 MA=MA+1 L=L+1 IA(L)=MA JA(MA)=K MA=MA+1 L=L+1 IA(L)=MA 112 CONTINUE MA=IA(NA+1)-1 RETURN 120 CONTINUE IF (N.LT.5) GO TO 999 IF (MOD(N-5,3).NE.0) N=N-MOD(N-5,3) DO 121 I=1,N X(I)=-1.0D 0 121 CONTINUE IA(1)=1 KK=(N-5)/3+1 NA=6*KK MA=1 L=1 DO 122 K=1,KK I=3*(K-1)+1 JA(MA)=I MA=MA+1 JA(MA)=I+1 MA=MA+1 L=L+1 IA(L)=MA JA(MA)=I+2 MA=MA+1 L=L+1 IA(L)=MA JA(MA)=I+3 MA=MA+1 L=L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)=1 142 IF (MOD(N-II,LL).NE.0) N=N-MOD(N-II,LL) KK=(N-II)/LL+1 NA=JJ*KK MA=1 L=1 DO 145 K=1,KK MM=(K-1)*LL DO 144 J=1,JJ DO 143 I=1,II JA(MA)=MM+I MA=MA+1 143 CONTINUE L=L+1 IA(L)=MA 144 CONTINUE 145 CONTINUE MA=IA(NA+1)-1 RETURN 150 CONTINUE IF (N.LT.4) GO TO 999 DO 151 I=1,N IF (MOD(I,4).EQ.1) THEN X(I)=-0.8D 0 ELSE IF (MOD(I,4).EQ.2) THEN X(I)= 1.2D 0 ELSE IF (MOD(I,4).EQ.3) THEN X(I)=-1.2D 0 ELSE X(I)= 0.8D 0 ENDIF 151 CONTINUE Y(1)=35.8D 0 Y(2)=11.2D 0 Y(3)=6.2D 0 Y(4)=4.4D 0 II=4 JJ=4 LL=2 IA(1)=1 GO TO 142 160 CONTINUE IF (N.LT.4) GO TO 999 DO 161 I=1,N IF (MOD(I,4).EQ.1) THEN X(I)=-0.8D 0 ELSE IF (MOD(I,4).EQ.2) THEN X(I)= 1.2D 0 ELSE IF (MOD(I,4).EQ.3) THEN X(I)=-1.2D 0 ELSE X(I)= 0.8D 0 ENDIF 161 CONTINUE Y(1)=30.6D 0 Y(2)=72.2D 0 Y(3)=124.4D 0 Y(4)=187.4D 0 II=4 JJ=4 LL=2 IA(1)=1 GO TO 142 170 IF (N.LT.4) GO TO 999 N=N-MOD(N,2) NA=N MA=0 IA(1)=1 DO 171 I=1,N IF (MOD(I,8).EQ.1) X(I)=1.0D-1 IF (MOD(I,8).EQ.2.OR.MOD(I,8).EQ.0) X(I)=2.0D-1 IF (MOD(I,8).EQ.3.OR.MOD(I,8).EQ.7) X(I)=3.0D-1 IF (MOD(I,8).EQ.4.OR.MOD(I,8).EQ.6) X(I)=4.0D-1 IF (MOD(I,8).EQ.5) X(I)=5.0D-1 IF (I.GT.2) THEN MA=MA+1 JA(MA)=I-2 ENDIF MA=MA+2 IF (MOD(I,2).EQ.1) THEN JA(MA-1)=I JA(MA)=I+1 ELSE JA(MA-1)=I-1 JA(MA)=I ENDIF IF (I.LT.N-1) THEN MA=MA+1 JA(MA)=I+2 ENDIF IA(I+1)=MA+1 171 CONTINUE RETURN 180 IF (N.LT.3) GO TO 999 NA=N MA=0 IA(1)=1 DO 181 I=1,N X(I)=1.2D 1 IF(I.GT.1) THEN MA=MA+1 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IF(I.LT.N) THEN MA=MA+1 JA(MA)=I+1 ENDIF IA(I+1)=MA+1 181 CONTINUE RETURN 190 IF (N.LT.7) GO TO 999 NA=N MA=0 IA(1)=1 DO 191 I=1,N X(I)=-1.0D 0 IF (I.GT.1.AND.I.LT.N-3) THEN MA=MA+1 JA(MA)=I-1 ENDIF IF (I.LT.N-4) THEN MA=MA+1 JA(MA)=I ENDIF IF (I.LT.N-5) THEN MA=MA+1 JA(MA)=I+1 ENDIF MA=MA+5 JA(MA-4)=N-4 JA(MA-3)=N-3 JA(MA-2)=N-2 JA(MA-1)=N-1 JA(MA)=N IA(I+1)=MA+1 191 CONTINUE RETURN 200 IF (N.LT.3) GO TO 999 NA=N MA=0 IA(1)=1 DO 201 I=1,N X(I)=DBLE(I)/DBLE(N+1) X(I)=X(I)*(X(I)-1.0D 0) IF(I.GT.1) THEN MA=MA+1 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IF (I.LT.N) THEN MA=MA+1 JA(MA)=I+1 ENDIF IA(I+1)=MA+1 201 CONTINUE RETURN 210 CONTINUE IF (N.LT.5) GO TO 999 IF (MOD(N-5,3).NE.0) N=N-MOD(N-5,3) DO 211 I=1,N X(I)=-1.0D 0 211 CONTINUE IA(1)=1 KK=(N-5)/3+1 NA=7*KK MA=1 L=1 DO 212 K=1,KK I=3*(K-1)+1 JA(MA)=I MA=MA+1 JA(MA)=I+1 MA=MA+1 L=L+1 IA(L)=MA JA(MA)=I+1 MA=MA+1 JA(MA)=I+2 MA=MA+1 L=L+1 IA(L)=MA JA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 ENDIF IA(I+1)=MA+1 231 CONTINUE RETURN 240 IF (N.LT.5) GO TO 999 N=N-MOD(N,5) NA=N MA=0 IA(1)=1 DO 241 I=1,N X(I)=1.0D 0/DBLE(N) J=(I-1)/5*5 MA=MA+5 JA(MA-4)=J+1 JA(MA-3)=J+2 JA(MA-2)=J+3 JA(MA-1)=J+4 JA(MA)=J+5 IA(I+1)=MA+1 241 CONTINUE RETURN 250 IF (N.LT.3) GO TO 999 DO 251 I=1,N X(I)=0.0D 0 251 CONTINUE 252 NA=N MA=0 IA(1)=1 DO 253 I=1,N IF(I.GT.1) THEN MA=MA+1 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IF(I.LT.N) THEN MA=MA+1 JA(MA)=I+1 ENDIF IA(I+1)=MA+1 253 CONTINUE RETURN 260 IF (N.LT.3) GO TO 999 IF (MOD(N,2).NE.1) N=N-1 NA=N MA=0 IA(1)=1 DO 261 I=1,N X(I)=1.0D 0 IF (MOD(I,2).EQ.1) THEN IF(I.GT.1) THEN MA=MA+2 JA(MA-1)=I-2 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IF(I.LT.N) THEN MA=MA+2 JA(MA-1)=I+1 JA(MA)=I+2 ENDIF ELSE MA=MA+3 JA(MA-2)=I-1 JA(MA-1)=I JA(MA)=I+1 ENDIF IA(I+1)=MA+1 261 CONTINUE RETURN 270 IF (N.LT.3) GO TO 999 DO 271 I=1,N X(I)=-1.0D 0 271 CONTINUE GO TO 252 280 IF (N.LT.5) GO TO 999 NA=N MA=0 IA(1)=1 DO 281 I=1,N X(I)=-2.0D 0 IF(I.GT.2) THEN MA=MA+1 JA(MA)=I-2 ENDIF IF(I.GT.1) THEN MA=MA+1 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IF(I.LT.N) THEN MA=MA+1 JA(MA)=I+1 ENDIF IF(I.LT.N-1) THEN MA=MA+1 JA(MA)=I+2 ENDIF IA(I+1)=MA+1 281 CONTINUE RETURN 290 IF (N.LT.7) GO TO 999 NA=N MA=0 IA(1)=1 DO 291 I=1,N X(I)=-3.0D 0 IF(I.GT.3) THEN MA=MA+1 JA(MA)=I-3 ENDIF IF(I.GT.2) THEN MA=MA+1 JA(MA)=I-2 ENDIF IF(I.GT.1) THEN MA=MA+1 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IF(I.LT.N) THEN MA=MA+1 JA(MA)=I+1 ENDIF IF(I.LT.N-1) THEN MA=MA+1 JA(MA)=I+2 ENDIF IF(I.LT.N-2) THEN MA=MA+1 JA(MA)=I+3 ENDIF IA(I+1)=MA+1 291 CONTINUE XMAX=1.0D 1 RETURN 310 IF (N.LT.2) GO TO 999 N=N-MOD(N,2) NA=N MA=0 IA(1)=1 DO 311 I=1,N IF(MOD(I,2).EQ.1) THEN X(I)=9.0D 1 MA=MA+2 JA(MA-1)=I JA(MA)=I+1 ELSE X(I)=6.0D 1 MA=MA+2 JA(MA-1)=I-1 JA(MA)=I ENDIF IA(I+1)=MA+1 311 CONTINUE RETURN 340 IF (N.LT.3) GO TO 999 DO 341 I=1,N X(I)=-1.0D 0 341 CONTINUE GO TO 252 360 IF (N.LT.2) GO TO 999 N=N-MOD(N,2) NA=N DO 361 I=1,N IF (MOD(I,2).EQ.1) THEN X(I)=0.0D 0 ELSE X(I)=1.0D 0 ENDIF 361 CONTINUE MA=1 DO 363 I=1,N-1,2 IA(I)=2*I-1 IA(I+1)=2*I+1 DO 362 J=1,2 JA(MA)=I MA=MA+1 JA(MA)=I+1 MA=MA+1 362 CONTINUE 363 CONTINUE IA(N+1)=MA MA=MA-1 RETURN 370 IF (N.LT.4) GO TO 999 N=N-MOD(N,4) NA=N IA(1)=1 J=0 DO 371 I=2,N,2 X(I-1)=-3.0D 0 X(I)=-1.0D 0 IA(I)=IA(I-1)+2 IA(I+1)=IA(I)+3 MA=IA(I-1)+4 JA(MA-4)=I-1 JA(MA-3)=I IF (J.EQ.0) THEN JA(MA-2)=I-1 JA(MA-1)=I JA(MA)=I+2 J=1 ELSE JA(MA-2)=I-2 JA(MA-1)=I-1 JA(MA)=I J=0 ENDIF 371 CONTINUE RETURN 380 IF (N.LT.3) GO TO 999 DO 381 I=1,N X(I)=1.5D 0 381 CONTINUE XMAX=1.0D 0 GO TO 252 390 IF (N.LT.3) GO TO 999 DO 391 I=1,N X(I)=DBLE(I)/DBLE(N+1) X(I)=X(I)*(X(I)-1.0D 0) 391 CONTINUE GO TO 252 400 IF (N.LT.3) GO TO 999 DO 401 I=1,N X(I)=1.0D 1 401 CONTINUE GO TO 252 410 IF (N.LT.3) GO TO 999 DO 411 I=1,N X(I)=1.0D 0 411 CONTINUE PAR=1.0D 1 GO TO 252 420 IF (N.LT.5) GO TO 999 PAR=5.0D 2/DBLE(N+2) NA=N MA=0 IA(1)=1 DO 421 I=1,N X(I)=((DBLE(I)+0.5D 0)/DBLE(N+2)-0.5D 0)**2 IF (I.GT.2) THEN MA=MA+1 JA(MA)=I-2 ENDIF IF (I.GT.1) THEN MA=MA+1 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IF (I.LT.N) THEN MA=MA+1 JA(MA)=I+1 ENDIF IF (I.LT.N-1) THEN MA=MA+1 JA(MA)=I+2 ENDIF IA(I+1)=MA+1 421 CONTINUE RETURN 430 IF (N.LT.10) GO TO 999 N=N-MOD(N,2) M=N/2 PAR=5.0D 2 NA=N MA=0 IA(1)=1 DO 431 I=1,M K=I+M X(I)=(DBLE(I)/DBLE(M+1)-0.5D 0)**2 IF (I.GT.2) THEN MA=MA+1 JA(MA)=I-2 ENDIF IF (I.GT.1) THEN MA=MA+1 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IF (I.LT.M) THEN MA=MA+1 JA(MA)=I+1 ENDIF IF (I.LT.M-1) THEN MA=MA+1 JA(MA)=I+2 ENDIF IF(I.GT.1) THEN MA=MA+1 JA(MA)=K-1 ENDIF MA=MA+1 JA(MA)=K IF(I.LT.M) THEN MA=MA+1 JA(MA)=K+1 ENDIF IA(I+1)=MA+1 431 CONTINUE DO 432 I=M+1,N K=I-M X(I)=DBLE(K)/DBLE(M+1)-0.5D 0 IF (K.GT.1) THEN MA=MA+1 JA(MA)=K-1 ENDIF MA=MA+1 JA(MA)=K IF (K.LT.M) THEN MA=MA+1 JA(MA)=K+1 ENDIF IF(K.GT.1) THEN MA=MA+1 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IF(K.LT.M) THEN MA=MA+1 JA(MA)=I+1 ENDIF IA(I+1)=MA+1 432 CONTINUE RETURN 440 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=6.7D 0/DBLE(M+1)**2 N=M*M K=0 DO 442 J=1,M DO 441 I=1,M K=K+1 X(K)=0.0D 0 441 CONTINUE 442 CONTINUE GO TO 463 450 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=1.0D 0/DBLE(M+1)**2 N=M*M K=0 DO 452 J=1,M DO 451 I=1,M K=K+1 X(K)=-1.0D 0 451 CONTINUE 452 CONTINUE GO TO 463 460 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=1.0D 0/DBLE(M+1)**2 N=M*M K=0 DO 462 J=1,M DO 461 I=1,M K=K+1 X(K)=0.0D 0 461 CONTINUE 462 CONTINUE 463 NA=N MA=0 IA(1)=1 K=0 DO 465 J=1,M DO 464 I=1,M K=K+1 IF (J.GT.1) THEN MA=MA+1 JA(MA)=K-M ENDIF IF (I.GT.1) THEN MA=MA+1 JA(MA)=K-1 ENDIF MA=MA+1 JA(MA)=K IF (I.LT.M) THEN MA=MA+1 JA(MA)=K+1 ENDIF IF (J.LT.M) THEN MA=MA+1 JA(MA)=K+M ENDIF IA(K+1)=MA+1 464 CONTINUE 465 CONTINUE RETURN 470 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=5.0D 1/DBLE(M+1) N=M*M K=0 DO 472 J=1,M DO 471 I=1,M K=K+1 X(K)=1.0D 0-DBLE(I)*DBLE(J)/DBLE(M+1)**2 471 CONTINUE 472 CONTINUE GO TO 463 480 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=1.0D 0/DBLE(M+1) N=M*M K=0 DO 482 J=1,M DO 481 I=1,M K=K+1 X(K)=0.0D 0 481 CONTINUE 482 CONTINUE GO TO 463 490 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) N=M*M PAR=500.0D 0/DBLE(M+2)**4 K=0 DO 492 J=1,M DO 491 I=1,M K=K+1 X(K)=0.0D 0 491 CONTINUE 492 CONTINUE GO TO 503 500 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) N=M*M PAR=500.0D 0 K=0 DO 502 J=1,M DO 501 I=1,M K=K+1 X(K)=0.0D 0 501 CONTINUE 502 CONTINUE 503 NA=N MA=0 IA(1)=1 K=0 DO 505 J=1,M DO 504 I=1,M K=K+1 IF (J.GT.2) THEN MA=MA+1 JA(MA)=K-M-M ENDIF IF (J.GT.1) THEN IF (I.GT.1) THEN MA=MA+1 JA(MA)=K-M-1 ENDIF MA=MA+1 JA(MA)=K-M IF (I.LT.M) THEN MA=MA+1 JA(MA)=K-M+1 ENDIF ENDIF IF (I.GT.1) THEN IF (I.GT.2) THEN MA=MA+1 JA(MA)=K-2 ENDIF MA=MA+1 JA(MA)=K-1 ENDIF MA=MA+1 JA(MA)=K IF (I.LT.M) THEN MA=MA+1 JA(MA)=K+1 IF (I.LT.M-1) THEN MA=MA+1 JA(MA)=K+2 ENDIF ENDIF IF (J.LT.M) THEN IF (I.GT.1) THEN MA=MA+1 JA(MA)=K+M-1 ENDIF MA=MA+1 JA(MA)=K+M IF (I.LT.M) THEN MA=MA+1 JA(MA)=K+M+1 ENDIF ENDIF IF (J.LT.M-1) THEN MA=MA+1 JA(MA)=K+M+M ENDIF IA(K+1)=MA+1 504 CONTINUE 505 CONTINUE RETURN 520 IF (N.LT.3) GO TO 999 DO 521 I=1,N X(I)=5.0D 0*MIN(DBLE(I)/DBLE(N+1),1.0D 0-DBLE(I)/DBLE(N+1)) 521 CONTINUE GO TO 252 510 IF (N.LT.3) GO TO 999 DO 511 I=1,N X(I)=5.0D 0*MIN(DBLE(I)/DBLE(N+1),1.0D 0-DBLE(I)/DBLE(N+1)) 511 CONTINUE XMAX=1.0D 4 GO TO 252 540 IF (N.LT.3) GO TO 999 DO 541 I=1,N X(I)=2.0D 0 541 CONTINUE NA=N MA=0 IA(1)=1 DO 542 I=1,N IF (I.EQ.N) THEN MA=MA+1 JA(MA)=1 MA=MA+1 JA(MA)=N ELSE MA=MA+1 JA(MA)=I IF (I.LE.N-1) THEN MA=MA+1 JA(MA)=I+1 ENDIF ENDIF IA(I+1)=MA+1 542 CONTINUE RETURN 550 IF (N.LT.3) GO TO 999 DO 551 I=1,N X(I)=1.0D 0 551 CONTINUE GO TO 252 560 IF (N.LT.3) GO TO 999 DO 561 I=1,N X(I)=-1.0D 0 561 CONTINUE GO TO 252 570 IF (N.LT.7) GO TO 999 DO 571 I=1,N X(I)=-1.0D 0 571 CONTINUE NA=N MA=0 IA(1)=1 J1=3 J2=3 DO 573 I=1,N IF (I-J1.GT.1) THEN I1=I-J1 ELSE I1=1 ENDIF IF (I+J2.LT.N) THEN I2=I+J2 ELSE I2=N ENDIF DO 572 J=I1,I2 MA=MA+1 JA(MA)=J 572 CONTINUE IA(I+1)=MA+1 573 CONTINUE RETURN 590 IF (N.LT.2) GO TO 999 DO 591 I=1,N X(I)=0.5D 0 591 CONTINUE NA=N MA=0 IA(1)=1 DO 592 I=1,N IF (I.GT.1) THEN MA=MA+1 JA(MA)=I-1 ENDIF MA=MA+1 JA(MA)=I IA(I+1)=MA+1 592 CONTINUE RETURN 600 IF (N.LT.3) GO TO 999 DO 601 I=1,N X(I)=1.0D 0 601 CONTINUE GO TO 252 610 IF (N.LT.7) GO TO 999 DO 611 I=1,N X(I)=-1.0D 0 611 CONTINUE NA=N MA=0 IA(1)=1 DO 613 I=1,N IF (I-5.GT.1) THEN I1=I-5 ELSE I1=1 ENDIF IF (I+1.LT.N) THEN I2=I+1 ELSE I2=N ENDIF DO 612 J=I1,I2 MA=MA+1 JA(MA)=J 612 CONTINUE IA(I+1)=MA+1 613 CONTINUE RETURN 620 IF (N.LT.3) GO TO 999 DO 621 I=1,N X(I)=1.0D 0 621 CONTINUE GO TO 252 630 IF (N.LT.3) GO TO 999 DO 631 I=1,N X(I)=1.0D 0 631 CONTINUE GO TO 252 640 T=DBLE(2)/DBLE(N+2) N1=N/2 DO 641 I=1,N1 S=DBLE(I)*T X(I)=S*(1.0D 0-S) X(N1+I)=X(I) 641 CONTINUE NA=N N1=N/2 MA=0 IA(1)=1 DO 642 I=1,N IF (I.EQ.1) THEN MA=MA+1 JA(MA)=I MA=MA+1 JA(MA)=I+1 MA=MA+1 JA(MA)=I+N1 ELSE IF (I.EQ.N1+1) THEN MA=MA+1 JA(MA)=1 MA=MA+1 JA(MA)=I MA=MA+1 JA(MA)=I+1 ELSE IF (I.EQ.N1) THEN MA=MA+1 JA(MA)=I-1 MA=MA+1 JA(MA)=I MA=MA+1 JA(MA)=I+N1 ELSE IF (I.EQ.N) THEN MA=MA+1 JA(MA)=N1 MA=MA+1 JA(MA)=I-1 MA=MA+1 JA(MA)=I ELSE IF (I.LT.N1) THEN MA=MA+1 JA(MA)=I-1 MA=MA+1 JA(MA)=I MA=MA+1 JA(MA)=I+1 MA=MA+1 JA(MA)=I+N1 ELSE MA=MA+1 JA(MA)=I-N1 MA=MA+1 JA(MA)=I-1 MA=MA+1 JA(MA)=I MA=MA+1 JA(MA)=I+1 ENDIF IA(I+1)=MA+1 642 CONTINUE RETURN 650 N1=INT(SQRT(DBLE(N))) N=N1*N1 DO 651 I=1,N X(I)=1.0D 0 651 CONTINUE 652 NA=N ND=INT(SQRT(DBLE(N))) MA=0 IA(1)=1 DO 653 I=1,N L=MOD(I,ND) IF (L.EQ.0) THEN K=I/ND L=ND ELSE K=INT(I/ND)+1 ENDIF IF (L.EQ.1.AND.K.EQ.1) THEN MA=MA+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D26 ALL SYSTEMS 16/12/01 C PORTABILITY : ALL SYSTEMS C 16/12/01 LU : ORIGINAL VERSION * * PURPOSE : * INITIAL VALUES OF THE VARIABLES AND STRUCTURE OF THE SPARSE HESSIAN * MATRIX FOR UNCONSTRAINED MINIMIZATION. * * PARAMETERS : * II N NUMAER OF VARIABLES. * II NA NUMAER OF ELEMENTS OF THE SPARSE MATRIX. * RO X(N) VECTOR OF VARIABLES. * II NEXT NUMBER OF THE TEST PROBLEM. * IO IERR ERROR INDICATOR. * SUBROUTINE TIUD26(N,NA,X,FMIN,XMAX,NEXT,IERR) INTEGER N,NA,NEXT,IEXT,IERR REAL*8 X(N),FMIN,XMAX INTEGER I,J,K,M,N1 REAL*8 T,S,PAR REAL*8 Y(20) COMMON /EMPR15/ Y COMMON /EMPR18/ PAR,M REAL*8 ETA9 PARAMETER (ETA9=1.0D 60) FMIN=0.0D 0 XMAX=1.0D 3 IEXT=0 IERR=0 GOTO(10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160, & 170,180,190,200,210,220, & 230,240,250,260,270,280,290,310,340,360, & 370,380,390,400,410,420,430,440,450,460,470,480,490,500,520, & 510,540,550,560,570,590,600,610,620,630,640,650,660), & NEXT 10 IF (N.LT.2) GO TO 999 N=N-MOD(N,2) DO 11 I=1,N IF(MOD(I,2).EQ.1) THEN X(I)=-1.2D 0 ELSE X(I)=1.0D 0 ENDIF 11 CONTINUE NA=2*(N-1) RETURN 20 IF (N.LT.4) GO TO 999 N=N-MOD(N,2) DO 21 I=1,N IF(MOD(I,2).EQ.1) THEN X(I)=-2.0D 0 IF(I.LE.4) X(I)=-3.0D 0 ELSE X(I)=0.0D 0 IF(I.LE.4) X(I)=-1.0D 0 ENDIF 21 CONTINUE NA=3*(N-2) RETURN 30 IF (N.LT.4) GO TO 999 N=N-MOD(N,2) DO 31 I=1,N IF(MOD(I,4).EQ.1) THEN X(I)=3.0D 0 ELSEIF(MOD(I,4).EQ.2) THEN X(I)=-1.0D 0 ELSEIF(MOD(I,4).EQ.3) THEN X(I)=0.0D 0 ELSE X(I)=1.0D 0 ENDIF 31 CONTINUE NA=2*(N-2) RETURN 40 IF (N.LT.4) GO TO 999 N=N-MOD(N,2) DO 41 I=1,N X(I)=2.0D 0 41 CONTINUE X(1)=1.0D 0 NA=5*(N-2)/2 XMAX=1.0D 1 RETURN 50 IF (N.LT.3) GO TO 999 DO 51 I=1,N X(I)=-1.0D 0 51 CONTINUE NA=N RETURN 60 IF (N.LT.6) GO TO 999 DO 61 I=1,N X(I)=-1.0D 0 61 CONTINUE NA=N RETURN 70 IF (N.LT.2) GO TO 999 DO 71 I=1,N-1 X(I)=0.5D 0 71 CONTINUE X(N)=-2.0D 0 NA=2*(N-1) RETURN 80 IF (N.LT.4) GO TO 999 N=N-MOD(N,4) DO 81 I=1,N X(I)=SIN(DBLE(I))**2 81 CONTINUE NA=5*N RETURN 90 IF (N.LT.4) GO TO 999 N=N-MOD(N,2) DO 91 I=1,N X(I)=5.0D 0 91 CONTINUE NA=3*(N-2) RETURN 100 IF (N.LT.2) GO TO 999 DO 101 I=1,N X(I)=0.2D 0 101 CONTINUE NA=2*(N-1) RETURN 110 CONTINUE IF (N.LT.2) GO TO 999 N=N-MOD(N,2) DO 111 I=1,N IF(MOD(I,2).EQ.1) THEN X(I)=-0.8D 0 ELSE X(I)=-0.8D 0 ENDIF 111 CONTINUE NA=2*(N-1) RETURN 120 CONTINUE IF (N.LT.5) GO TO 999 IF (MOD(N-5,3).NE.0) N=N-MOD(N-5,3) DO 121 I=1,N X(I)=-1.0D 0 121 CONTINUE NA=2*(N-2) RETURN 130 CONTINUE IF (N.LT.5) GO TO 999 IF (MOD(N-5,3).NE.0) N=N-MOD(N-5,3) DO 131 I=1,N X(I)=-1.0D 0 131 CONTINUE NA=7*(N-2)/3 RETURN 140 CONTINUE IF (N.LT.4) GO TO 999 DO 141 I=1,N IF (MOD(I,4).EQ.1) THEN X(I)=-0.8D 0 ELSE IF (MOD(I,4).EQ.2) THEN X(I)= 1.2D 0 ELSE IF (MOD(I,4).EQ.3) THEN X(I)=-1.2D 0 ELSE X(I)= 0.8D 0 ENDIF 141 CONTINUE Y(1)=14.4D 0 Y(2)=6.8D 0 Y(3)=4.2D 0 Y(4)=3.2D 0 142 IF (MOD(N-4,2).NE.0) N=N-MOD(N-4,2) NA=2*(N-2) RETURN 150 CONTINUE IF (N.LT.4) GO TO 999 DO 151 I=1,N IF (MOD(I,4).EQ.1) THEN X(I)=-0.8D 0 ELSE IF (MOD(I,4).EQ.2) THEN X(I)= 1.2D 0 ELSE IF (MOD(I,4).EQ.3) THEN X(I)=-1.2D 0 ELSE X(I)= 0.8D 0 ENDIF 151 CONTINUE Y(1)=35.8D 0 Y(2)=11.2D 0 Y(3)=6.2D 0 Y(4)=4.4D 0 GO TO 142 160 CONTINUE IF (N.LT.4) GO TO 999 DO 161 I=1,N IF (MOD(I,4).EQ.1) THEN X(I)=-0.8D 0 ELSE IF (MOD(I,4).EQ.2) THEN X(I)= 1.2D 0 ELSE IF (MOD(I,4).EQ.3) THEN X(I)=-1.2D 0 ELSE X(I)= 0.8D 0 ENDIF 161 CONTINUE Y(1)=30.6D 0 Y(2)=72.2D 0 Y(3)=124.4D 0 Y(4)=187.4D 0 GO TO 142 170 IF (N.LT.4) GO TO 999 N=N-MOD(N,2) NA=N DO 171 I=1,N IF (MOD(I,8).EQ.1) X(I)=1.0D-1 IF (MOD(I,8).EQ.2.OR.MOD(I,8).EQ.0) X(I)=2.0D-1 IF (MOD(I,8).EQ.3.OR.MOD(I,8).EQ.7) X(I)=3.0D-1 IF (MOD(I,8).EQ.4.OR.MOD(I,8).EQ.6) X(I)=4.0D-1 IF (MOD(I,8).EQ.5) X(I)=5.0D-1 171 CONTINUE RETURN 180 IF (N.LT.3) GO TO 999 NA=N DO 181 I=1,N X(I)=1.2D 1 181 CONTINUE RETURN 190 IF (N.LT.7) GO TO 999 NA=N DO 191 I=1,N X(I)=-1.0D 0 191 CONTINUE RETURN 200 IF (N.LT.3) GO TO 999 NA=N DO 201 I=1,N X(I)=DBLE(I)/DBLE(N+1) X(I)=X(I)*(X(I)-1.0D 0) 201 CONTINUE RETURN 210 CONTINUE IF (N.LT.5) GO TO 999 IF (MOD(N-5,3).NE.0) N=N-MOD(N-5,3) DO 211 I=1,N X(I)=-1.0D 0 211 CONTINUE NA=7*(N-2)/3 RETURN 220 IF (N.LT.3) GO TO 999 DO 221 I=1,N IF(MOD(I,2).EQ.1) THEN X(I)=-1.2D 0 ELSE X(I)= 1.0D 0 ENDIF 221 CONTINUE NA=2*(N-1) RETURN 230 IF (N.LT.5) GO TO 999 N=N-MOD(N,2) NA=N DO 231 I=1,N IF (MOD(I,8).EQ.1) X(I)=1.0D-1 IF (MOD(I,8).EQ.2.OR.MOD(I,8).EQ.0) X(I)=2.0D-1 IF (MOD(I,8).EQ.3.OR.MOD(I,8).EQ.7) X(I)=3.0D-1 IF (MOD(I,8).EQ.4.OR.MOD(I,8).EQ.6) X(I)=4.0D-1 IF (MOD(I,8).EQ.5) X(I)=5.0D-1 231 CONTINUE RETURN 240 IF (N.LT.5) GO TO 999 N=N-MOD(N,5) NA=N DO 241 I=1,N X(I)=1.0D 0/DBLE(N) 241 CONTINUE RETURN 250 IF (N.LT.3) GO TO 999 DO 251 I=1,N X(I)=0.0D 0 251 CONTINUE NA=N RETURN 260 IF (N.LT.3) GO TO 999 IF (MOD(N,2).NE.1) N=N-1 NA=N DO 261 I=1,N X(I)=1.0D 0 261 CONTINUE RETURN 270 IF (N.LT.3) GO TO 999 DO 271 I=1,N X(I)=-1.0D 0 271 CONTINUE NA=N RETURN 280 IF (N.LT.5) GO TO 999 NA=N DO 281 I=1,N X(I)=-2.0D 0 281 CONTINUE RETURN 290 IF (N.LT.7) GO TO 999 NA=N DO 291 I=1,N X(I)=-3.0D 0 291 CONTINUE XMAX=1.0D 1 RETURN 310 IF (N.LT.2) GO TO 999 N=N-MOD(N,2) NA=N DO 311 I=1,N IF(MOD(I,2).EQ.1) THEN X(I)=9.0D 1 ELSE X(I)=6.0D 1 ENDIF 311 CONTINUE RETURN 340 IF (N.LT.3) GO TO 999 DO 341 I=1,N X(I)=-1.0D 0 341 CONTINUE NA=N RETURN 360 IF (N.LT.2) GO TO 999 N=N-MOD(N,2) NA=N DO 361 I=1,N IF (MOD(I,2).EQ.1) THEN X(I)=0.0D 0 ELSE X(I)=1.0D 0 ENDIF 361 CONTINUE RETURN 370 IF (N.LT.4) GO TO 999 N=N-MOD(N,4) NA=N DO 371 I=2,N,2 X(I-1)=-3.0D 0 X(I)=-1.0D 0 371 CONTINUE RETURN 380 IF (N.LT.3) GO TO 999 DO 381 I=1,N X(I)=1.5D 0 381 CONTINUE XMAX=1.0D 0 NA=N RETURN 390 IF (N.LT.3) GO TO 999 DO 391 I=1,N X(I)=DBLE(I)/DBLE(N+1) X(I)=X(I)*(X(I)-1.0D 0) 391 CONTINUE NA=N RETURN 400 IF (N.LT.3) GO TO 999 DO 401 I=1,N X(I)=1.0D 1 401 CONTINUE NA=N RETURN 410 IF (N.LT.3) GO TO 999 DO 411 I=1,N X(I)=1.0D 0 411 CONTINUE PAR=1.0D 1 NA=N RETURN 420 IF (N.LT.5) GO TO 999 PAR=5.0D 2/DBLE(N+2) DO 421 I=1,N X(I)=((DBLE(I)+0.5D 0)/DBLE(N+2)-0.5D 0)**2 421 CONTINUE NA=N RETURN 430 IF (N.LT.10) GO TO 999 N=N-MOD(N,2) M=N/2 PAR=5.0D 2 DO 431 I=1,M K=I+M X(I)=(DBLE(I)/DBLE(M+1)-0.5D 0)**2 431 CONTINUE DO 432 I=M+1,N K=I-M X(I)=DBLE(K)/DBLE(M+1)-0.5D 0 432 CONTINUE NA=N RETURN 440 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=6.7D 0/DBLE(M+1)**2 N=M*M K=0 DO 442 J=1,M DO 441 I=1,M K=K+1 X(K)=0.0D 0 441 CONTINUE 442 CONTINUE NA=N RETURN 450 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=1.0D 0/DBLE(M+1)**2 N=M*M K=0 DO 452 J=1,M DO 451 I=1,M K=K+1 X(K)=-1.0D 0 451 CONTINUE 452 CONTINUE NA=N RETURN 460 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=1.0D 0/DBLE(M+1)**2 N=M*M K=0 DO 462 J=1,M DO 461 I=1,M K=K+1 X(K)=0.0D 0 461 CONTINUE 462 CONTINUE NA=N RETURN 470 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=5.0D 1/DBLE(M+1) N=M*M K=0 DO 472 J=1,M DO 471 I=1,M K=K+1 X(K)=1.0D 0-DBLE(I)*DBLE(J)/DBLE(M+1)**2 471 CONTINUE 472 CONTINUE NA=N RETURN 480 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) PAR=1.0D 0/DBLE(M+1) N=M*M K=0 DO 482 J=1,M DO 481 I=1,M K=K+1 X(K)=0.0D 0 481 CONTINUE 482 CONTINUE NA=N RETURN 490 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) N=M*M PAR=500.0D 0/DBLE(M+2)**4 K=0 DO 492 J=1,M DO 491 I=1,M K=K+1 X(K)=0.0D 0 491 CONTINUE 492 CONTINUE NA=N RETURN 500 IF (N.LT.16) GO TO 999 M=INT(SQRT(DBLE(N))) N=M*M PAR=500.0D 0 K=0 DO 502 J=1,M DO 501 I=1,M K=K+1 X(K)=0.0D 0 501 CONTINUE 502 CONTINUE NA=N RETURN 520 IF (N.LT.3) GO TO 999 DO 521 I=1,N X(I)=5.0D 0*MIN(DBLE(I)/DBLE(N+1),1.0D 0-DBLE(I)/DBLE(N+1)) 521 CONTINUE NA=N RETURN 510 IF (N.LT.3) GO TO 999 DO 511 I=1,N X(I)=5.0D 0*MIN(DBLE(I)/DBLE(N+1),1.0D 0-DBLE(I)/DBLE(N+1)) 511 CONTINUE XMAX=1.0D 4 NA=N RETURN 540 IF (N.LT.3) GO TO 999 DO 541 I=1,N X(I)=2.0D 0 541 CONTINUE NA=N RETURN 550 IF (N.LT.3) GO TO 999 DO 551 I=1,N X(I)=1.0D 0 551 CONTINUE NA=N RETURN 560 IF (N.LT.3) GO TO 999 DO 561 I=1,N X(I)=-1.0D 0 561 CONTINUE NA=N RETURN 570 IF (N.LT.7) GO TO 999 DO 571 I=1,N X(I)=-1.0D 0 571 CONTINUE NA=N RETURN 590 IF (N.LT.2) GO TO 999 DO 591 I=1,N X(I)=0.5D 0 591 CONTINUE NA=N RETURN 600 IF (N.LT.3) GO TO 999 DO 601 I=1,N X(I)=1.0D 0 601 CONTINUE NA=N RETURN 610 IF (N.LT.7) GO TO 999 DO 611 I=1,N X(I)=-1.0D 0 611 CONTINUE NA=N RETURN 620 IF (N.LT.3) GO TO 999 DO 621 I=1,N X(I)=1.0D 0 621 CONTINUE NA=N RETURN 630 IF (N.LT.3) GO TO 999 DO 631 I=1,N X(I)=1.0D 0 631 CONTINUE NA=N RETURN 640 T=DBLE(2)/DBLE(N+2) N1=N/2 DO 641 I=1,N1 S=DBLE(I)*T X(I)=S*(1.0D 0-S) X(N1+I)=X(I) 641 CONTINUE NA=N RETURN 650 N1=INT(SQRT(DBLE(N))) N=N1*N1 DO 651 I=1,N X(I)=1.0D 0 651 CONTINUE NA=N RETURN 660 N1=INT(SQRT(DBLE(N))) N=N1*N1 DO 661 I=1,N X(I)=1.0D 0 661 CONTINUE NA=N RETURN 999 IERR=1 RETURN END * SUBROUTINE TAFU26 ALL SYSTEMS 99/12/01 C PORTABILITY : ALL SYSTEMS C 99/12/01 LU : ORIGINAL VERSION * * PURPOSE : * VALUES OF MODEL FUNCTIONS FOR UNCONSTRAINED MINIMIZATION. * UNIVERSAL VERSION. * * PARAMETERS : * II N NUMBER OF VARIABLES. * II KA INDEX OF THE APPROXIMATED FUNCTION. * RI X(N) VECTOR OF VARIABLES. * RO FA VALUE OF THE APPROXIMATED FUNCTION AT THE * SELECTED POINT. * II NEXT NUMBER OF THE TEST PROBLEM. * SUBROUTINE TAFU26(N,KA,X,FA,NEXT) INTEGER N,KA,NEXT REAL*8 X(N),FA INTEGER I,J,K,L,M,I1,I2,J1,J2,N1,ND,IA,IB,IC,LA REAL*8 A,B,A1,A2,A3,A4,AL,AL1,AL2,FF,H,PAR,PI,BE,BE1,BE2,C,CA,CB, & D,P,GA,H2,S,S1,S2,S3,T,U,V,ALFA REAL*8 Y(20) COMMON /EMPR15/ Y COMMON /EMPR18/ PAR,M PI=3.14159265358979323846D 0 GOTO(10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160, & 170,180,190,200,210,220, & 230,240,250,260,270,280,290,310,340,360, & 370,380,390,400,410,420,430,440,450,460,470,480,490,500,520, & 510,540,550,560,570,590,600,610,620,630,640,650,660), & NEXT 10 I=(KA+1)/2 IF (MOD(KA,2).EQ.1) THEN FA=1.0D 1*(X(I)**2-X(I+1)) ELSE FA=X(I)-1.0D 0 ENDIF RETURN 20 A=SQRT(10.0D 0) D=SQRT(90.0D 0) I=2*((KA+5)/6) IF (MOD(KA,6).EQ.1) THEN FA=1.0D 1*(X(I-1)**2-X(I)) ELSEIF (MOD(KA,6).EQ.2) THEN FA=X(I-1)-1.0D 0 ELSEIF (MOD(KA,6).EQ.3) THEN FA=D*(X(I+1)**2-X(I+2)) ELSEIF (MOD(KA,6).EQ.4) THEN FA=X(I+1)-1.0D 0 ELSEIF (MOD(KA,6).EQ.5) THEN FA=A*(X(I)+X(I+2)-2.0D 0) ELSE FA=(X(I)-X(I+2))/A ENDIF RETURN 30 A=SQRT(1.0D 1) C=SQRT(5.0D 0) I=2*((KA+3)/4) IF (MOD(KA,4).EQ.1) THEN FA=X(I-1)+1.0D 1*X(I) ELSEIF (MOD(KA,4).EQ.2) THEN FA=C*(X(I+1)-X(I+2)) ELSEIF (MOD(KA,4).EQ.3) THEN FA=(X(I)-2.0D 0*X(I+1))**2 ELSE FA=A*(X(I-1)-X(I+2))**2 ENDIF RETURN 40 I=2*((KA+4)/5) IF (MOD(KA,5).EQ.1) THEN FA=(EXP(X(I-1))-X(I))**2 ELSEIF (MOD(KA,5).EQ.2) THEN FA=1.0D 1*(X(I)-X(I+1))**3 ELSEIF (MOD(KA,5).EQ.3) THEN P=X(I+1)-X(I+2) FA=(SIN(P)/COS(P))**2 ELSEIF (MOD(KA,5).EQ.4) THEN FA=X(I-1)**4 ELSE FA=X(I+2)-1.0D 0 ENDIF RETURN 50 I=KA FA=(3.0D 0-2.0D 0*X(I))*X(I)+1.0D 0 IF (I.GT.1) FA=FA-X(I-1) IF (I.LT.N) FA=FA-X(I+1) RETURN 60 I=KA FA=(2.0D 0+5.0D 0*X(I)**2)*X(I)+1.0D 0 DO 61 J=MAX(1,I-5),MIN(N,I+1) FA=FA+X(J)*(1.0D 0+X(J)) 61 CONTINUE RETURN 70 I=(KA+1)/2 IF (MOD(KA,2).EQ.1) THEN FA=X(I)+X(I+1)*((5.0D 0-X(I+1))*X(I+1)-2.0D 0)-1.3D 1 ELSE FA=X(I)+X(I+1)*((1.0D 0+X(I+1))*X(I+1)-1.4D 1)-2.9D 1 ENDIF RETURN 80 I=MOD(KA,N/2)+1 J=I+N/2 M=5*N IF (KA.LE.M/2) THEN IA=1 ELSE IA=2 ENDIF IB=5-KA/(M/4) IC=MOD(KA,5)+1 FA=(X(I)**IA-X(J)**IB)**IC RETURN 90 I=2*((KA+5)/6)-1 IF (MOD(KA,6).EQ.1) THEN FA=X(I)+3.0D 0*X(I+1)*(X(I+2)-1.0D 0)+X(I+3)**2-1.0D 0 ELSEIF (MOD(KA,6).EQ.2) THEN FA=(X(I)+X(I+1))**2+(X(I+2)-1.0D 0)**2-X(I+3)-3.0D 0 ELSEIF (MOD(KA,6).EQ.3) THEN FA=X(I)*X(I+1)-X(I+2)*X(I+3) ELSEIF (MOD(KA,6).EQ.4) THEN FA=2.0D 0*X(I)*X(I+2)+X(I+1)*X(I+3)-3.0D 0 ELSEIF (MOD(KA,6).EQ.5) THEN FA=(X(I)+X(I+1)+X(I+2)+X(I+3))**2+(X(I)-1.0D 0)**2 ELSE FA=X(I)*X(I+1)*X(I+2)*X(I+3)+(X(I+3)-1.0D 0)**2-1.0D 0 ENDIF RETURN 100 I=(KA+1)/2 J=MOD(KA,2) IF (J.EQ.0) THEN FA=6.0D 0-EXP(2.0D 0*X(I))-EXP(2.0D 0*X(I+1)) ELSEIF (I.EQ.1) THEN FA=4.0D 0-EXP(X(I))-EXP(X(I+1)) ELSEIF (I.EQ.N) THEN FA=8.0D 0-EXP(3.0D 0*X(I-1))-EXP(3.0D 0*X(I)) ELSE FA=8.0D 0-EXP(3.0D 0*X(I-1))-EXP(3.0D 0*X(I))+ & 4.0D 0-EXP(X(I))-EXP(X(I+1)) ENDIF RETURN 110 I=(KA+1)/2 IF (MOD(KA,2).EQ.1) THEN FA=1.0D 1*(2.0D 0*X(I)/(1.0D 0+X(I)**2)-X(I+1)) ELSE FA=X(I)-1.0D 0 ENDIF RETURN 120 I=3*((KA+5)/6)-2 IF (MOD(KA,6).EQ.1) THEN FA=1.0D 1*(X(I)**2-X(I+1)) ELSEIF (MOD(KA,6).EQ.2) THEN FA=X(I+2)-1.0D 0 ELSEIF (MOD(KA,6).EQ.3) THEN FA=(X(I+3)-1.0D 0)**2 ELSEIF (MOD(KA,6).EQ.4) THEN FA=(X(I+4)-1.0D 0)**3 ELSEIF (MOD(KA,6).EQ.5) THEN FA=X(I)**2*X(I+3)+SIN(X(I+3)-X(I+4))-1.0D 1 ELSE FA=X(I+1)+(X(I+2)**2*X(I+3))**2-2.0D 1 ENDIF RETURN 130 I=3*((KA+6)/7)-2 IF (MOD(KA,7).EQ.1) THEN FA=1.0D 1*(X(I)**2-X(I+1)) ELSEIF (MOD(KA,7).EQ.2) THEN FA=1.0D 1*(X(I+1)**2-X(I+2)) ELSEIF (MOD(KA,7).EQ.3) THEN FA=(X(I+2)-X(I+3))**2 ELSEIF (MOD(KA,7).EQ.4) THEN FA=(X(I+3)-X(I+4))**2 ELSEIF (MOD(KA,7).EQ.5) THEN FA=X(I)+X(I+1)**2+X(I+2)-3.0D 1 ELSEIF (MOD(KA,7).EQ.6) THEN FA=X(I+1)-X(I+2)**2+X(I+3)-1.0D 1 ELSE FA=X(I)*X(I+4)-1.0D 1 ENDIF RETURN 140 I=2*((KA+3)/4)-2 L=MOD((KA-1),4)+1 FA=-Y(L) DO 142 K=1,3 A=DBLE(K*K)/DBLE(L) DO 141 J=1,4 IF (X(I+J).EQ.0) X(I+J)=1.0D-16 A=A*SIGN(1.0D 0,X(I+J))*ABS(X(I+J))**(DBLE(J)/DBLE(K*L)) 141 CONTINUE FA=FA+A 142 CONTINUE RETURN 150 I=2*((KA+3)/4)-2 L=MOD((KA-1),4)+1 FA=-Y(L) DO 152 K=1,3 A=0.0D 0 DO 151 J=1,4 A=A+X(I+J)*(DBLE(J)/DBLE(K*L)) 151 CONTINUE FA=FA+EXP(A)*DBLE(K*K)/DBLE(L) 152 CONTINUE RETURN 160 I=2*((KA+3)/4)-2 L=MOD((KA-1),4)+1 FA=-Y(L) DO 161 J=1,4 FA=FA+DBLE((1-2*MOD(J,2))*L*J*J)*SIN(X(I+J))+ & DBLE(L*L*J)*COS(X(I+J)) 161 CONTINUE RETURN 170 ALFA=0.5D 0 IF (KA.EQ.1) THEN FA=ALFA-(1.0D 0-ALFA)*X(3)-X(1)*(1.0D 0+4.0D 0*X(2)) ELSEIF(KA.EQ.2) THEN FA=-(2.0D 0-ALFA)*X(4)-X(2)*(1.0D 0+4.0D 0*X(1)) ELSEIF(KA.EQ.N-1) THEN FA=ALFA*X(N-3)-X(N-1)*(1.0D 0+4.0D 0*X(N)) ELSEIF (KA.EQ.N) THEN FA=ALFA*X(N-2)-(2.0D 0-ALFA)-X(N)*(1.0D 0+4.0D 0*X(N-1)) ELSEIF (MOD(KA,2).EQ.1) THEN FA=ALFA*X(KA-2)-(1.0D 0-ALFA)*X(KA+2)- & X(KA)*(1.0D 0+4.0D 0*X(KA+1)) ELSE FA=ALFA*X(KA-2)-(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KA,7).EQ.6) THEN FA=X(I+2)+X(I+3)-2.0D 0*X(I+4) ELSE FA=1.0D 1*(X(I+1)**2-X(I+4)) ENDIF RETURN 220 I=KA/2 IF (KA.EQ.1) THEN FA=X(KA)-1.0D 0 ELSE IF (MOD(KA,2).EQ.0) THEN FA=1.0D 1*(X(I)**2-X(I+1)) ELSE FA=2.0D 0*EXP(-(X(I)-X(I+1))**2)+ & EXP(-2.0D 0*(X(I+1)-X(I+2))**2) ENDIF RETURN 230 A1=0.414214D 0 IF (KA.EQ.1) THEN FA=X(1)-(1.0D 0-X(1))*X(3)-A1*(1.0D 0+4.0D 0*X(2)) ELSEIF (KA.EQ.2) THEN FA=-(1.0D 0-X(1))*X(4)-A1*(1.0D 0+4.0D 0*X(2)) ELSEIF (KA.EQ.3) THEN FA=A1*X(1)-(1.0D 0-X(1))*X(5)-X(3)*(1.0D 0+4.0D 0*X(2)) ELSEIF (KA.LE.N-2) THEN FA=X(1)*X(KA-2)-(1.0D 0-X(1))*X(KA+2)- & X(KA)*(1.0D 0+4.0D 0*X(KA-1)) ELSEIF (KA.EQ.N-1) THEN FA=X(1)*X(N-3)-X(N-1)*(1.0D 0+4.0D 0*X(N-2)) ELSE FA=X(1)*X(N-2)-(1.0D 0-X(1))-X(N)*(1.0D 0+4.0D 0*X(N-1)) ENDIF RETURN 240 J=(KA-1)/5 FA=5.0D 0-DBLE(J+1)*(1.0D 0-COS(X(KA)))-SIN(X(KA)) J=J*5 DO 241 I=J+1,J+5 FA=FA-COS(X(I)) 241 CONTINUE RETURN 250 IF (KA.LT.2) THEN FA=3.0D 0*X(KA)**3+2.0D 0*X(KA+1)-5.0D 0+ & SIN(X(KA)-X(KA+1))*SIN(X(KA)+X(KA+1)) ELSEIF (KA.LT.N) THEN FA=3.0D 0*X(KA)**3+2.0D 0*X(KA+1)-5.0D 0+ & SIN(X(KA)-X(KA+1))*SIN(X(KA)+X(KA+1))+4.0D 0*X(KA)- & X(KA-1)*EXP(X(KA-1)-X(KA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-EXP(COS(DBLE(KA)*(X(KA-1)+X(KA)))) ENDIF RETURN 390 A3=1.0D 0/DBLE(N+1) A4=DBLE(KA)*A3 FA=2.0D 0*X(KA)+0.5D 0*A3*A3*(X(KA)+A4+1.0D 0)**3 IF(KA.GT.1) FA=FA-X(KA-1) IF(KA.LT.N) FA=FA-X(KA+1) RETURN 400 IF(KA.EQ.1) THEN FA=3.0D 0*X(KA)*(X(KA+1)-2.0D 0*X(KA))+0.25D 0*X(KA+1)**2 ELSEIF(KA.EQ.N) THEN FA=3.0D 0*X(KA)*(2.0D 1-2.0D 0*X(KA)+X(KA-1))+ & 0.25D 0*(2.0D 1-X(KA-1))**2 ELSE FA=3.0D 0*X(KA)*(X(KA+1)-2.0D 0*X(KA)+X(KA-1))+ & 0.25D 0*(X(KA+1)-X(KA-1))**2 ENDIF RETURN 410 H=1.0D 0/DBLE(N+1) IF (KA.LT.2) THEN FA=2.0D 0*X(KA)+PAR*H**2*SINH(PAR*X(KA))-X(KA+1) ELSE IF (KA.LT.N) THEN FA=2.0D 0*X(KA)+PAR*H**2*SINH(PAR*X(KA))-X(KA-1)-X(KA+1) ELSE FA=2.0D 0*X(KA)+PAR*H**2*SINH(PAR*X(KA))-X(KA-1)-1.0D 0 ENDIF RETURN 420 FA=6.0D 0*X(KA) A1=0.0D 0 A2=0.0D 0 A3=0.0D 0 IF (KA.GT.1) THEN FA=FA-4.0D 0*X(KA-1) A1=A1-X(KA-1) A2=A2+X(KA-1) A3=A3+2.0D 0*X(KA-1) ENDIF IF (KA.GT.2) THEN FA=FA+X(KA-2) A3=A3-X(KA-2) ENDIF IF (KA.LT.N-1) THEN FA=FA+X(KA+2) A3=A3+X(KA+2) ENDIF IF (KA.LT.N) THEN FA=FA-4.0D 0*X(KA+1) A1=A1+X(KA+1) A2=A2+X(KA+1) A3=A3-2.0D 0*X(KA+1) ENDIF IF (KA.GE.N-1) THEN FA=FA+1.0D 0 A3=A3+1.0D 0 ENDIF IF (KA.GE.N) THEN FA=FA-4.0D 0 A1=A1+1.0D 0 A2=A2+1.0D 0 A3=A3-2.0D 0 ENDIF FA=FA-0.5D 0*PAR*(A1*A2-X(KA)*A3) RETURN 430 H=1.0D 0/DBLE(M+1) IF(KA.LE.M) THEN J=KA+M FA=6.0D 0*X(KA) A1=0.0D 0 A2=0.0D 0 IF (KA.EQ.1) THEN A1=A1+1.0D 0 ENDIF IF (KA.GT.1) THEN FA=FA-4.0D 0*X(KA-1) A1=A1-X(J-1) A2=A2+2.0D 0*X(KA-1) ENDIF IF (KA.GT.2) THEN FA=FA+X(KA-2) A2=A2-X(KA-2) ENDIF IF (KA.LT.M-1) THEN FA=FA+X(KA+2) A2=A2+X(KA+2) ENDIF IF (KA.LT.M) THEN FA=FA-4.0D 0*X(KA+1) A1=A1+X(J+1) A2=A2-2.0D 0*X(KA+1) ENDIF IF (KA.EQ.M) THEN A1=A1+1.0D 0 ENDIF FA=FA+0.5D 0*PAR*H*(X(KA)*A2+X(J)*A1*H**2) ELSE J=KA-M FA=-2.0D 0*X(KA) A1=0.0D 0 A2=0.0D 0 IF (J.EQ.1) THEN A2=A2+1.0D 0 ENDIF IF (J.GT.1) THEN FA=FA+X(KA-1) A1=A1-X(J-1) A2=A2-X(KA-1) ENDIF IF (J.LT.M) THEN FA=FA+X(KA+1) A1=A1+X(J+1) A2=A2+X(KA+1) ENDIF IF (J.EQ.M) THEN A2=A2+1.0D 0 ENDIF FA=FA+0.5D 0*PAR*H*(X(KA)*A1+X(J)*A2) ENDIF RETURN 440 FA=4.0D 0*X(KA)-PAR*EXP(X(KA)) J=(KA-1)/M+1 I=KA-(J-1)*M IF(I.GT.1) FA=FA-X(KA-1) IF(I.LT.M) FA=FA-X(KA+1) IF(J.GT.1) FA=FA-X(KA-M) IF(J.LT.M) FA=FA-X(KA+M) RETURN 450 FA=4.0D 0*X(KA) J=(KA-1)/M+1 I=KA-(J-1)*M FA=FA+PAR*X(KA)**3/(1.0D 0+PAR*DBLE(I)**2+ & PAR*DBLE(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D 0*X(KA-1) ENDIF IF (I.LT.M) THEN FA=FA-8.0D 0*X(KA+1) IF (I.LT.M-1) THEN FA=FA+X(KA+2) ENDIF ENDIF IF (J.LT.M) THEN IF (I.GT.1) THEN FA=FA+2.0D 0*X(KA+M-1) ENDIF FA=FA-8.0D 0*X(KA+M) IF (I.LT.M) THEN FA=FA+2.0D 0*X(KA+M+1) ENDIF ENDIF IF (J.LT.M-1) THEN FA=FA+X(KA+M+M) ENDIF RETURN 500 H=0.5D 0/DBLE(M+2) J=(KA-1)/M+1 I=KA-(J-1)*M FA=2.0D 1*X(KA) A1=0.0D 0 A2=0.0D 0 A3=0.0D 0 A4=0.0D 0 IF (J.GT.2) THEN FA=FA+X(KA-M-M) A4=A4+X(KA-M-M) ENDIF IF (J.GT.1) THEN IF (I.GT.1) THEN FA=FA+2.0D 0*X(KA-M-1) A3=A3+X(KA-M-1) A4=A4+X(KA-M-1) ENDIF FA=FA-8.0D 0*X(KA-M) A1=A1-X(KA-M) A4=A4-4.0D 0*X(KA-M) IF (I.LT.M) THEN FA=FA+2.0D 0*X(KA-M+1) A3=A3-X(KA-M+1) A4=A4+X(KA-M+1) ENDIF ENDIF IF (I.GT.1) THEN IF (I.GT.2) THEN FA=FA+X(KA-2) A3=A3+X(KA-2) ENDIF FA=FA-8.0D 0*X(KA-1) A2=A2-X(KA-1) A3=A3-4.0D 0*X(KA-1) ENDIF IF (I.LT.M) THEN FA=FA-8.0D 0*X(KA+1) A2=A2+X(KA+1) A3=A3+4.0D 0*X(KA+1) IF (I.LT.M-1) THEN FA=FA+X(KA+2) A3=A3-X(KA+2) ENDIF ENDIF IF (J.LT.M) THEN IF (I.GT.1) THEN FA=FA+2.0D 0*X(KA+M-1) A3=A3+X(KA+M-1) A4=A4-X(KA+M-1) ENDIF FA=FA-8.0D 0*X(KA+M) A1=A1+X(KA+M) A4=A4+4.0D 0*X(KA+M) IF (I.LT.M) THEN FA=FA+2.0D 0*X(KA+M+1) A3=A3-X(KA+M+1) A4=A4-X(KA+M+1) ENDIF ENDIF IF (J.LT.M-1) THEN FA=FA+X(KA+M+M) A4=A4-X(KA+M+M) ENDIF IF (J.EQ.M) THEN IF (I.GT.1) THEN FA=FA-H-H A3=A3-H A4=A4+H ENDIF FA=FA+8.0D 0*H A1=A1-H A4=A4-4.0D 0*H IF (I.LT.M) THEN FA=FA-2.0D 0*H A3=A3+H A4=A4+H ENDIF FA=FA+H A4=A4-H ENDIF IF (J.EQ.M-1) THEN FA=FA-H A4=A4+H ENDIF FA=FA+0.25D 0*PAR*(A1*A3-A2*A4) RETURN 510 H=1.0D 0/DBLE(N+1) A1=DBLE(KA)*H A2=(A1-0.5D 0)**2 IF (A1.GE.0.5D 0) THEN A3= 1.0D 6 ELSE A3=-1.0D 6 ENDIF IF (KA.LT.2) THEN FA=2.0D 0*X(KA)-X(KA+1)+H**2*(X(KA)**3*EXP(X(KA))+ & 5.0D 8*EXP(-1.0D 4*A2)*SQRT(ABS(A1-0.5D 0))*X(KA+1)+A3) ELSEIF (KA.LT.N) THEN FA=2.0D 0*X(KA)-X(KA+1)-X(KA-1)+H**2*(X(KA)**3*EXP(X(KA))+ & 5.0D 8*EXP(-1.0D 4*A2)*SQRT(ABS(A1-0.5D 0))*(X(KA+1)-X(KA-1))+ & A3) ELSE FA=2.0D 0*X(KA)-X(KA-1)+H**2*(X(KA)**3*EXP(X(KA))- & 5.0D 8*EXP(-1.0D 4*A2)*SQRT(ABS(A1-0.5D 0))*X(KA-1)-A3) ENDIF RETURN 520 H=1.0D 0/DBLE(N+1) A1=DBLE(KA)*H A2=(A1-0.5D 0)**2 IF (KA.LT.2) THEN FA=2.0D 0*X(KA)-X(KA+1)+H**2*(X(KA)**3+ & 2.0D-4*(2.0D-4*A2-1.0D 0)*X(KA)-1.0D 9*EXP(-3.0D 4*A2)) ELSEIF (KA.LT.N) THEN FA=2.0D 0*X(KA)-X(KA+1)-X(KA-1)+H**2*(X(KA)**3+ & 2.0D-4*(2.0D-4*A2-1.0D 0)*X(KA)-1.0D 9*EXP(-3.0D 4*A2)) ELSE FA=2.0D 0*X(KA)-X(KA-1)+H**2*(X(KA)**3+ & 2.0D-4*(2.0D-4*A2-1.0D 0)*X(KA)-1.0D 9*EXP(-3.0D 4*A2)) ENDIF RETURN 540 IF (KA.EQ.N) THEN FA=X(KA)-0.1D 0*X(1)**2 ELSE FA=X(KA)-0.1D 0*X(KA+1)**2 ENDIF RETURN 550 S=(1.0D 0/DBLE(N+1))**2*EXP(X(KA)) IF (N.EQ.1) THEN FA=-2.0D 0*X(KA)-S ELSE IF (KA.EQ.1) THEN FA=-2.0D 0*X(KA)+X(KA+1)-S ELSE IF (KA.EQ.N) THEN FA=X(KA-1)-2.0D 0*X(KA)-S ELSE FA=X(KA-1)-2.0D 0*X(KA)+X(KA+1)-S ENDIF RETURN 560 S=0.1D 0 IF (N.EQ.1) THEN FA=(3.0D 0-S*X(KA))*X(KA)+1.0D 0 ELSE IF (KA.EQ.1) THEN FA=(3.0D 0-S*X(KA))*X(KA)+1.0D 0-2.0D 0*X(KA+1) ELSE IF (KA.EQ.N) THEN FA=(3.0D 0-S*X(KA))*X(KA)+1.0D 0-X(KA-1) ELSE FA=(3.0D 0-S*X(KA))*X(KA)+1.0D 0-X(KA-1)-2.0D 0*X(KA+1) ENDIF RETURN 570 S1=1.0D 0 S2=1.0D 0 S3=1.0D 0 J1=3 J2=3 IF (KA-J1.GT.1) THEN I1=KA-J1 ELSE I1=1 ENDIF IF (KA+J2.LT.N) THEN I2=KA+J2 ELSE I2=N ENDIF S=0.0D 0 DO 571 J=I1,I2 IF(J.NE.KA) S=S+X(J)+X(J)**2 571 CONTINUE FA=(S1+S2*X(KA)**2)*X(KA)+1.D 0-S3*S RETURN 590 IF(KA.EQ.1) THEN FA=X(1) ELSE FA=COS(X(KA-1))+X(KA)-1.0D 0 ENDIF RETURN 600 S=(1.0D 0/DBLE(N+1))**2 IF (N.EQ.1) THEN FA=2.0D 0*X(KA)-1.0D 0+S*(X(KA)+SIN(X(KA))) ELSE IF (KA.EQ.1) THEN FA=2.0D 0*X(KA)-X(KA+1)+S*(X(KA)+SIN(X(KA))) ELSE IF (KA.EQ.N) THEN FA=-X(KA-1)+2.0D 0*X(KA)-1.0D 0+S*(X(KA)+SIN(X(KA))) ELSE FA=-X(KA-1)+2.0D 0*X(KA)-X(KA+1)+S*(X(KA)+SIN(X(KA))) ENDIF RETURN 610 IF (KA-5.GT.1) THEN I1=KA-5 ELSE I1=1 ENDIF IF (KA+1.LT.N) THEN I2=KA+1 ELSE I2=N ENDIF S=0.0D 0 DO 611 J=I1,I2 IF (J.NE.KA) S=S+X(J)*(1.0D 0+X(J)) 611 CONTINUE FA=X(KA)*(2.0D 0+5.0D 0*X(KA)**2)+1.0D 0-S RETURN 620 H=1.0D 0/DBLE(N+1) T=2.0D 0*H**2 IF (KA.EQ.1) THEN FA=2.0D 0*X(KA)-X(KA+1)-T*X(KA)**2-H*X(KA+1) ELSE IF (1.LT.KA.AND.KA.LT.N) THEN FA=-X(KA-1)+2.0D 0*X(KA)-X(KA+1)-T*X(KA)**2-H*(X(KA+1)-X(KA-1)) ELSE IF (KA.EQ.N) THEN FA=-X(KA-1)+2.0D 0*X(KA)-0.5D 0-T*X(KA)**2-H*(0.5D 0-X(KA-1)) ENDIF RETURN 630 A=-5.0D-1 B=5.0D-1 AL=0.0D 0 BE=25.0D 0 GA=20.0D 0 CA=0.3D 0 CB=0.3D 0 H=(B-A)/DBLE(N+1) T=A+DBLE(KA)*H H=H**2 S=DBLE(KA)/DBLE(N+1) U=AL*(1.0D 0-S)+BE*S+X(KA) FF=CB*EXP(GA*(U-BE))-CA*EXP(GA*(AL-U)) IF (T.LE.0) THEN FF=FF+CA ELSE FF=FF-CB ENDIF IF (N.EQ.1) THEN FA=-AL+2.0D 0*X(KA)-BE+H*FF ELSE IF (KA.EQ.1) THEN FA=-AL+2.0D 0*X(KA)-X(KA+1)+H*FF ELSE IF (KA.LT.N) THEN FA=-X(KA-1)+2.0D 0*X(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A)-X(KA-ND)-X(KA-1)-X(KA+ND)+H2*X(KA)**2 & -12.0D 0/(DBLE(K)*H+2.0D 0)**2 ENDIF IF (L.EQ.1.AND.K.EQ.ND) THEN FA=4.0D 0*X(KA)-X(KA+1)-X(KA-ND)+H2*X(KA)**2 & -12.0D 0/(DBLE(ND)*H+1.0D 0)**2-12.0D 0/(H+2.0D 0)**2 ENDIF IF (1.LT.L.AND.L.LT.ND.AND.K.EQ.ND) THEN FA=4.0D 0*X(KA)-X(KA-1)-X(KA+1)-X(KA-ND)+H2*X(KA)**2 & -12.0D 0/(DBLE(L)*H+2.0D 0)**2 ENDIF IF (L.EQ.ND.AND.K.EQ.ND) THEN FA=4.0D 0*X(KA)-X(KA-1)-X(KA-ND)+H2*X(KA)**2 & -24.0D 0/(DBLE(ND)*H+2.0D 0)**2 ENDIF IF (1.LT.L.AND.L.LT.ND.AND.1.LT.K.AND.K.LT.ND) THEN FA=4.0D 0*X(KA)-X(KA-1)-X(KA+1)-X(KA-ND)-X(KA+ND)+H2*X(KA)**2 ENDIF RETURN END * SUBROUTINE TAGU26 ALL SYSTEMS 99/12/01 C PORTABILITY : ALL SYSTEMS C 99/12/01 TU : ORIGINAL VERSION * * PURPOSE : * VALUES OF MODEL FUNCTIONS FOR UNCONSTRAINED MINIMIZATION. * UNIVERSAL VERSION. * * PARAMETERS : * II N NUMBER OF VARIABLES. * II KA NUMBER OF APPROXIMATED FUNCTIONS. * RI X(N) VECTOR OF VARIABLES. * RO GA(N) GRADIENT OF THE APPROXIMATED FUNCTION. * II NEXT NUMBER OF THE TEST PROBLEM. * SUBROUTINE TAGU26(N,KA,X,GA,NEXT) INTEGER N,KA,NEXT REAL*8 X(N),GA(N) INTEGER I,J,K,L,M,I1,I2,IA,IB,IC,J1,J2,N1,ND,LA REAL*8 A,B,C,D,E,A1,A2,A3,A4,AL,AL1,AL2,FF,FG,PAR,PI,BE,BE1,BE2, & CA,CB,D1S,D2S,GB,H,H2,Q,R,S,S1,S2,S3,T,U,V,W,EX,ALFA REAL*8 GA1(2),GA2(2),GA3(6),GA4(6) REAL*8 Y(20) COMMON /EMPR15/ Y COMMON /EMPR18/ PAR,M PI=3.14159265358979323846D 0 GOTO(10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160, & 170,180,190,200,210,220, & 230,240,250,260,270,280,290,310,340,360, & 370,380,390,400,410,420,430,440,450,460,470,480,490,500,520, & 510,540,550,560,570,590,600,610,620,630,640,650,660), & NEXT 10 I=(KA+1)/2 IF (MOD(KA,2).EQ.1) THEN GA(I)=2.0D 1*X(I) GA(I+1)=-1.0D 1 ELSE GA(I)=1.0D 0 ENDIF RETURN 20 I=2*((KA+5)/6) A=SQRT(9.0D 1) B=SQRT(1.0D 1) IF (MOD(KA,6).EQ.1) THEN GA(I-1)=2.0D 1 *X(I-1) GA(I)=-1.0D 1 ELSEIF (MOD(KA,6).EQ.2) THEN GA(I-1)=1.0D 0 ELSEIF (MOD(KA,6).EQ.3) THEN GA(I+1)=2.0D 0*A*X(I+1) GA(I+2)=-A ELSEIF (MOD(KA,6).EQ.4) THEN GA(I+1)=1.0D 0 ELSEIF (MOD(KA,6).EQ.5) THEN GA(I)=B GA(I+2)=B ELSE GA(I)=1.0D 0/B GA(I+2)=-1.0D 0/B ENDIF RETURN 30 I=2*((KA+3)/4) A=SQRT(5.0D 0) B=SQRT(1.0D 1) IF (MOD(KA,4).EQ.1) THEN GA(I-1)=1.0D 0 GA(I)=1.0D 1 ELSEIF (MOD(KA,4).EQ.2) THEN GA(I+1)=A GA(I+2)=-A ELSEIF (MOD(KA,4).EQ.3) THEN C=X(I)-2.0D 0*X(I+1) GA(I)=2.0D 0*C GA(I+1)=-4.0D 0*C ELSE C=X(I-1)-X(I+2) D=2.0D 0*B*C GA(I-1)=D GA(I+2)=-D ENDIF RETURN 40 I=2*((KA+4)/5) IF (MOD(KA,5).EQ.1) THEN A=EXP(X(I-1)) B=A-X(I) C=2.0D 0*B GA(I-1)=C*A GA(I)=-C ELSEIF (MOD(KA,5).EQ.2) THEN A=X(I)-X(I+1) B=3.0D 1*A**2 GA(I)=B GA(I+1)=-B ELSEIF (MOD(KA,5).EQ.3) THEN C=X(I+1)-X(I+2) Q=SIN(C)/COS(C) R=COS(C) D=2.0D 0*Q/R**2 GA(I+1)=D GA(I+2)=-D ELSEIF (MOD(KA,5).EQ.4) THEN GA(I-1)=4.0D 0*X(I-1)**3 ELSE GA(I+2)=1.0D 0 ENDIF RETURN 50 I=KA GA(I)=3.0D 0-4.0D 0*X(I) IF (I.GT.1) GA(I-1)=-1.0D 0 IF (I.LT.N) GA(I+1)=-1.0D 0 RETURN 60 I=KA DO 61 J=MAX(1,I-5),MIN(N,I+1) GA(J)=1.0D 0+2.0D 0*X(J) 61 CONTINUE GA(I)=GA(I)+2.0D 0+1.5D 1*X(I)**2 RETURN 70 I=(KA+1)/2 IF (MOD(KA,2).EQ.1) THEN GA(I)=1.0D 0 GA(I+1)=1.0D 1*X(I+1)-3.0D 0*X(I+1)**2-2.0D 0 ELSE GA(I)=1.0D 0 GA(I+1)=2.0D 0*X(I+1)+3.0D 0*X(I+1)**2-1.4D 1 ENDIF RETURN 80 I=MOD(KA,N/2)+1 J=I+N/2 M=5*N IF (KA.LE.M/2) THEN IA=1 ELSE IA=2 ENDIF IB=5-KA/(M/4) IC=MOD(KA,5)+1 A=DBLE(IA) B=DBLE(IB) C=DBLE(IC) D=X(I)**IA-X(J)**IB IF (D.EQ.0.0D 0) THEN GA(I)=0.0D 0 GA(J)=0.0D 0 ELSE E=C*D**(IC-1) IF (X(I).EQ.0.0D 0.AND.IA.LE.1) THEN GA(I)=0.0D 0 ELSE GA(I)= E*A*X(I)**(IA-1) ENDIF IF (X(J).EQ.0.0D 0.AND.IB.LE.1) THEN GA(J)=0.0D 0 ELSE GA(J)=-E*B*X(J)**(IB-1) ENDIF ENDIF RETURN 90 I=2*((KA+5)/6)-1 IF (MOD(KA,6).EQ.1) THEN GA(I)=1.0D 0 GA(I+1)=3.0D 0*(X(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-2.0D 0*X(I+2) GA(I+3)=1.0D 0 ELSE GA(I)=X(I+4) GA(I+4)=X(I) ENDIF RETURN 140 I=2*((KA+3)/4)-2 L=MOD((KA-1),4)+1 DO 141 J=1,4 GA(I+J)=0.0D 0 141 CONTINUE DO 144 K=1,3 A=DBLE(K*K)/DBLE(L) DO 142 J=1,4 A=A*SIGN(1.0D 0,X(I+J))*ABS(X(I+J))**(DBLE(J)/DBLE(K*L)) 142 CONTINUE DO 143 J=1,4 GA(I+J)=GA(I+J)+(DBLE(J)/DBLE(K*L))*A/X(I+J) 143 CONTINUE 144 CONTINUE RETURN 150 I=2*((KA+3)/4)-2 L=MOD((KA-1),4)+1 DO 151 J=1,4 GA(I+J)=0.0D 0 151 CONTINUE DO 154 K=1,3 A=0.0D 0 DO 152 J=1,4 A=A+X(I+J)*(DBLE(J)/DBLE(K*L)) 152 CONTINUE A=EXP(A)*DBLE(K*K)/DBLE(L) DO 153 J=1,4 GA(I+J)=GA(I+J)+A*(DBLE(J)/DBLE(K*L)) 153 CONTINUE 154 CONTINUE RETURN 160 I=2*((KA+3)/4)-2 L=MOD((KA-1),4)+1 DO 161 J=1,4 GA(I+J)=DBLE((1-2*MOD(J,2))*L*J*J)*COS(X(I+J))- & DBLE(L*L*J)*SIN(X(I+J)) 161 CONTINUE RETURN 170 ALFA=0.5D 0 IF (KA.EQ.1) THEN GA(1)=-1.0D 0-4.0D 0*X(2) GA(2)=-4.0D 0*X(1) GA(3)=ALFA-1.0D 0 ELSEIF(KA.EQ.2) THEN GA(1)=-4.0D 0*X(2) GA(2)=-1.0D 0-4.0D 0*X(1) GA(4)=-2.0D 0+ALFA ELSEIF(KA.EQ.N-1) THEN GA(N-3)=ALFA GA(N-1)=-1.0D 0-4.0D 0*X(N) GA(N)=-4.0D 0*X(N-1) ELSEIF (KA.EQ.N) THEN GA(N-2)=ALFA GA(N-1)=-4.0D 0*X(N) GA(N)=-1.0D 0-4.0D 0*X(N-1) ELSEIF (MOD(KA,2).EQ.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IF RETURN 540 IF (KA.EQ.N) THEN GA(1)=-0.20D 0*X(1) GA(N)=1.0D 0 ELSE GA(KA)=1.0D 0 GA(KA+1)=-0.2D 0*X(KA+1) ENDIF RETURN 550 S=(1.0D 0/DBLE(N+1))**2*EXP(X(KA)) IF (N.EQ.1) THEN GA(KA)=-(2.0D 0+S) ELSE IF (KA.EQ.1) THEN GA(KA)=-(2.0D 0+S) GA(KA+1)=1.0D 0 ELSE IF (KA.EQ.N) THEN GA(KA)=-(2.0D 0+S) GA(KA-1)=1.0D 0 ELSE GA(KA)=-(2.0D 0+S) GA(KA-1)=1.0D 0 GA(KA+1)=1.0D 0 ENDIF RETURN 560 S=0.1D 0 IF (N.EQ.1) THEN GA(KA)=3.0D 0-2.0D 0*S*X(KA) ELSE IF (KA.EQ.1) THEN GA(KA)=3.0D 0-2.0D 0*S*X(KA) GA(KA+1)=-2.0D 0 ELSE IF (KA.EQ.N) THEN GA(KA)=3.0D 0-2.0D 0*S*X(KA) GA(KA-1)=-1.0D 0 ELSE GA(KA)=3.0D 0-2.0D 0*S*X(KA) GA(KA-1)=-1.0D 0 GA(KA+1)=-2.0D 0 ENDIF RETURN 570 S1=1.0D 0 S2=1.0D 0 S3=1.0D 0 J1=3 J2=3 IF (KA-J1.GT.1) THEN I1=KA-J1 ELSE I1=1 ENDIF IF (KA+J2.LT.N) THEN I2=KA+J2 ELSE I2=N ENDIF S=0.0D 0 DO 571 J=I1,I2 IF (J.NE.KA) S=S+X(J)+X(J)**2 571 CONTINUE GA(KA)=S1+3.0D 0*S2*X(KA)**2 DO 572 J=I1,I2 IF (J.NE.KA) GA(J)=-S3*(1.0D 0+2.0D 0*X(J)) 572 CONTINUE RETURN 590 IF (KA.EQ.1) THEN GA(1)=1.0D 0 ELSE GA(KA)=1.0D 0 GA(KA-1)=-SIN(X(KA-1)) ENDIF RETURN 600 S=(1.0D 0/DBLE(N+1))**2 IF (N.EQ.1) THEN GA(KA)=2.0D 0+S*(1.0D 0+COS(X(KA))) ELSE IF (KA.EQ.1) THEN GA(KA)=2.0D 0+S*(1.0D 0+COS(X(KA))) GA(KA+1)=-1.0D 0 ELSE IF (KA.EQ.N) THEN GA(KA)=2.0D 0+S*(1.0D 0+COS(X(KA))) GA(KA-1)=-1.0D 0 ELSE GA(KA)=2.0D 0+S*(1.0D 0+COS(X(KA))) GA(KA-1)=-1.0D 0 GA(KA+1)=-1.0D 0 ENDIF RETURN 610 IF (KA-5.GT.1) THEN I1=KA-5 ELSE I1=1 ENDIF IF (KA+1.LT.N) THEN I2=KA+1 ELSE I2=N ENDIF S=0.0D 0 DO 611 J=I1,I2 IF (J.NE.KA) S=S+X(J)*(1.0D 0+X(J)) 611 CONTINUE GA(KA)=2.0D 0+15.0D 0*X(KA)**2 DO 612 J=I1,I2 IF (J.NE.KA) GA(J)=-(1.0D 0+2.0D 0*X(J)) 612 CONTINUE 613 CONTINUE RETURN 620 H=1.0D 0/DBLE(N+1) T=2.0D 0*H**2 IF (KA.EQ.1) THEN GA(KA)=2.0D 0*(1.0D 0-T*X(KA)) GA(KA+1)=-(1.0D 0+H) ELSE IF (1.LT.KA.AND.KA.LT.N) THEN GA(KA)=2.0D 0*(1.0D 0-T*X(KA)) GA(KA-1)=-(1.0D 0-H) GA(KA+1)=-(1.0D 0+H) ELSE IF (KA.EQ.N) THEN GA(KA)=2.0D 0*(1.0D 0-T*X(KA)) GA(KA-1)=-(1.0D 0-H) ENDIF RETURN 630 A=-5.0D-1 B=5.0D-1 AL=0.0D 0 BE=25.0D 0 GB=20.0D 0 CA=0.3D 0 CB=0.3D 0 H=(B-A)/DBLE(N+1) T=A+DBLE(KA)*H H=H**2 S=DBLE(KA)/DBLE(N+1) U=AL*(1.0D 0-S)+BE*S+X(KA) FF=CB*EXP(GB*(U-BE))-CA*EXP(GB*(AL-U)) FG=GB*(CB*EXP(GB*(U-BE))+CA*EXP(GB*(AL-U))) IF (T.LE.0) THEN FF=FF+CA ELSE FF=FF-CB ENDIF IF (N.EQ.1) THEN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