Changeset bd2278d for minqsn.f


Ignore:
Timestamp:
09/05/08 11:49:42 (16 years ago)
Author:
baerbaer <baerbaer@…>
Branches:
master
Children:
fafe4d6
Parents:
2ebb8b6
Message:

Reformatting comments and continuation marks.

Fortran 90 and higher use ! to mark comments no matter where they are in the
code. The only valid continuation marker is &.
I also added the SMMP.kdevelop.filelist to the repository to make it easier
to use kdevelop.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/smmp/trunk@12 26dc1dd8-5c4e-0410-9ffe-d298b4865968

File:
1 edited

Legend:

Unmodified
Added
Removed
  • minqsn.f

    r2ebb8b6 rbd2278d  
    1 c **************************************************************
    2 c
    3 c This file contains the subroutines: minqsn,mc11a,mc11e
    4 c
    5 c Copyright 2003-2005  Frank Eisenmenger, U.H.E. Hansmann,
    6 c                      Shura Hayryan, Chin-Ku
    7 c Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
    8 c                      Jan H. Meinke, Sandipan Mohanty
    9 c
    10 c **************************************************************
     1! **************************************************************
     2!
     3! This file contains the subroutines: minqsn,mc11a,mc11e
     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! **************************************************************
    1111
    1212      subroutine minqsn(n,mxn,x,f,g,scal,acur,h,d,w,xa,ga,xb,gb,maxfun,
    13      #                  nfun)
    14 
    15 c .............................................................
    16 c  PURPOSE: Quasi-Newton minimizer
    17 c
    18 c           Unconstrained local minimization of function FUNC
    19 c           vs. N variables by quasi-Newton method using BFGS-
    20 c           formula to update hessian matrix; approximate line
    21 c           searches performed using cubic extra-/interpolation
    22 c           [see Gill P.E., Murray W., Wright M.H., Practical
    23 c            Optimization, Ch. 2.2.5.7, 4.3.2.1 ff.,4.4.2.2.,
    24 c            4.5.2.1]
    25 c
    26 c  INPUT:   X,F,G - variables, value of FUNC, gradient at START
    27 c           SCAL  - factors to reduce(increase) initial step &
    28 c                   its lower bound for line searches, diagonal
    29 c                   elements of initial hessian matrix
    30 c           MXN - maximal overall number of function calls
    31 c
    32 c  OUTPUT:  X,F,G - variables, value of FUNC, gradient at MINIMUM
    33 c           NFUN  - overall number of function calls used
    34 c 
    35 c  ARRAYS:  H - approximate hessian matrix in symmetric storage
    36 c               (dimension N(N+1)/2)
    37 c           W,D,XA,XB,GA,GB - dimension N
    38 c
    39 c  CALLS:   MOVE - external to calculate function for current X
    40 c                  and its gradients
    41 c           MC11E- solve system H*D=-G for search direction D, where
    42 c                  H is given in Cholesky-factorization
    43 c           MC11A- update H using BFGS formula, factorizise new H
    44 c                  according to Cholesky (modified to maintain its
    45 c                  positive definiteness)
    46 c
    47 c  PARAMETERS:
    48 c 
    49 c  EPS1 - checks reduction of FUNC during line search
    50 c         ( 0.0001 <= EPS1 < 0.5 )
    51 c  EPS2 - controls accuracy of line search (reduce to increase
    52 c         accuracy; EPS1 < EPS2 <= 0.9 )
    53 c  ACUR - fractional precision for determination of variables
    54 c         (should not be smaller than sqrt of machine accuracy)
    55 c  TINY - prevent division by zero during cubic extrapolation
    56 c .............................................................
     13     &                  nfun)
     14
     15! .............................................................
     16!  PURPOSE: Quasi-Newton minimizer
     17!
     18!           Unconstrained local minimization of function FUNC
     19!           vs. N variables by quasi-Newton method using BFGS-
     20!           formula to update hessian matrix; approximate line
     21!           searches performed using cubic extra-/interpolation
     22!           [see Gill P.E., Murray W., Wright M.H., Practical
     23!            Optimization, Ch. 2.2.5.7, 4.3.2.1 ff.,4.4.2.2.,
     24!            4.5.2.1]
     25!
     26!  INPUT:   X,F,G - variables, value of FUNC, gradient at START
     27!           SCAL  - factors to reduce(increase) initial step &
     28!                   its lower bound for line searches, diagonal
     29!                   elements of initial hessian matrix
     30!           MXN - maximal overall number of function calls
     31!
     32!  OUTPUT:  X,F,G - variables, value of FUNC, gradient at MINIMUM
     33!           NFUN  - overall number of function calls used
     34! 
     35!  ARRAYS:  H - approximate hessian matrix in symmetric storage
     36!               (dimension N(N+1)/2)
     37!           W,D,XA,XB,GA,GB - dimension N
     38!
     39!  CALLS:   MOVE - external to calculate function for current X
     40!                  and its gradients
     41!           MC11E- solve system H*D=-G for search direction D, where
     42!                  H is given in Cholesky-factorization
     43!           MC11A- update H using BFGS formula, factorizise new H
     44!                  according to Cholesky (modified to maintain its
     45!                  positive definiteness)
     46!
     47!  PARAMETERS:
     48! 
     49!  EPS1 - checks reduction of FUNC during line search
     50!         ( 0.0001 <= EPS1 < 0.5 )
     51!  EPS2 - controls accuracy of line search (reduce to increase
     52!         accuracy; EPS1 < EPS2 <= 0.9 )
     53!  ACUR - fractional precision for determination of variables
     54!         (should not be smaller than sqrt of machine accuracy)
     55!  TINY - prevent division by zero during cubic extrapolation
     56! .............................................................
    5757
    5858      implicit real*8 (a-h,o-z)
     
    6060
    6161      parameter ( eps1=0.1d0,
    62      #            eps2=0.7d0,
    63      #            tiny=1.d-32,
    64 
    65      #            zero=0.d0,
    66      #            izero=0,
    67      #            ione=1 )
     62     &            eps2=0.7d0,
     63     &            tiny=1.d-32,
     64
     65     &            zero=0.d0,
     66     &            izero=0,
     67     &            ione=1 )
    6868
    6969      dimension x(mxn),g(mxn),scal(mxn),h(mxn*(mxn+1)/2),d(mxn),w(mxn),
    70      #          xa(mxn),ga(mxn),xb(mxn),gb(mxn)
     70     &          xa(mxn),ga(mxn),xb(mxn),gb(mxn)
    7171
    7272      nfun=0
    7373      itr=0
    7474      dff=0.
    75 c _______________ hessian to a diagonal matrix depending on scale
     75! _______________ hessian to a diagonal matrix depending on scale
    7676      c=0.
    7777      do i=1,n
     
    102102    2 itr=itr+1    ! Start New Line-search from A
    103103
    104 c ______________ search direction of the iteration
     104! ______________ search direction of the iteration
    105105      do i=1,n
    106106        d(i)=-ga(i)
     
    126126      steplb=acur*c       ! lower bound on step
    127127
    128 c ________________________ initial step of the line search
     128! ________________________ initial step of the line search
    129129      if (dff.gt.0.) then
    130130        step=min(1.d0,(dff+dff)/(-dga))
     
    134134
    135135    3 if (nfun.ge.maxfun) then
    136 cc        write (*,*) ' minfor> exceeded max. number of function calls'
     136!c        write (*,*) ' minfor> exceeded max. number of function calls'
    137137        return
    138138      endif
     
    159159          if (gl2.ge.gl1) goto 4
    160160        endif
    161 c ______________ store function value if it is smallest so far
     161! ______________ store function value if it is smallest so far
    162162        f=fb
    163163        do i=1,n
     
    182182        stepub=stepub-step      ! new upper bound on step
    183183
    184 c _______________________________ next step by extrapolation
     184! _______________________________ next step by extrapolation
    185185        if (stepub.gt.0.) then
    186186          step=.5*stepub
     
    244244      return
    245245      end
    246 c ***********************************************
     246! ***********************************************
    247247      subroutine mc11a(a,n,mxn,z,sig,w,ir,mk,eps)
    248 c
    249 c CALLS: none
    250 c
     248!
     249! CALLS: none
     250!
    251251      implicit real*8 (a-h,o-z)
    252252      implicit integer*4 (i-n)
     
    368368      return
    369369      end
    370 c ************************************
     370! ************************************
    371371      subroutine mc11e(a,n,mxn,z,w,ir)
    372 c
    373 c CALLS: none
    374 c
     372!
     373! CALLS: none
     374!
    375375      implicit real*8 (a-h,o-z)
    376376      implicit integer*4 (i-n)
Note: See TracChangeset for help on using the changeset viewer.