pymor.algorithms.newton
¶
Module Contents¶
- pymor.algorithms.newton.newton(operator, rhs, initial_guess=None, mu=None, range_product=None, source_product=None, least_squares=False, miniter=0, maxiter=100, atol=0.0, rtol=1e-07, relax='armijo', line_search_params=None, stagnation_window=3, stagnation_threshold=np.inf, error_measure='update', return_stages=False, return_residuals=False)[source]¶
Newton algorithm.
This method solves the nonlinear equation
A(U, mu) = V
for
U
using the Newton method.Parameters
- operator
The
Operator
A
.A
must implement thejacobian
interface method.- rhs
VectorArray
of length 1 containing the vectorV
.- initial_guess
If not
None
, aVectorArray
of length 1 containing an initial guess for the solutionU
.- mu
The
parameter values
for which to solve the equation.- range_product
The inner product
Operator
onoperator.range
with which the norm of the residual is computed. IfNone
, the Euclidean inner product is used.- source_product
The inner product
Operator
onoperator.source
with which the norm of the solution and update vectors is computed. IfNone
, the Euclidean inner product is used.- least_squares
If
True
, use a least squares linear solver (e.g. for residual minimization).- miniter
Minimum amount of iterations to perform.
- maxiter
Fail if the iteration count reaches this value without converging.
- atol
Finish when the error measure is below this threshold.
- rtol
Finish when the error measure has been reduced by this factor relative to the norm of the initial residual resp. the norm of the current solution.
- relax
If real valued, relaxation factor for Newton updates; otherwise
'armijo'
to indicate that thearmijo
line search algorithm shall be used.- line_search_params
Dictionary of additional parameters passed to the line search method.
- stagnation_window
Finish when the error measure has not been reduced by a factor of
stagnation_threshold
during the laststagnation_window
iterations.- stagnation_threshold
See
stagnation_window
.- error_measure
If
'residual'
, convergence depends on the norm of the residual. If'update'
, convergence depends on the norm of the update vector.- return_stages
If
True
, return aVectorArray
of the intermediate approximations ofU
after each iteration.- return_residuals
If
True
, return aVectorArray
of all residual vectors which have been computed during the Newton iterations.
Returns
- U
VectorArray
of length 1 containing the computed solution- data
Dict containing the following fields:
- solution_norms:
NumPy array
of the solution norms after each iteration.- update_norms:
NumPy array
of the norms of the update vectors for each iteration.- residual_norms:
NumPy array
of the residual norms after each iteration.- stages:
See
return_stages
.- residuals:
See
return_residuals
.
Raises
- NewtonError
Raised if the Newton algorithm failed to converge.