|
|
◆ hybrj_r()
| void hybrj_r |
( |
int |
n, |
|
|
double |
x[], |
|
|
double |
fvec[], |
|
|
double |
xtol, |
|
|
int |
maxfev, |
|
|
double |
diag[], |
|
|
int |
mode, |
|
|
double |
factor, |
|
|
int |
nprint, |
|
|
int * |
nfev, |
|
|
int * |
njev, |
|
|
double |
work[], |
|
|
int |
lwork, |
|
|
int * |
info, |
|
|
double |
xx[], |
|
|
double |
yy[], |
|
|
int |
ldyypd, |
|
|
double |
yypd[], |
|
|
int * |
irev |
|
) |
| |
Solution of a system of nonlinear equations by Powell hybrid method (reverse communication version)
- Purpose
- hybrj_r finds a zero of a system of n nonlinear functions in n variables
fi(x1, x2, ..., xn) = 0 (i = 1 to n)
by a modification of the Powell hybrid method.
The user must provide the calculated function values and the Jacobian according to irev.
- Parameters
-
| [in] | n | Number of functions and variables. (n > 0) |
| [in,out] | x[] | Array x[lx] (lx >= n)
[in] An initial estimate of the solution vector.
[out] irev = 0: The obtained solution vector.
irev = 30: The abscissa where the Jacobian shoule be evaluated.
irev = 50, 51: Recent approximation of the solution vector. |
| [out] | fvec[] | Array fvec[lfvec] (lfvec >= n)
irev = 0: The function values evaluated at the solution vector x[].
irev = 50, 51: The function values evaluated at the recent approximation of the solution vector. |
| [in] | xtol | Target relative tolerance. Termination occurs when the relative error between two consecutive iterations is at most xtol. (xtol >= 0) |
| [in] | maxfev | Termination occurs when the number of function evaluations with irev = 1 or 2 has reached this value (maxfev > 0) |
| [in,out] | diag[] | Array diag[ldiag] (ldiag >= n)
[in] If mode = 2, diag[] must contain positive entries that serve as multiplicative scale factors for the variables. (diag[i] > 0)
[out] If mode = 1, diag[] is set by the subroutine. |
| [in] | mode | = 1: The variables will be automatically scaled by the subroutine.
= 2: The scaling is specified by the input diag[].
(For other values, mode = 1 is assumed.) |
| [in] | factor | Used in determining the initial step bound. This bound is set to the product of factor and the euclidean norm of diag*x if nonzero, or else to factor itself. In most cases factor should lie in the interval (0.1, 100). 100 is a generally recommended value. (factor > 0) |
| [in] | nprint | > 0: To return with irev = 50 or 51 at the beginning of the first iteration and every nprint iterations thereafter and at the end of last iteration for printing intermediate result.
<= 0: Not to return for printing intermediate result. |
| [out] | nfev | Number of function evaluations with irev = 1 or 2. |
| [out] | njev | Number of Jacobian evaluation with irev = 30. |
| [out] | work[] | Array work[lwork]
Work array. |
| [in] | lwork | The length of work[]. (lwork >= n*(n + 11)/2) |
| [out] | info | = 0: Successful exit (relative error between two consecutive iterates is at most xtol)
= -1: The argument n had an illegal value (n < 1)
= -4: The argument xtol had an illegal value (xtol < 0)
= -5: The argument maxfev had an illegal value (maxfev <= 0)
= -6: The argument diag had an illegal value (diag[i] <= 0 when mode = 2)
= -8: The argument factor had an illegal value (factor <= 0)
= -13: The argument lwork had an illegal value (lwork too small)
= -17: The argument ldyypd had an illegal value (ldyypd < n)
= 1: Number of function evaluations with irev=1 or 2 has reached maxfev
= 2: xtol is too small. No further improvement in the approximate solution x is possible
= 3: Iteration is not making good progress, as measured by the improvement from the last five Jacobian evaluations
= 4: Iteration is not making good progress, as measured by the improvement from the last ten iterations |
| [out] | xx[] | Array xx[lxx] (lxx >= n)
When returned with irev = 1 or 2, xx[] contains the abscissa where the function value should be evaluated and given in the next call. |
| [in] | yy[] | Array yy[lyy] (lyy >= n)
When returned with irev = 1 or 2, the function value fi(xx[]) (i = 0 to n-1) should be given in yy[] in the next call. |
| [in] | ldyypd | The leading dimension of the array yypd[][]. (ldyypd >= n) |
| [in,out] | yypd[][] | Array yypd[lyypd][ldyypd] (lyypd >= n)
[in] irev = 30: Jacobian(dfi/dxj) at x[] should be given in yypd[][] in the next call.
[out] irev = 0: The orthogonal matrix Q produced by the QR factorization of the final approximate Jacobian |
| [in,out] | irev | Control variable for reverse communication.
[in] Before first call, irev should be initialized to zero. On succeeding calls, irev should not be altered.
[out] If irev is not zero, complete the following process and call this routine again.
= 0: Computation finished. See return code in info.
= 1 or 2: User should set the function values at xx[] in yy[]. Do not alter any variables other than yy[].
= 30: User should set the Jacobian at x[] in yypd[][]. Do not alter any variables other than yypd[][].
= 50 or 51: Display the intermediate result (x[], fvec[], etc.) (in the case of nprint > 0). Do not alter any variables. |
- Reference
- netlib/minpack
|