- Timestamp:
- 09/05/08 11:49:42 (16 years ago)
- Branches:
- master
- Children:
- fafe4d6
- Parents:
- 2ebb8b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mincjg.f
r2ebb8b6 rbd2278d 1 c**************************************************************2 c 3 cThis file contains the subroutines: mincjg4 c 5 cCopyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,6 cShura Hayryan, Chin-Ku7 cCopyright 2007 Frank Eisenmenger, U.H.E. Hansmann,8 cJan H. Meinke, Sandipan Mohanty9 c 10 c********************************************************************1 ! ************************************************************** 2 ! 3 ! This file contains the subroutines: mincjg 4 ! 5 ! Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann, 6 ! Shura Hayryan, Chin-Ku 7 ! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann, 8 ! Jan H. Meinke, Sandipan Mohanty 9 ! 10 ! ******************************************************************** 11 11 subroutine mincjg(n,mxn,x,f,g,acur,d,xa,ga,dt,yt,gt,maxfun,nfun) 12 12 13 c....................................................................14 c 15 cConjugate Gradient Minimizer16 c 17 cINPUT: X,F,G - variables, value of FUNC, gradient at START/18 cACUR - convergence is assumed if ACUR > SUM ( G(I)**2 )19 cMAXFUN - maximum overall number of function calls20 c 21 cOUTPUT: X,F,G - variables, value of FUNC, gradient at MINIMUM22 cNFUN - overall number of function calls used23 c 24 cARRAYS: D,XA,GA,YT,DT,GT - dimension N25 c 26 cCALLS: MOVE - calculate function & its gradients for current X27 c 28 cPARAMETERS: AMF - rough estimate of first reduction in F, used29 cto guess initial step of 1st line search30 cMXFCON - see 'ier=4'31 cMAXLIN -32 c 33 cDIAGNOSTICS (ier)34 c 35 c= 0: minimization completed successfully36 c= 1: number of steps reached MAXFUN37 c= 2: line search was abandoned38 c= 3: search direction is uphill39 c= 4: two consecutive line searches failed to reduce F40 c....................................................................13 ! .................................................................... 14 ! 15 ! Conjugate Gradient Minimizer 16 ! 17 ! INPUT: X,F,G - variables, value of FUNC, gradient at START/ 18 ! ACUR - convergence is assumed if ACUR > SUM ( G(I)**2 ) 19 ! MAXFUN - maximum overall number of function calls 20 ! 21 ! OUTPUT: X,F,G - variables, value of FUNC, gradient at MINIMUM 22 ! NFUN - overall number of function calls used 23 ! 24 ! ARRAYS: D,XA,GA,YT,DT,GT - dimension N 25 ! 26 ! CALLS: MOVE - calculate function & its gradients for current X 27 ! 28 ! PARAMETERS: AMF - rough estimate of first reduction in F, used 29 ! to guess initial step of 1st line search 30 ! MXFCON - see 'ier=4' 31 ! MAXLIN - 32 ! 33 ! DIAGNOSTICS (ier) 34 ! 35 ! = 0: minimization completed successfully 36 ! = 1: number of steps reached MAXFUN 37 ! = 2: line search was abandoned 38 ! = 3: search direction is uphill 39 ! = 4: two consecutive line searches failed to reduce F 40 ! .................................................................... 41 41 42 42 implicit real*8 (a-h,o-z) … … 44 44 45 45 parameter (AMF = 10.d0, 46 #MXFCON = 2,47 #MAXLIN = 5,48 #TOL = 1.d-7, ! controls 'stepch'49 #EPS = .7d0)46 & MXFCON = 2, 47 & MAXLIN = 5, 48 & TOL = 1.d-7, ! controls 'stepch' 49 & EPS = .7d0) 50 50 51 51 dimension x(mxn),g(mxn), 52 #d(mxn),xa(mxn),ga(mxn),dt(mxn),yt(mxn),gt(mxn)52 & d(mxn),xa(mxn),ga(mxn),dt(mxn),yt(mxn),gt(mxn) 53 53 54 54 … … 154 154 155 155 if ( nfun .gt. (nfbeg + 1) .or. 156 #abs(gdmi/gdit) .gt. EPS ) then156 & abs(gdmi/gdit) .gt. EPS ) then 157 157 158 158 ier=2 … … 205 205 206 206 if ( (gdmi * gspln) .lt. 0.d0 ) stepch = stepch * gdmi / 207 #(gdmi - gspln)207 & (gdmi - gspln) 208 208 209 209 goto 2 … … 242 242 243 243 if (iterrs .ne. 0 .and. (iter - iterrs) .lt. (n-1) .and. 244 #abs(sum) .lt. gsq2 ) then244 & abs(sum) .lt. gsq2 ) then 245 245 246 246 gama = 0.d0
Note:
See TracChangeset
for help on using the changeset viewer.