XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ hybrd1_r()

void hybrd1_r ( int  n,
double  x[],
double  fvec[],
double  xtol,
double  work[],
int  lwork,
int *  info,
double  xx[],
double  yy[],
int *  irev 
)

Solution of a system of nonlinear equations by Powell hybrid method (Jacobian not required) (simple driver) (reverse communication version)

Purpose
hybrd1_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 a subroutine which calculates the functions. Since the Jacobian is calculated by a forward difference approximation within the routine, the user is not required to provide the Jacobian.

hybrd1_r is the simple driver for standard use, which calls the hybrd_r with default parameters.
Parameters
[in]nNumber of functions and variables. (n > 0)
[in,out]x[]Array x[lx] (lx >= n)
[in] An initial estimate of the solution vector.
[out] The obtained solution vector.
[out]fvec[]Array fvec[lfvec] (lfvec >= n)
The function values evaluated at the solution vector x[].
[in]xtolTarget relative tolerance. Termination occurs when the relative error between two consecutive iterations is at most xtol. (xtol >= 0)
[out]work[]Array work[lwork]
Work array.
[in]lworkThe length of work[]. (lwork >= n*(3*n + 13)/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)
= -6: The argument lwork had an illegal value (lwork too small)
= 1: Number of function evaluations with irev = 1 to 4 has reached the limit (200*(n + 1))
= 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 to 4, 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 to 4, the function value fi(xx[]) (i = 1 to n) should be given in yy[] in the next call.
[in,out]irevControl 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 to 4: User should set the function values at xx[] in yy[]. Do not alter any variables other than yy[].
Reference
netlib/minpack