Search Site | Contact Details | FAQ

ADAS Subroutine xxder1

      SUBROUTINE XXDER1(FCN,M,N,X,FVEC,FJAC,LDFJAC,INFO,IPVT,WA,
     &                  LWA)
C-----------------------------------------------------------------------
C
C ROUTINE: XXDER1 (MINPACK ROUTINE LMDER1)
C
C PURPOSE: 
C     MINIMIZE THE SUM OF THE SQUARES OF M NONLINEAR FUNCTIONS IN N
C     VARIABLES BY A MODIFICATION OF THE LEVENBERG-MARQUARDT
C     ALGORITHM.
C     
C     THIS IS DONE BY USING THE MORE GENERAL LEAST-SQUARES SOLVER
C     LMDER. THE USER MUST PROVIDE A SUBROUTINE WHICH CALCULATES
C     THE FUNCTIONS AND THE JACOBIAN.
C
C INPUT:
C       FCN IS THE NAME OF THE USER-SUPPLIED SUBROUTINE WHICH
C         CALCULATES THE FUNCTIONS AND THE JACOBIAN. FCN MUST
C         BE DECLARED IN AN EXTERNAL STATEMENT IN THE USER
C         CALLING PROGRAM, AND SHOULD BE WRITTEN AS FOLLOWS.
C
C         SUBROUTINE FCN(M,N,X,FVEC,FJAC,LDFJAC,IFLAG)
C         INTEGER M,N,LDFJAC,IFLAG
C         DOUBLE PRECISION X(N),FVEC(M),FJAC(LDFJAC,N)
C         ----------
C         IF IFLAG = 1 CALCULATE THE FUNCTIONS AT X AND
C         RETURN THIS VECTOR IN FVEC. DO NOT ALTER FJAC.
C         IF IFLAG = 2 CALCULATE THE JACOBIAN AT X AND
C         RETURN THIS MATRIX IN FJAC. DO NOT ALTER FVEC.
C         ----------
C         RETURN
C         END
C
C         THE VALUE OF IFLAG SHOULD NOT BE CHANGED BY FCN UNLESS
C         THE USER WANTS TO TERMINATE EXECUTION OF LMDER1.
C         IN THIS CASE SET IFLAG TO A NEGATIVE INTEGER.
C
C       M IS A POSITIVE INTEGER INPUT VARIABLE SET TO THE NUMBER
C         OF FUNCTIONS.
C
C       N IS A POSITIVE INTEGER INPUT VARIABLE SET TO THE NUMBER
C         OF VARIABLES. N MUST NOT EXCEED M.
C
C       LDFJAC IS A POSITIVE INTEGER INPUT VARIABLE NOT LESS THAN M
C         WHICH SPECIFIES THE LEADING DIMENSION OF THE ARRAY FJAC.
C
CC       TOL IS A NONNEGATIVE INPUT VARIABLE. TERMINATION OCCURS
CC         WHEN THE ALGORITHM ESTIMATES EITHER THAT THE RELATIVE
CC         ERROR IN THE SUM OF SQUARES IS AT MOST TOL OR THAT
CC         THE RELATIVE ERROR BETWEEN X AND THE SOLUTION IS AT
CC         MOST TOL.
C
C       WA IS A DOUBLE PREC. WORK ARRAY OF LENGTH LWA.
C
C       LWA IS A POSITIVE INTEGER INPUT VARIABLE NOT LESS THAN 5*N+M.
C
C I/O:
C       X IS AN ARRAY OF LENGTH N. ON INPUT X MUST CONTAIN
C         AN INITIAL ESTIMATE OF THE SOLUTION VECTOR. ON OUTPUT X
C         CONTAINS THE FINAL ESTIMATE OF THE SOLUTION VECTOR.
C
C OUTPUT:
C       FVEC IS AN OUTPUT ARRAY OF LENGTH M WHICH CONTAINS
C         THE FUNCTIONS EVALUATED AT THE OUTPUT X.
C
C       FJAC IS AN OUTPUT M BY N ARRAY. THE UPPER N BY N SUBMATRIX
C         OF FJAC CONTAINS AN UPPER TRIANGULAR MATRIX R WITH
C         DIAGONAL ELEMENTS OF NONINCREASING MAGNITUDE SUCH THAT
C
C                T     T           T
C               P *(JAC *JAC)*P = R *R,
C
C         WHERE P IS A PERMUTATION MATRIX AND JAC IS THE FINAL
C         CALCULATED JACOBIAN. COLUMN J OF P IS COLUMN IPVT(J)
C         (SEE BELOW) OF THE IDENTITY MATRIX. THE LOWER TRAPEZOIDAL
C         PART OF FJAC CONTAINS INFORMATION GENERATED DURING
C         THE COMPUTATION OF R.
C
C       INFO IS AN INTEGER OUTPUT VARIABLE. IF THE USER HAS
C         TERMINATED EXECUTION, INFO IS SET TO THE (NEGATIVE)
C         VALUE OF IFLAG. SEE DESCRIPTION OF FCN. OTHERWISE,
C         INFO IS SET AS FOLLOWS.
C
C         INFO = 0  IMPROPER INPUT PARAMETERS.
C
C         INFO = 1  ALGORITHM ESTIMATES THAT THE RELATIVE ERROR
C                   IN THE SUM OF SQUARES IS AT MOST TOL.
C
C         INFO = 2  ALGORITHM ESTIMATES THAT THE RELATIVE ERROR
C                   BETWEEN X AND THE SOLUTION IS AT MOST TOL.
C
C         INFO = 3  CONDITIONS FOR INFO = 1 AND INFO = 2 BOTH HOLD.
C
C         INFO = 4  FVEC IS ORTHOGONAL TO THE COLUMNS OF THE
C                   JACOBIAN TO MACHINE PRECISION.
C
C         INFO = 5  NUMBER OF CALLS TO FCN WITH IFLAG = 1 HAS
C                   REACHED 100*(N+1).
C
C         INFO = 6  TOL IS TOO SMALL. NO FURTHER REDUCTION IN
C                   THE SUM OF SQUARES IS POSSIBLE.
C
C         INFO = 7  TOL IS TOO SMALL. NO FURTHER IMPROVEMENT IN
C                   THE APPROXIMATE SOLUTION X IS POSSIBLE.
C
C       IPVT IS AN INTEGER OUTPUT ARRAY OF LENGTH N. IPVT
C         DEFINES A PERMUTATION MATRIX P SUCH THAT JAC*P = Q*R,
C         WHERE JAC IS THE FINAL CALCULATED JACOBIAN, Q IS
C         ORTHOGONAL (NOT STORED), AND R IS UPPER TRIANGULAR
C         WITH DIAGONAL ELEMENTS OF NONINCREASING MAGNITUDE.
C         COLUMN J OF P IS COLUMN IPVT(J) OF THE IDENTITY MATRIX.
C
C CALLING PROGRAM: GENERAL USE
C
C ROUTINES:
C-----------------------------------------------------------------------
C     NAME     SOURCE   PURPOSE
C-----------------------------------------------------------------------
C     FCN      USER     SEE ABOVE
C     LMDER    MINPACK  DOES THE CALCULATION. FOLLOWS LATER IN THIS FILE
C-----------------------------------------------------------------------
C
C AUTHOR: ARGONNE NATIONAL LABORATORY. MINPACK PROJECT. MARCH 1980.
C     BURTON S. GARBOW, KENNETH E. HILLSTROM, JORGE J. MORE
C
C DATE:   05-06-96
C 
C VERSION 1.1                             DATE: 05-06-96
C MODIFIED: WILLIAM OSBORN
C           - FIRST COPIED FOR ADAS USE. REMOVED TOL FROM PARAMETERS
C             AND HARDWIRED AS DSQRT(DPMPAR(1))
C
C VERSION 1.2                             DATE: 10-04-2007
C MODIFIED : Allan Whiteford
C               - Modified documentation as part of automated
C		  subroutine documentation preparation.
C
C-----------------------------------------------------------------------

      DOUBLE PRECISION    FJAC(LDFJAC,N),           FVEC(M),     WA(LWA)
      DOUBLE PRECISION    X(N)
      INTEGER             INFO,        IPVT(N),     LDFJAC,      LWA
      INTEGER             M,           N
      DOUBLE PRECISION    X(N)
      INTEGER             N
      DOUBLE PRECISION    DIAG(N),     FACTOR,      FJAC(LDFJAC,N)
      DOUBLE PRECISION    FTOL,        FVEC(M),     GTOL,        QTF(N)
      DOUBLE PRECISION    WA1(N),      WA2(N),      WA3(N),      WA4(M)
      DOUBLE PRECISION    X(N),        XTOL
      INTEGER             INFO,        IPVT(N),     LDFJAC,      M
      INTEGER             MAXFEV,      MODE,        N,           NFEV
      INTEGER             NJEV,        NPRINT
      DOUBLE PRECISION    DELTA,       DIAG(N),     PAR,         QTB(N)
      DOUBLE PRECISION    R(LDR,N),    SDIAG(N),    WA1(N),      WA2(N)
      DOUBLE PRECISION    X(N)
      INTEGER             IPVT(N),     LDR,         N
      DOUBLE PRECISION    A(LDA,N),    ACNORM(N),   RDIAG(N),    WA(N)
      INTEGER             IPVT(LIPVT), LDA,         LIPVT,       M
      INTEGER             N
      LOGICAL             PIVOT
      DOUBLE PRECISION    DIAG(N),     QTB(N),      R(LDR,N)
      DOUBLE PRECISION    SDIAG(N),    WA(N),       X(N)
      INTEGER             IPVT(N),     LDR,         N
© Copyright 1995-2018 The ADAS Project
Comments and questions to: adas-at-adas.ac.uk