**Purpose**

To compute the QR factorization with column pivoting of an m-by-n matrix J (m >= n), that is, J*P = Q*R, where Q is a matrix with orthogonal columns, P a permutation matrix, and R an upper trapezoidal matrix with diagonal elements of nonincreasing magnitude, and to apply the transformation Q' on the error vector e (in-situ). The 1-norm of the scaled gradient is also returned. The matrix J could be the Jacobian of a nonlinear least squares problem.

SUBROUTINE MD03BX( M, N, FNORM, J, LDJ, E, JNORMS, GNORM, IPVT, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDJ, LDWORK, M, N DOUBLE PRECISION FNORM, GNORM C .. Array Arguments .. INTEGER IPVT(*) DOUBLE PRECISION DWORK(*), E(*), J(*), JNORMS(*)

**Input/Output Parameters**

M (input) INTEGER The number of rows of the Jacobian matrix J. M >= 0. N (input) INTEGER The number of columns of the Jacobian matrix J. M >= N >= 0. FNORM (input) DOUBLE PRECISION The Euclidean norm of the vector e. FNORM >= 0. J (input/output) DOUBLE PRECISION array, dimension (LDJ, N) On entry, the leading M-by-N part of this array must contain the Jacobian matrix J. On exit, the leading N-by-N upper triangular part of this array contains the upper triangular factor R of the Jacobian matrix. Note that for efficiency of the later calculations, the matrix R is delivered with the leading dimension MAX(1,N), possibly much smaller than the value of LDJ on entry. LDJ (input/output) INTEGER The leading dimension of array J. On entry, LDJ >= MAX(1,M). On exit, LDJ >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (M) On entry, this array must contain the error vector e. On exit, this array contains the updated vector Q'*e. JNORMS (output) DOUBLE PRECISION array, dimension (N) This array contains the Euclidean norms of the columns of the Jacobian matrix, considered in the initial order. GNORM (output) DOUBLE PRECISION If FNORM > 0, the 1-norm of the scaled vector J'*Q'*e/FNORM, with each element i further divided by JNORMS(i) (if JNORMS(i) is nonzero). If FNORM = 0, the returned value of GNORM is 0. IPVT (output) INTEGER array, dimension (N) This array defines the permutation matrix P such that J*P = Q*R. Column j of P is column IPVT(j) of the identity matrix.

DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if N = 0 or M = 1; LDWORK >= 4*N+1, if N > 1. For optimum performance LDWORK should be larger.

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

The algorithm uses QR factorization with column pivoting of the matrix J, J*P = Q*R, and applies the orthogonal matrix Q' to the vector e.

None

**Program Text**

None

None

None