naginterfaces.library.roots.sys_func_aa_rcomm¶
- naginterfaces.library.roots.sys_func_aa_rcomm(irevcm, x, fvec, comm, atol=1.0536712127723509e-08, rtol=1.0536712127723509e-08, m=0, cndtol=0.0, astart=0)[source]¶
sys_func_aa_rcomm
is a comprehensive reverse communication function that finds a solution of a system of nonlinear equations by fixed-point iteration using Anderson acceleration.For full information please refer to the NAG Library document for c05md
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/c05/c05mdf.html
- Parameters
- irevcmint
On initial entry: must have the value .
- xfloat, ndarray, shape , modified in place
On initial entry: an initial guess at the solution vector, .
On intermediate exit: contains the current point.
On final exit: the final estimate of the solution vector.
- fvecfloat, ndarray, shape , modified in place
On initial entry: need not be set.
On intermediate entry: if , must not be changed.
If , must be set to the values of the functions computed at the current point , .
On final exit: the function values at the final point, .
- commdict, communication object, modified in place
Communication structure.
On initial entry: need not be set.
- atolfloat, optional
On initial entry: the absolute convergence criterion; see .
- rtolfloat, optional
On initial entry: the relative convergence criterion. At each iteration is computed. The iteration is deemed to have converged if .
- mint, optional
On initial entry: , the number of previous iterates to use in Anderson acceleration. If , Anderson acceleration is not used.
- cndtolfloat, optional
On initial entry: the maximum allowable condition number for the triangular factor generated during Anderson acceleration. At each iteration, if the condition number exceeds , columns are deleted until it is sufficiently small.
If , no condition number tests are performed.
- astartint, optional
On initial entry: the number of iterations by which to delay the start of Anderson acceleration.
- Returns
- irevcmint
On intermediate exit: specifies what action you must take before re-entering
sys_func_aa_rcomm
with set to this value. The value of should be interpreted as follows:Indicates the start of a new iteration. No action is required by you, but and are available for printing, and a limit on the number of iterations can be applied.
Indicates that before re-entry to
sys_func_aa_rcomm
, must contain the function values .On final exit: and the algorithm has terminated.
- Raises
- NagValueError
- (errno )
On initial entry, .
Constraint: .
- (errno )
On intermediate entry, .
Constraint: or .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
An error occurred in evaluating the decomposition during Anderson acceleration. This may be due to slow convergence of the iteration. Try setting the value of . If condition number tests are already performed, try decreasing .
- (errno )
The iteration is not making good progress, as measured by the reduction in the norm of in the last iterations.
- (errno )
The iteration has diverged and subsequent iterates are too large to be computed in floating-point arithmetic.
- Notes
The system of equations is defined as:
This homogeneous system can readily be reformulated as
A standard fixed-point iteration approach is to start with an approximate solution and repeatedly apply the function until possible convergence; i.e., , until . Anderson acceleration uses up to previous values of to obtain an improved estimate . If a standard fixed-point iteration converges, then Anderson acceleration usually results in convergence in far fewer iterations (and, therefore, using far fewer function evaluations).
Full details of Anderson acceleration are provided in Anderson (1965). In summary, the previous iterates are combined to form a succession of least squares problems. These are solved using a decomposition, which is updated at each iteration.
You are free to choose any value for , provided . A typical choice is .
Anderson acceleration is particularly useful if evaluating is very expensive, in which case functions such as
sys_deriv_rcomm()
orsys_func_rcomm()
, which require the Jacobian or its approximation, may perform poorly.
- References
Anderson, D G, 1965, Iterative Procedures for Nonlinear Integral Equations, J. Assoc. Comput. Mach. (12), 547–560