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

◆ optif0()

void optif0 ( int  n,
double  x[],
void(*)(int, double *, double *)  fcn,
double  xpls[],
double *  fpls,
double  work[],
int  lwork,
int *  info 
)

Minimum of a multivariable nonlinear function (quasi-Newton method) (simple driver)

Purpose
optif0 finds the local minimum point (xs1, xs2, ..., xsn) of general nonlinear function f(x1, x2, ..., xn) (a twice continuously differentiable real-valued function).

The first order finite difference is used to compute the gradients, and the secant method (BFGS update) is used to compute the Hessian. The steps are computed by the line search.

optif0 is equivalent to using optif9 with setting default parameters. So that the problem is solved by the quasi-Newton method (BFGS method).
Parameters
[in]nThe order or dimension of the problem. (n > 1)
[in]x[]Array x[lx] (lx >= n)
Initial approximation of the solution vector.
[in]fcnThe user supplied subroutine which calculates the function f(x1, x2, ..., xn) defined as follows.
void fcn(int n, double x[], double *fval)
{
*fval = calculated function value from given n and x[]
}
The other variables than fval should not be altered.
[out]xpls[]Array xpls[lxpls] (lxpls >= n)
Local minimum.
[out]fplsFunction value at local minimum xpls.
[out]work[]Array work[lwork]
Work area.
If info = 0, sub-code will be returned in work[0].
= 1: Relative gradient is close to zero.
= 2: Successive iterates within tolerance.
[in]lworkThe length of work[]. (lwork >= n*(n + 11))
[out]info= 0: Successful exit (see sub-code in work[0])
= -1: The argument n had an illegal value (n <= 1)
= -7: The argument lwork had an illegal value (lwork < n*(n + 11))
= 1: Last global step failed to locate a point lower than xpls. Either xpls is an approximate local minimum of the function, the function is too nonlinear for this algorithm, or steptl is too large.
= 2: Iteration limit (200) exceeded
= 3: Maximum step size stepmx exceeded five consecutive times. Either the function is unbounded below, becomes asymptotic to a finite value from above in some direction, or stepmx is too small.
Reference
CMLIB