optimize._spectral

Spectral Algorithm for Nonlinear Equations

Module Contents

Classes

_NoConvergence()

Functions

_root_df_sane(func,x0,args=tuple,ftol=1e-08,fatol=1e-300,maxfev=1000,fnorm=None,callback=None,disp=False,M=10,eta_strategy=None,sigma_eps=1e-10,sigma_0=1.0,line_search=”cruz”,**unknown_options) r
_wrap_func(func,x0,fmerit,nfev_list,maxfev,args=tuple) Wrap a function and an initial value so that (i) complex values
_wrap_result(result,is_complex,shape=None) Convert from real to complex and reshape result arrays.
_real2complex(x)
_complex2real(z)
class _NoConvergence
_root_df_sane(func, x0, args=tuple, ftol=1e-08, fatol=1e-300, maxfev=1000, fnorm=None, callback=None, disp=False, M=10, eta_strategy=None, sigma_eps=1e-10, sigma_0=1.0, line_search="cruz", **unknown_options)

r Solve nonlinear equation with the DF-SANE method

ftol : float, optional
Relative norm tolerance.
fatol : float, optional
Absolute norm tolerance. Algorithm terminates when ||func(x)|| < fatol + ftol ||func(x_0)||.
fnorm : callable, optional
Norm to use in the convergence check. If None, 2-norm is used.
maxfev : int, optional
Maximum number of function evaluations.
disp : bool, optional
Whether to print convergence process to stdout.
eta_strategy : callable, optional
Choice of the eta_k parameter, which gives slack for growth of ||F||**2. Called as eta_k = eta_strategy(k, x, F) with k the iteration number, x the current iterate and F the current residual. Should satisfy eta_k > 0 and sum(eta, k=0..inf) < inf. Default: ||F||**2 / (1 + k)**2.
sigma_eps : float, optional
The spectral coefficient is constrained to sigma_eps < sigma < 1/sigma_eps. Default: 1e-10
sigma_0 : float, optional
Initial spectral coefficient. Default: 1.0
M : int, optional
Number of iterates to include in the nonmonotonic line search. Default: 10
line_search : {‘cruz’, ‘cheng’}
Type of line search to employ. ‘cruz’ is the original one defined in [Martinez & Raydan. Math. Comp. 75, 1429 (2006)], ‘cheng’ is a modified search defined in [Cheng & Li. IMA J. Numer. Anal. 29, 814 (2009)]. Default: ‘cruz’
[1]“Spectral residual method without gradient information for solving large-scale nonlinear systems of equations.” W. La Cruz, J.M. Martinez, M. Raydan. Math. Comp. 75, 1429 (2006).
[2]
  1. La Cruz, Opt. Meth. Software, 29, 24 (2014).
[3]
  1. Cheng, D.-H. Li. IMA J. Numer. Anal. 29, 814 (2009).
_wrap_func(func, x0, fmerit, nfev_list, maxfev, args=tuple)

Wrap a function and an initial value so that (i) complex values are wrapped to reals, and (ii) value for a merit function fmerit(x, f) is computed at the same time, (iii) iteration count is maintained and an exception is raised if it is exceeded.

func : callable
Function to wrap
x0 : ndarray
Initial value
fmerit : callable
Merit function fmerit(f) for computing merit value from residual.
nfev_list : list
List to store number of evaluations in. Should be [0] in the beginning.
maxfev : int
Maximum number of evaluations before _NoConvergence is raised.
args : tuple
Extra arguments to func
wrap_func : callable
Wrapped function, to be called as F, fp = wrap_func(x0)
x0_wrap : ndarray of float
Wrapped initial value; raveled to 1D and complex values mapped to reals.
x0_shape : tuple
Shape of the initial value array
f : float
Merit function at F
F : ndarray of float
Residual at x0_wrap
is_complex : bool
Whether complex values were mapped to reals
_wrap_result(result, is_complex, shape=None)

Convert from real to complex and reshape result arrays.

_real2complex(x)
_complex2real(z)