naginterfaces.library.roots.sparsys_​func_​easy

naginterfaces.library.roots.sparsys_func_easy(fcn, x, xtol=1.0536712127723509e-08, nnz=None, comm=None, data=None)[source]

sparsys_func_easy is an easy-to-use function that finds a solution of a sparse system of nonlinear equations by a modification of the Powell hybrid method.

For full information please refer to the NAG Library document for c05qs

https://www.nag.com/numeric/nl/nagdoc_29.3/flhtml/c05/c05qsf.html

Parameters
fcncallable fcn(indf, x, fvec, data=None)

must return the values of the functions at a point .

Parameters
indfint, ndarray, shape

Note: this argument represents array indices; the values supplied will be base-1.

specifies the indices for which values of must be computed. The indices are specified in strictly ascending order.

xfloat, ndarray, shape

The components of the point at which the functions must be evaluated. contains the coordinate .

fvecfloat, ndarray, shape , to be modified in place

On exit: must contain the function values , for all indices in .

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

xfloat, array-like, shape

An initial guess at the solution vector. must contain the coordinate .

xtolfloat, optional

The accuracy in to which the solution is required.

nnzNone or int, optional

Note: if this argument is None then a default value will be used, determined as follows: .

If supplied should be an upper estimate of the number of nonzero entries found in the Jacobian.

The size of the data that is self communicated to this routine via is a function of .

A suitable overestimate for is , but this may be suboptimal when is large.

If an existing sparsity pattern for the problem is communicated via , will be ignored.

The value that was supplied in the call to sparsys_func_easy which computed that sparsity pattern will be extracted from and used instead.

commNone or dict, communication object, optional, modified in place

Optionally, on entry: an existing sparsity pattern for the Jacobian, computed by a subsequent call. Otherwise, supplying an uninitialized object indicates it is the first time sparsys_func_easy is called for this specific problem.

On exit, if not None on entry: will be populated with the sparsity pattern of the Jacobian. On subsequent calls, the same communication object can be passed in again if the problem has a Jacobian of the same sparsity pattern.

dataarbitrary, optional

User-communication data for callback functions.

Returns
xfloat, ndarray, shape

The final estimate of the solution vector.

fvecfloat, ndarray, shape

The function values at the final point returned in . contains the function values .

actual_nnzint

The number of nonzero entries found in the Jacobian.

Raises
NagValueError
(errno )

On entry, the supplied was too small for this problem.

(errno )

On entry, the supplied was too small for this problem.

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

There have been at least calls to . Consider restarting the calculation from the point held in and supplying the populated sparsity pattern from .

(errno )

No further improvement in the solution is possible. is too small: .

(errno )

The iteration is not making good progress. This failure exit may indicate that the system does not have a zero, or that the solution is very close to the origin (see Accuracy). Otherwise, rerunning sparsys_func_easy from a different starting point may avoid the region of difficulty. The condition number of the Jacobian is .

NagCallbackTerminateWarning
(errno )

Termination requested in .

Notes

The system of equations is defined as:

sparsys_func_easy is based on the MINPACK routine HYBRD1 (see Moré et al. (1980)). It chooses the correction at each step as a convex combination of the Newton and scaled gradient directions. The Jacobian is updated by the sparse rank-1 method of Schubert (see Schubert (1970)). At the starting point, the sparsity pattern is determined and the Jacobian is approximated by forward differences, but these are not used again until the rank-1 method fails to produce satisfactory progress. Then, the sparsity structure is used to recompute an approximation to the Jacobian by forward differences with the least number of function evaluations. The function you supply must be able to compute only the requested subset of the function values. The sparse Jacobian linear system is solved at each iteration with sparse.direct_real_gen_lu computing the Newton step. For more details see Powell (1970) and Broyden (1965).

References

Broyden, C G, 1965, A class of methods for solving nonlinear simultaneous equations, Mathematics of Computation (19(92)), 577–593

Moré, J J, Garbow, B S and Hillstrom, K E, 1980, User guide for MINPACK-1, Technical Report ANL-80-74, Argonne National Laboratory

Powell, M J D, 1970, A hybrid method for nonlinear algebraic equations, Numerical Methods for Nonlinear Algebraic Equations, (ed P Rabinowitz), Gordon and Breach

Schubert, L K, 1970, Modification of a quasi-Newton method for nonlinear equations with a sparse Jacobian, Mathematics of Computation (24(109)), 27–30