📄 lmstr_.3
字号:
.\" Hey, EMACS: -*- nroff -*-.TH LMSTR_ 3 "March 8, 2002" Minpack.\" Please adjust this date whenever revising the manpage..SH NAMElmstr_, lmstr1_ \- minimize the sum of squares of m nonlinear functions, with user supplied Jacobian and minimal storage.SH SYNOPSIS.B include <minpack.h>.nh.ad l.HP 28.BI "void lmstr1_ ( ".BI "void (*" fcn ).BI "(int *" m , .BI "int *" n ,.BI "double *" x ,.BI "double *" fvec ,.BI "double *" fjrow ,.BI "int *" iflag ),.RS 15.BI "int *" m ,.BI "int * " n ,.BI "double *" x ,.BI "double *" fvec ,.BI "double *" fjac ,.BI "int *" ldfjac ,.br.BI "double *" tol , .BI "int *" info ,.BI "int *" iwa ,.br.BI "double *" wa ,.BI "int *" kwa );.RE.HP 27.BI "void lmstr_".BI "( void (*" fcn )(.BI "int *" m , .BI "int *" n ,.BI "double *" x , .BI "double *" fvec , .BI "double *" fjrow ,.BI "int *" iflag ),.RS 14.BI "int *" m ,.BI "int *" n ,.BI "double *" x ,.BI "double *" fvec ,.BI "double *" fjac ,.BI "int *" ldfjac ,.br.BI "double *" ftol ,.BI "double *" xtol ,.BI "double *" gtol ,.br.BI "int *" maxfev ,.BI "double *" diag ,.BI "int *" mode ,.BI "double *" factor ,.br.BI "int *" nprint ,.BI "int *" info ,.BI "int *" nfev ,.BI "int *" njev ,.br.BI "int *" ipvt ,.BI "double *" qtf ,.br.BI "double *" wa1 ,.BI "double *" wa2 ,.BI "double *" wa3 ,.BI "double *" wa4 " );".RE.hy.ad b.br.SH DESCRIPTIONThe purpose of \fBlmstr_\fP is to minimize the sum of the squares of\fIm\fP nonlinear functions in \fIn\fP variables by a modification ofthe Levenberg-Marquardt algorithm. The user must provide a function which calculates the functions and the rows of the Jacobian..PP\fBlmstr1_\fP performs the same function but has a simplified calling sequence..PP\fBlmder\fP(3) and \fBlmder1\fP(3) perform the same function but donot attempt to minimize storage..br.SS Language notesThese functions are written in FORTRAN. If calling fromC, keep these points in mind:.TPName mangling.With \fBg77\fP version 2.95 or 3.0, all the function names end in anunderscore. This may change with future versions of \fBg77\fP..TPCompile with \fBg77\fP.Even if your program is all C code, you should link with \fBg77\fPso it will pull in the FORTRAN libraries automatically. It's easiestjust to use \fBg77\fP to do all the compiling. (It handles C just fine.).TPCall by reference.All function parameters must be pointers..TPColumn-major arrays.Suppose a function returns an array with 5 rows and 3 columns in anarray \fIz\fP and in the call you have declared a leading dimension of7. The FORTRAN and equivalent C references are:.sp.nf z(1,1) z[0] z(2,1) z[1] z(5,1) z[4] z(1,2) z[7] z(1,3) z[14] z(i,j) z[(i-1) + (j-1)*7].fi.br.SS User-supplied Function\fIfcn\fP is the name of the user-supplied subroutine which calculatesthe functions. In FORTRAN, \fIfcn\fP must be declared in an externalstatement in the user calling program, and should be written asfollows:.sp.nf subroutine fcn(m,n,x,fvec,fjrow,iflag) integer m,n,iflag double precision x(n),fvec(m),fjrow(n) ---------- if iflag = 1 calculate the functions at x and return this vector in fvec. Do not alter fjac. if iflag = i calculate row (i-1) of the Jacobian at x and return this vector in fjrow. ---------- return end.fi.spIn C, \fIfcn\fP should be written as follows:.sp.nf void fcn(int m, int n, double *x, double *fvec, double *fjrow, int *iflag) { /* If iflag = 1 calculate the functions at x and return the values in fvec[0] through fvec[m-1]. Do not alter fjac. If iflag = i calculate row (i-1) of the Jacobian at x and return the vector in fjrow. */ }.fi.sp\fIiflag\fP is an input integer which specifies whether a functionvalue or Jacobian row is to be calculated.The value of \fIiflag\fP should not be changed by \fIfcn\fP unless theuser wants to terminate execution of \fBlmstr_\fP (or \fBlmstr1_\fP). Inthis case set \fIiflag\fP to a negative integer..br.SS Parameters for both \fBlmstr_\fP and \fBlmstr1_\fP\fIm\fP is a positive integer input variable set to the numberof functions.\fIn\fP is a positive integer input variable set to the numberof variables. \fIn\fP must not exceed \fIm\fP.\fIx\fP is an array of length \fIn\fP. On input \fIx\fP must containan initial estimate of the solution vector. On output \fIx\fPcontains the final estimate of the solution vector.\fIfvec\fP is an output array of length \fIm\fP which containsthe functions evaluated at the output \fIx\fP.\fIfjrow\fP is an output array of length \fIn\fP which is set to onerow of the Jacobian evaluated at \fIx\fP.\fIfjac\fP is an output \fIm\fP by \fIn\fP array. The upper \fIn\fP by\fIn\fP submatrix of \fIfjac\fP contains an upper triangular matrix\fBr\fP with diagonal elements of nonincreasing magnitude such that t t t p *(jac *jac)*p = r *r,where \fIp\fP is a permutation matrix and \fBjac\fP is the finalcalculated Jacobian. Column \fBj\fP of \fIp\fP is column\fIipvt\fP(\fBj\fP) (see below) of the identity matrix. The lowertrapezoidal part of \fIfjac\fP contains information generated duringthe computation of \fBr\fP.\fIldfjac\fP is a positive integer input variable not less than\fIm\fP which specifies the leading dimension of the array\fIfjac\fP..br.SS Parameters for \fBlmstr1_\fP\fItol\fP is a nonnegative input variable. Termination occurs whenthe algorithm estimates either that the relative error in the sum ofsquares is at most \fItol\fP or that the relative error between\fIx\fP and the solution is at most \fItol\fP.\fIinfo\fP is an integer output variable. if the user hasterminated execution, \fIinfo\fP is set to the (negative)value of iflag. see description of \fIfcn\fP. otherwise,\fIinfo\fP is set as follows. \fIinfo\fP = 0 improper input parameters. \fIinfo\fP = 1 algorithm estimates that the relative errorin the sum of squares is at most \fItol\fP. \fIinfo\fP = 2 algorithm estimates that the relative errorbetween x and the solution is at most \fItol\fP. \fIinfo\fP = 3 conditions for \fIinfo\fP = 1 and \fIinfo\fP = 2 both hold. \fIinfo\fP = 4 \fIfvec\fP is orthogonal to the columns of theJacobian to machine precision. \fIinfo\fP = 5 number of calls to \fIfcn\fP has reached orexceeded 100*(\fIn\fP+1). \fIinfo\fP = 6 \fItol\fP is too small. no further reduction inthe sum of squares is possible. \fIinfo\fP = 7 \fItol\fP is too small. no further improvement inthe approximate solution x is possible.\fIwa\fP is a work array of length \fIlwa\fP.\fIlwa\fP is an integer input variable not less than \fIm\fP*\fIn\fP +5*\fIn\fP + \fIm\fP for \fBlmder1\fP, or 5*\fIn\fP+\fIm\fP for \fBlmstr1_\fP..br.SS Parameters for \fBlmstr_\fP\fIftol\fP is a nonnegative input variable. Terminationoccurs when both the actual and predicted relativereductions in the sum of squares are at most \fIftol\fP.Therefore, \fIftol\fP measures the relative error desiredin the sum of squares.\fIxtol\fP is a nonnegative input variable. Terminationoccurs when the relative error between two consecutiveiterates is at most \fIxtol\fP. Therefore, \fIxtol\fP measures therelative error desired in the approximate solution.\fIgtol\fP is a nonnegative input variable. Terminationoccurs when the cosine of the angle between \fIfvec\fP andany column of the Jacobian is at most \fIgtol\fP in absolutevalue. Therefore, \fIgtol\fP measures the orthogonalitydesired between the function vector and the columnsof the Jacobian.\fImaxfev\fP is a positive integer input variable. Terminationoccurs when the number of calls to \fIfcn\fP is at least\fImaxfev\fP by the end of an iteration.\fIdiag\fP is an array of length \fIn\fP. If \fImode\fP = 1 (seebelow), \fIdiag\fP is internally set. If \fImode\fP = 2, \fIdiag\fPmust contain positive entries that serve asmultiplicative scale factors for the variables.\fImode\fP is an integer input variable. If \fImode\fP = 1, thevariables will be scaled internally. If \fImode\fP = 2,the scaling is specified by the input \fIdiag\fP. Othervalues of mode are equivalent to \fImode\fP = 1.\fIfactor\fP is a positive input variable used in determining theinitial step bound. This bound is set to the product of \fIfactor\fPand the euclidean norm of \fIdiag\fP*\fIx\fP if the latter isnonzero, or else to \fIfactor\fP itself. In most cases factor shouldlie in the interval (.1,100.). 100. is a generally recommendedvalue.\fInprint\fP is an integer input variable that enables controlledprinting of iterates if it is positive. In this case, fcn is calledwith \fIiflag\fP = 0 at the beginning of the first iteration andevery \fInprint\fP iterations thereafter and immediately prior toreturn, with \fIx\fP and \fIfvec\fP available for printing. If\fInprint\fP is not positive, no special calls of fcn with\fIiflag\fP = 0 are made.\fIinfo\fP is an integer output variable. If the user hasterminated execution, info is set to the (negative)value of iflag. See description of fcn. Otherwise,info is set as follows. \fIinfo\fP = 0 improper input parameters. \fIinfo\fP = 1 both actual and predicted relative reductionsin the sum of squares are at most \fIftol\fP. \fIinfo\fP = 2 relative error between two consecutive iteratesis at most \fIxtol\fP. \fIinfo\fP = 3 conditions for \fIinfo\fP = 1 and \fIinfo\fP = 2 both hold. \fIinfo\fP = 4 the cosine of the angle between fvec and anycolumn of the Jacobian is at most gtol in absolute value. \fIinfo\fP = 5 number of calls to \fIfcn\fP has reached orexceeded maxfev. \fIinfo\fP = 6 \fIftol\fP is too small. No further reduction inthe sum of squares is possible. \fIinfo\fP = 7 \fIxtol\fP is too small. No further improvement inthe approximate solution x is possible. \fIinfo\fP = 8 \fIgtol\fP is too small. \fIfvec\fP is orthogonal tothe columns of the Jacobian to machine precision.\fInfev\fP is an integer output variable set to the number ofcalls to \fIfcn\fP with \fIiflag\fP = 1.\fInjev\fP is an integer output variable set to the number ofcalls to fcn with \fIiflag\fP = 2.\fIipvt\fP is an integer output array of length \fIn\fP. \fIipvt\fPdefines a permutation matrix \fIp\fP such that \fIjac\fP*\fIp\fP =\fIq\fP*\fIr\fP, where \fIjac\fP is the final calculated Jacobian,\fIq\fP is orthogonal (not stored), and \fIr\fP is upper triangularwith diagonal elements of nonincreasing magnitude. Column \fBj\fPof \fIp\fP is column \fIipvt\fP(\fBj\fP) of the identity matrix.\fIqtf\fP is an output array of length \fIn\fP which containsthe first \fIn\fP elements of the vector (\fIq\fP transpose)*\fIfvec\fP.\fIwa1\fP, \fIwa2\fP, and \fIwa3\fP are work arrays of length \fIn\fP.\fIwa4\fP is a work array of length \fIm\fP..br.SH SEE ALSO.BR lmdif (3),.BR lmdif1 (3),.BR lmder (3),.BR lmder1 (3)..br.SH AUTHORSJorge More', Burt Garbow, and Ken Hillstrom at Argonne National Laboratory.This manual page was written by Jim Van Zandt <jrv@debian.org>,for the Debian GNU/Linux system (but may be used by others).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -