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
Uusing the Newton method.- Parameters:
operator – The
OperatorA.Amust implement thejacobianinterface method.rhs –
VectorArrayof length 1 containing the vectorV.initial_guess – If not
None, aVectorArrayof length 1 containing an initial guess for the solutionU.mu – The
parameter valuesfor which to solve the equation.range_product – The inner product
Operatoronoperator.rangewith which the norm of the residual is computed. IfNone, the Euclidean inner product is used.source_product – The inner product
Operatoronoperator.sourcewith 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 thearmijoline 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_thresholdduring the laststagnation_windowiterations.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 aVectorArrayof the intermediate approximations ofUafter each iteration.return_residuals – If
True, return aVectorArrayof all residual vectors which have been computed during the Newton iterations.
- Returns:
U –
VectorArrayof length 1 containing the computed solutiondata – Dict containing the following fields:
- solution_norms:
NumPy arrayof the solution norms after each iteration.- update_norms:
NumPy arrayof the norms of the update vectors for each iteration.- residual_norms:
NumPy arrayof the residual norms after each iteration.- stages:
See
return_stages.- residuals:
See
return_residuals.
- Raises:
NewtonError – Raised if the Newton algorithm failed to converge.