Clean up implementation of printing options table
[maxima.git] / share / lbfgs / lb1.f
blob1ffe46e6c635980da4f9fa8b64395054d7da1d57
2 C LAST LINE OF SUBROUTINE LBFGS
5 SUBROUTINE LB1(IPRINT,ITER,NFUN,
6 * GNORM,N,M,X,F,G,STP,FINISH)
8 C -------------------------------------------------------------
9 C THIS ROUTINE PRINTS MONITORING INFORMATION. THE FREQUENCY AND
10 C AMOUNT OF OUTPUT ARE CONTROLLED BY IPRINT.
11 C -------------------------------------------------------------
13 INTEGER IPRINT(2),ITER,NFUN,LP,MP,N,M
14 DOUBLE PRECISION X(N),G(N),F,GNORM,STP,GTOL,STPMIN,STPMAX
15 LOGICAL FINISH
16 COMMON /LB3/MP,LP,GTOL,STPMIN,STPMAX
18 IF (ITER.EQ.0)THEN
19 WRITE(MP,10)
20 WRITE(MP,20) N,M
21 WRITE(MP,30)F,GNORM
22 IF (IPRINT(2).GE.1)THEN
23 WRITE(MP,40)
24 WRITE(MP,50) (X(I),I=1,N)
25 WRITE(MP,60)
26 WRITE(MP,50) (G(I),I=1,N)
27 ENDIF
28 WRITE(MP,10)
29 WRITE(MP,70)
30 ELSE
31 IF ((IPRINT(1).EQ.0).AND.(ITER.NE.1.AND..NOT.FINISH))RETURN
32 IF (IPRINT(1).NE.0)THEN
33 IF(MOD(ITER-1,IPRINT(1)).EQ.0.OR.FINISH)THEN
34 IF(IPRINT(2).GT.1.AND.ITER.GT.1) WRITE(MP,70)
35 WRITE(MP,80)ITER,NFUN,F,GNORM,STP
36 ELSE
37 RETURN
38 ENDIF
39 ELSE
40 IF( IPRINT(2).GT.1.AND.FINISH) WRITE(MP,70)
41 WRITE(MP,80)ITER,NFUN,F,GNORM,STP
42 ENDIF
43 IF (IPRINT(2).EQ.2.OR.IPRINT(2).EQ.3)THEN
44 IF (FINISH)THEN
45 WRITE(MP,90)
46 ELSE
47 WRITE(MP,40)
48 ENDIF
49 WRITE(MP,50)(X(I),I=1,N)
50 IF (IPRINT(2).EQ.3)THEN
51 WRITE(MP,60)
52 WRITE(MP,50)(G(I),I=1,N)
53 ENDIF
54 ENDIF
55 IF (FINISH) WRITE(MP,100)
56 ENDIF
58 10 FORMAT('*************************************************')
59 20 FORMAT(' N=',I5,' NUMBER OF CORRECTIONS=',I2,
60 . /, ' INITIAL VALUES')
61 30 FORMAT(' F= ',1PD22.15,' GNORM= ',1PD22.15)
62 40 FORMAT(' VECTOR X= ')
63 50 FORMAT(4(2X,1PD22.15))
64 60 FORMAT(' GRADIENT VECTOR G= ')
65 70 FORMAT(/' I NFN',5X,'FUNC',20X,'GNORM',19X,'STEPLENGTH'/)
66 80 FORMAT(2(I4,1X),3X,3(1PD22.15,2X))
67 90 FORMAT(' FINAL POINT X= ')
68 100 FORMAT(/' THE MINIMIZATION TERMINATED WITHOUT DETECTING ERRORS.',
69 . /' IFLAG = 0')
71 RETURN
72 END