Provided by: minpack-dev_19961126+dfsg1-3_amd64

**NAME**

hybrj_, hybrj1_ - find a zero of a system of nonlinear function

**SYNOPSIS**

#include<minpack.h>voidhybrj1_(void(*fcn)(int*n,double*x,double*fvec,double*fjac,int*ldfjac,int*iflag),int*n,double*x,double*fvec,double*fjac,int*ldfjac,double*tol,int*info,double*wa,int*lwa);voidhybrj_(void(*fcn)(int*n,double*x,double*fvec,double*fjac,int*ldfjac,int*iflag),int*n,double*x,double*fvec,double*fjac,int*ldfjac,double*xtol,int*maxfev,double*diag,int*mode,double*factor,int*nprint,int*info,int*nfev,int*njev,double*r,int*lr,double*qtf,double*wa1,double*wa2,double*wa3,double*wa4);

**DESCRIPTION**

The purpose ofhybrj_is to find a zero of a system ofnnonlinear functions innvariables by a modification of the Powell hybrid method. The user must provide a subroutine which calculates the functions and a subroutine which calculates the Jacobian.hybrj1_serves the same function but has a simplified calling sequence.Languagenoteshybrj_andhybrj1_are written in FORTRAN. If calling from C, keep these points in mind: Name mangling. Withgfortran, all the function names end in an underscore. Compile withgfortran. Even if your program is all C code, you should link withgfortranso it will pull in the FORTRAN libraries automatically. It's easiest just to usegfortranto do all the compiling. (It handles C just fine.) Call by reference. All function parameters must be pointers. Column-major arrays. Suppose a function returns an array with 5 rows and 3 columns in an arrayzand in the call you have declared a leading dimension of 7. The FORTRAN and equivalent C references are: 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]Parametersforbothfunctionsfcnis the name of the user-supplied subroutine which calculates the functions. In FORTRAN,fcnmust be declared in an external statement in the user calling program, and should be written as follows: subroutine fcn(n,x,fvec,fjac,ldfjac,iflag) integer n,ldfjac,iflag double precision x(n),fvec(n),fjac(ldfjac,n) ---------- if iflag = 1 calculate the functions at x and return this vector in fvec. do not alter fjac. if iflag = 2 calculate the jacobian at x and return this matrix in fjac. do not alter fvec. --------- return end In C,fcnshould be written as follows: void fcn(int *n, double *x, double *fvec, double *fjac, int *ldfjac, int *iflag) { /* if iflag = 1 calculate the functions at x and return this vector in fvec. do not alter fjac. if iflag = 2 calculate the jacobian at x and return this matrix in fjac. do not alter fvec. */ } The value ofiflagshould not be changed byfcnunless the user wants to terminate execution of hybrj_. In this case setiflagto a negative integer.nis a positive integer input variable set to the number of functions and variables.xis an array of lengthn. On inputxmust contain an initial estimate of the solution vector. On outputxcontains the final estimate of the solution vector.fjacis an outputnbynarray which contains the orthogonal matrix q produced by the qr factorization of the final approximate jacobian.ldfjacis a positive integer input variable not less thannwhich specifies the leading dimension of the arrayfjac.fvecis an output array of lengthnwhich contains the functions evaluated at the outputx.Parametersforhybrj1_tolis a nonnegative input variable. Termination occurs when the algorithm estimates that the relative error betweenxand the solution is at mosttol.infois an integer output variable. If the user has terminated execution,infois set to the (negative) value ofiflag. See description offcn. Otherwise,infois set as follows.info= 0 improper input parameters.info= 1 algorithm estimates that the relative error betweenxand the solution is at mosttol.info= 2 number of calls to fcn has reached or exceeded 200*(n+1).info= 3tolis too small. No further improvement in the approximate solutionxis possible.info= 4 iteration is not making good progress.wais a work array of lengthlwa.lwais a positive integer input variable not less than (n*(3*n+13))/2.Parametersforhybrj_xtolis a nonnegative input variable. Termination occurs when the relative error between two consecutive iterates is at mostxtol.maxfevis a positive integer input variable. Termination occurs when the number of calls tofcnis at leastmaxfevby the end of an iteration.diagis an array of lengthn. Ifmode= 1 (see below),diagis internally set. Ifmode= 2,diagmust contain positive entries that serve as multiplicative scale factors for the variables.modeis an integer input variable. Ifmode= 1, the variables will be scaled internally. Ifmode= 2, the scaling is specified by the inputdiag. Other values of mode are equivalent tomode= 1.factoris a positive input variable used in determining the initial step bound. This bound is set to the product offactorand the euclidean norm of diag*x if nonzero, or else tofactoritself. In most cases factor should lie in the interval (.1,100.). 100. Is a generally recommended value.nprintis an integer input variable that enables controlled printing of iterates if it is positive. In this case,fcnis called withiflag= 0 at the beginning of the first iteration and every nprint iterations thereafter and immediately prior to return, withxandfvecavailable for printing. Ifnprintis not positive, no special calls offcnwithiflag= 0 are made.infois an integer output variable. If the user has terminated execution,infois set to the (negative) value ofiflag. See description offcn. Otherwise,infois set as follows.info= 0 improper input parameters.info= 1 relative error between two consecutive iterates is at mostxtol.info= 2 number of calls tofcnhas reached or exceededmaxfev.info= 3xtolis too small. No further improvement in the approximate solutionxis possible.info= 4 iteration is not making good progress, as measured by the improvement from the last five jacobian evaluations.info= 5 iteration is not making good progress, as measured by the improvement from the last ten iterations.nfevis an integer output variable set to the number of calls tofcn.fjacis an outputnbynarray which contains the orthogonal matrixqproduced by theqrfactorization of the final approximate jacobian.ldfjacis a positive integer input variable not less thannwhich specifies the leading dimension of the arrayfjac.ris an output array of lengthlrwhich contains the upper triangular matrix produced by theqrfactorization of the final approximate Jacobian, stored rowwise.lris a positive integer input variable not less than (n*(n+1))/2.qtfis an output array of lengthnwhich contains the vector (q transpose)*fvec.wa1,wa2,wa3, andwa4are work arrays of lengthn.

**SEE** **ALSO**

hybrd(3),hybrd1(3).

**AUTHORS**

Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More. This manual page was written by Jim Van Zandt <jrv@debian.org>, for the Debian GNU/Linux system (but may be used by others).