#include <NonLinearFunction.h>
Base class of a representation of a nonlinear function in the context of the resolution of a nonlinear (system of) equation(s) with the Newton-Raphson method.
In the objective to be very generic, the computations required by the Newton-Raphson are defined inside @BaseNonLinearFunction. For example, a Newton iteration requires to solve a linear equation that can be solved using a linear solver in the case of a system of equations, or by a scalar inversion in the case of a scalar equation. The only required interaction with the outside is the squared norm of the last evaluation.
If r is the nonlinear function, a Newton iteration leads to the following linear equation: J_r (x^{i+1} - x^i) = -r(x^i) where J_r is the Jacobian of r and x^i is the current guess of r at iteration i.
Public Member Functions | |
virtual | ~BaseNonLinearFunction ()=default |
virtual void | startNewtonIteration () |
virtual void | endNewtonIteration () |
virtual void | evaluateCurrentGuess ()=0 |
virtual SReal | squaredNormLastEvaluation ()=0 |
virtual void | computeGradientFromCurrentGuess ()=0 |
virtual void | solveLinearEquation ()=0 |
virtual void | updateGuessFromLinearSolution (SReal alpha)=0 |
virtual SReal | squaredNormDx ()=0 |
virtual SReal | squaredLastEvaluation ()=0 |
|
virtualdefault |
|
pure virtual |
Compute the gradient internally. It is not necessary to share this gradient with the outside
Implemented in sofa::component::odesolver::backward::StaticResidualFunction, and sofa::component::odesolver::backward::ResidualFunction.
|
inlinevirtual |
|
pure virtual |
Evaluation of the function where the input is the current guess. If the function is called for the first time, then it is called on the initial guess. The evaluation is computed internally. It is not necessary to share this evaluation with the outside.
Implemented in sofa::component::odesolver::backward::StaticResidualFunction, and sofa::component::odesolver::backward::ResidualFunction.
|
pure virtual |
Solve the linear equation from a Newton iteration, i.e. it computes (x^{i+1}-x^i). It is solved internally. It is not necessary to share the result with the outside
Implemented in sofa::component::odesolver::backward::StaticResidualFunction, and sofa::component::odesolver::backward::ResidualFunction.
|
pure virtual |
Compute ||x^{i+1}||^2
Implemented in sofa::component::odesolver::backward::StaticResidualFunction, and sofa::component::odesolver::backward::ResidualFunction.
|
pure virtual |
Compute ||x^{i+1}-x^i||^2
Implemented in sofa::component::odesolver::backward::StaticResidualFunction, and sofa::component::odesolver::backward::ResidualFunction.
|
pure virtual |
Returns the squared norm of the last evaluation of the function
Implemented in sofa::component::odesolver::backward::StaticResidualFunction, and sofa::component::odesolver::backward::ResidualFunction.
|
inlinevirtual |
|
pure virtual |
Once (x^{i+1}-x^i) has been computed, the result is used internally to update the current guess. It computes x^{i+1} += alpha * dx, where dx is the result of the linear system. It is not necessary to share the result with the Newton-Raphson method.
Implemented in sofa::component::odesolver::backward::StaticResidualFunction, and sofa::component::odesolver::backward::ResidualFunction.