## MD03BY

### Levenberg-Marquardt parameter for a standard nonlinear least squares problem

[Specification] [Arguments] [Method] [References] [Comments] [Example]

Purpose

      To determine a value for the parameter PAR such that if x solves
      the system

            A*x = b ,     sqrt(PAR)*D*x = 0 ,

      in the least squares sense, where A is an m-by-n matrix, D is an
      n-by-n nonsingular diagonal matrix, and b is an m-vector, and if
      DELTA is a positive number, DXNORM is the Euclidean norm of D*x,
      then either PAR is zero and

            ( DXNORM - DELTA ) .LE. 0.1*DELTA ,

      or PAR is positive and

            ABS( DXNORM - DELTA ) .LE. 0.1*DELTA .

      It is assumed that a QR factorization, with column pivoting, of A
      is available, that is, A*P = Q*R, where P is a permutation matrix,
      Q has orthogonal columns, and R is an upper triangular matrix
      with diagonal elements of nonincreasing magnitude.
      The routine needs the full upper triangle of R, the permutation
      matrix P, and the first n components of Q'*b (' denotes the
      transpose). On output, MD03BY also provides an upper triangular
      matrix S such that

            P'*(A'*A + PAR*D*D)*P = S'*S .

      Matrix S is used in the solution process.

Specification

          SUBROUTINE MD03BY( COND, N, R, LDR, IPVT, DIAG, QTB, DELTA, PAR,
         $                   RANK, X, RX, TOL, DWORK, LDWORK, INFO )
    C     .. Scalar Arguments ..
          CHARACTER         COND
          INTEGER           INFO, LDR, LDWORK, N, RANK
          DOUBLE PRECISION  DELTA, PAR, TOL
    C     .. Array Arguments ..
          INTEGER           IPVT(*)
          DOUBLE PRECISION  DIAG(*), DWORK(*), QTB(*), R(LDR,*), RX(*), X(*)

Arguments

Mode Parameters

      COND    CHARACTER*1
              Specifies whether the condition of the matrices R and S
              should be estimated, as follows:
              = 'E' :  use incremental condition estimation for R and S;
              = 'N' :  do not use condition estimation, but check the
                       diagonal entries of R and S for zero values;
              = 'U' :  use the rank already stored in RANK (for R).

Input/Output Parameters

      N       (input) INTEGER
              The order of the matrix R.  N >= 0.

      R       (input/output) DOUBLE PRECISION array, dimension (LDR, N)
              On entry, the leading N-by-N upper triangular part of this
              array must contain the upper triangular matrix R.
              On exit, the full upper triangle is unaltered, and the
              strict lower triangle contains the strict upper triangle
              (transposed) of the upper triangular matrix S.

      LDR     INTEGER
              The leading dimension of array R.  LDR >= MAX(1,N).

      IPVT    (input) INTEGER array, dimension (N)
              This array must define the permutation matrix P such that
              A*P = Q*R. Column j of P is column IPVT(j) of the identity
              matrix.

      DIAG    (input) DOUBLE PRECISION array, dimension (N)
              This array must contain the diagonal elements of the
              matrix D.  DIAG(I) <> 0, I = 1,...,N.

      QTB     (input) DOUBLE PRECISION array, dimension (N)
              This array must contain the first n elements of the
              vector Q'*b.

      DELTA   (input) DOUBLE PRECISION
              An upper bound on the Euclidean norm of D*x.  DELTA > 0.

      PAR     (input/output) DOUBLE PRECISION
              On entry, PAR must contain an initial estimate of the
              Levenberg-Marquardt parameter.  PAR >= 0.
              On exit, it contains the final estimate of this parameter.

      RANK    (input or output) INTEGER
              On entry, if COND = 'U', this parameter must contain the
              (numerical) rank of the matrix R.
              On exit, this parameter contains the numerical rank of
              the matrix S.

      X       (output) DOUBLE PRECISION array, dimension (N)
              This array contains the least squares solution of the
              system A*x = b, sqrt(PAR)*D*x = 0.

      RX      (output) DOUBLE PRECISION array, dimension (N)
              This array contains the matrix-vector product -R*P'*x.

Tolerances

      TOL     DOUBLE PRECISION
              If COND = 'E', the tolerance to be used for finding the
              rank of the matrices R and S. If the user sets TOL > 0,
              then the given value of TOL is used as a lower bound for
              the reciprocal condition number;  a (sub)matrix whose
              estimated condition number is less than 1/TOL is
              considered to be of full rank.  If the user sets TOL <= 0,
              then an implicitly computed, default tolerance, defined by
              TOLDEF = N*EPS,  is used instead, where EPS is the machine
              precision (see LAPACK Library routine DLAMCH).
              This parameter is not relevant if COND = 'U' or 'N'.

Workspace

      DWORK   DOUBLE PRECISION array, dimension (LDWORK)
              On exit, the first N elements of this array contain the
              diagonal elements of the upper triangular matrix S.

      LDWORK  INTEGER
              The length of the array DWORK.
              LDWORK >= 4*N, if COND =  'E';
              LDWORK >= 2*N, if COND <> 'E'.

Error Indicator

      INFO    INTEGER
              = 0:  successful exit;
              < 0:  if INFO = -i, the i-th argument had an illegal
                    value.

Method

      The algorithm computes the Gauss-Newton direction. A least squares
      solution is found if the Jacobian is rank deficient. If the Gauss-
      Newton direction is not acceptable, then an iterative algorithm
      obtains improved lower and upper bounds for the parameter PAR.
      Only a few iterations are generally needed for convergence of the
      algorithm. If, however, the limit of ITMAX = 10 iterations is
      reached, then the output PAR will contain the best value obtained
      so far. If the Gauss-Newton step is acceptable, it is stored in x,
      and PAR is set to zero, hence S = R.

References

      [1] More, J.J., Garbow, B.S, and Hillstrom, K.E.
          User's Guide for MINPACK-1.
          Applied Math. Division, Argonne National Laboratory, Argonne,
          Illinois, Report ANL-80-74, 1980.

Numerical Aspects

                                2
      The algorithm requires 0(N ) operations and is backward stable.

Further Comments

      This routine is a LAPACK-based modification of LMPAR from the
      MINPACK package [1], and with optional condition estimation.
      The option COND = 'U' is useful when dealing with several
      right-hand side vectors, but RANK should be reset.
      If COND = 'E', but the matrix S is guaranteed to be nonsingular
      and well conditioned relative to TOL, i.e., rank(R) = N, and
      min(DIAG) > 0, then its condition is not estimated.

Example

Program Text

      None

Program Data

      None

Program Results

      None

Return to Supporting Routines index