version 0.4.4
Ikarus::NewtonRaphson< F, LS, UF > Class Template Reference

Implementation of the Newton-Raphson method for solving nonlinear equations. More...

#include <ikarus/solver/nonlinearsolver/newtonraphson.hh>

Inheritance diagram for Ikarus::NewtonRaphson< F, LS, UF >:
[legend]

Public Types

using Settings = NRSettings
 
using SignatureTraits = typename F::Traits
 
using CorrectionType = typename SignatureTraits::template Range< 0 >
 Type of the correction of x += deltaX. More...
 
using JacobianType = typename SignatureTraits::template Range< 1 >
 Compile-time boolean indicating if the linear solver satisfies the non-linear solver concept. More...
 
using Domain = typename SignatureTraits::Domain
 Type representing the parameter vector of the function. More...
 
using UpdateFunction = UF
 Type representing the update function. More...
 
using DifferentiableFunction = F
 Type of the non-linear operator. More...
 
using State = NonlinearSolverStateType< F >
 
using MessageType = NonLinearSolverMessages
 
using Callback = std::function< void(NonLinearSolverMessages, const State &)>
 
using Token = std::shared_ptr< Callback >
 

Public Member Functions

template<typename LS2 = LS, typename UF2 = UF>
 NewtonRaphson (const DifferentiableFunction &residual, LS2 &&linearSolver={}, UF2 &&updateFunction={})
 Constructor for NewtonRaphson. More...
 
void setup (const Settings &settings)
 Set up the solver with the given settings. More...
 
NonLinearSolverInformation solve (Domain &x)
 Solve the nonlinear system. More...
 
auto & residual ()
 Access the function. More...
 
Token registerListener (Callback callback)
 This method is used to register a Listener function. More...
 
void unregisterListener (Token token)
 deregisters a specific function More...
 
void notify (NonLinearSolverMessages message, const State &data)
 This calls all the registered functions. More...
 

Static Public Attributes

static constexpr bool isLinearSolver = Ikarus::Concepts::LinearSolverCheck<LS, JacobianType, CorrectionType>
 

Detailed Description

template<typename F, typename LS, typename UF>
class Ikarus::NewtonRaphson< F, LS, UF >
Template Parameters
FType of the differentiable function to solve.
LSType of the linear solver used internally (default is SolverDefault).
UFType of the update function (default is UpdateDefault).

Member Typedef Documentation

◆ Callback

using Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::Callback = std::function<void(NonLinearSolverMessages , const State&)>
inherited

◆ CorrectionType

template<typename F , typename LS , typename UF >
using Ikarus::NewtonRaphson< F, LS, UF >::CorrectionType = typename SignatureTraits::template Range<0>

◆ DifferentiableFunction

template<typename F , typename LS , typename UF >
using Ikarus::NewtonRaphson< F, LS, UF >::DifferentiableFunction = F

◆ Domain

template<typename F , typename LS , typename UF >
using Ikarus::NewtonRaphson< F, LS, UF >::Domain = typename SignatureTraits::Domain

◆ JacobianType

template<typename F , typename LS , typename UF >
using Ikarus::NewtonRaphson< F, LS, UF >::JacobianType = typename SignatureTraits::template Range<1>

◆ MessageType

◆ Settings

template<typename F , typename LS , typename UF >
using Ikarus::NewtonRaphson< F, LS, UF >::Settings = NRSettings

◆ SignatureTraits

template<typename F , typename LS , typename UF >
using Ikarus::NewtonRaphson< F, LS, UF >::SignatureTraits = typename F::Traits

◆ State

using Ikarus::NonlinearSolverBase< F, Args >::State = NonlinearSolverStateType<F>
inherited

◆ Token

using Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::Token = std::shared_ptr<Callback>
inherited

◆ UpdateFunction

template<typename F , typename LS , typename UF >
using Ikarus::NewtonRaphson< F, LS, UF >::UpdateFunction = UF

Constructor & Destructor Documentation

◆ NewtonRaphson()

template<typename F , typename LS , typename UF >
template<typename LS2 = LS, typename UF2 = UF>
Ikarus::NewtonRaphson< F, LS, UF >::NewtonRaphson ( const DifferentiableFunction residual,
LS2 &&  linearSolver = {},
UF2 &&  updateFunction = {} 
)
inlineexplicit
Parameters
residualresidual to solve.
linearSolverLinear solver used internally (default is SolverDefault).
updateFunctionUpdate function (default is UpdateDefault).

Member Function Documentation

◆ notify()

void Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::notify ( NonLinearSolverMessages  message,
const State data 
)
inlineinherited

◆ registerListener()

Token Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::registerListener ( Callback  callback)
inlineinherited

The function that is passed in is first stored in a shared_ptr. After this, the shared_ptr is added to the vector of listener functions, which leads to a implicit conversion to a weak_ptr. The shared_ptr is then returned to the Listener that has called this function to be stored in a vector of shared_ptr<void> listener.hh.

Parameters
callbackthe callback function
Returns
Token

◆ residual()

template<typename F , typename LS , typename UF >
auto & Ikarus::NewtonRaphson< F, LS, UF >::residual ( )
inline
Returns
Reference to the function.

◆ setup()

template<typename F , typename LS , typename UF >
void Ikarus::NewtonRaphson< F, LS, UF >::setup ( const Settings settings)
inline
Parameters
settingsNewton-Raphson settings.

◆ solve()

template<typename F , typename LS , typename UF >
NonLinearSolverInformation Ikarus::NewtonRaphson< F, LS, UF >::solve ( Domain x)
inline
Parameters
xWhere the solution should be stored.
Returns
Information about the solution process.

◆ unregisterListener()

void Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::unregisterListener ( Token  token)
inlineinherited

Member Data Documentation

◆ isLinearSolver

template<typename F , typename LS , typename UF >
constexpr bool Ikarus::NewtonRaphson< F, LS, UF >::isLinearSolver = Ikarus::Concepts::LinearSolverCheck<LS, JacobianType, CorrectionType>
staticconstexpr

The documentation for this class was generated from the following file: