version 0.4
Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl > 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< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >:
[legend]

Public Types

using ValueType = typename NonLinearOperatorImpl::template ParameterValue< 0 >
 
using UpdateFunctionType = UpdateFunctionTypeImpl
 Type representing the update function. More...
 
using NonLinearOperator = NonLinearOperatorImpl
 Type of the non-linear operator. More...
 

Public Member Functions

 NewtonRaphson (const NonLinearOperatorImpl &p_nonLinearOperator, LinearSolver &&p_linearSolver={}, UpdateFunctionTypeImpl p_updateFunction={})
 Constructor for NewtonRaphson. More...
 
void setup (const NewtonRaphsonSettings &p_settings)
 Set up the solver with the given settings. More...
 
template<typename SolutionType = NoPredictor>
requires std::is_same_v<SolutionType, NoPredictor> || std::is_convertible_v< SolutionType, std::remove_cvref_t<typename NonLinearOperatorImpl::ValueType>>
Ikarus::NonLinearSolverInformation solve (const SolutionType &dx_predictor=NoPredictor{})
 Solve the nonlinear system. More...
 
auto & nonLinearOperator ()
 Access the nonlinear operator. More...
 
void subscribe (NonLinearSolverMessages message, std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Subscribe an observer to receive notifications for a specific message type. More...
 
void subscribeAll (std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Subscribe an observer to receive notifications for all message types. More...
 
void subscribeAll (std::initializer_list< std::shared_ptr< IObserver< NonLinearSolverMessages > > > observers)
 Subscribe multiple observers to receive notifications for all message types. More...
 
void unSubscribe (NonLinearSolverMessages message, std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Unsubscribe an observer from receiving notifications for a specific message type. More...
 
void unSubscribeAll (std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Unsubscribe an observer from receiving notifications for all message types. More...
 
void notify (NonLinearSolverMessages message)
 Notify observers about a specific message type. More...
 
void notify (NonLinearSolverMessages message, ScalarType val)
 Notify observers about a specific message type with a floating-point value. More...
 
void notify (NonLinearSolverMessages message, int val)
 Notify observers about a specific message type with an integer value. More...
 
void notify (NonLinearSolverMessages message, const std::string &val)
 Notify observers about a specific message type with a string value. More...
 
void notify (NonLinearSolverMessages message, int val1, double val2)
 Notify observers about a specific message type with an integer and a double value. More...
 
void notify (NonLinearSolverMessages message, int val1, const std::string &val2)
 Notify observers about a specific message type with an integer value and a string value. More...
 
void notify (NonLinearSolverMessages message, Eigen::VectorX< ScalarType > vec)
 Notify observers about a specific message type with an Eigen::VectorX. More...
 

Static Public Attributes

static constexpr bool isLinearSolver
 < Compile-time boolean indicating if the linear solver satisfies the non-linear solver concept More...
 

Detailed Description

template<typename NonLinearOperatorImpl, typename LinearSolver = utils::SolverDefault, typename UpdateFunctionTypeImpl = utils::UpdateDefault>
class Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >
Template Parameters
NonLinearOperatorImplType of the nonlinear operator to solve.
LinearSolverType of the linear solver used internally (default is SolverDefault).
UpdateFunctionTypeImplType of the update function (default is UpdateDefault).

Member Typedef Documentation

◆ NonLinearOperator

template<typename NonLinearOperatorImpl , typename LinearSolver = utils::SolverDefault, typename UpdateFunctionTypeImpl = utils::UpdateDefault>
using Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >::NonLinearOperator = NonLinearOperatorImpl

◆ UpdateFunctionType

template<typename NonLinearOperatorImpl , typename LinearSolver = utils::SolverDefault, typename UpdateFunctionTypeImpl = utils::UpdateDefault>
using Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >::UpdateFunctionType = UpdateFunctionTypeImpl

◆ ValueType

template<typename NonLinearOperatorImpl , typename LinearSolver = utils::SolverDefault, typename UpdateFunctionTypeImpl = utils::UpdateDefault>
using Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >::ValueType = typename NonLinearOperatorImpl::template ParameterValue<0>

Constructor & Destructor Documentation

◆ NewtonRaphson()

template<typename NonLinearOperatorImpl , typename LinearSolver = utils::SolverDefault, typename UpdateFunctionTypeImpl = utils::UpdateDefault>
Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >::NewtonRaphson ( const NonLinearOperatorImpl &  p_nonLinearOperator,
LinearSolver &&  p_linearSolver = {},
UpdateFunctionTypeImpl  p_updateFunction = {} 
)
inlineexplicit
Parameters
p_nonLinearOperatorNonlinear operator to solve.
p_linearSolverLinear solver used internally (default is SolverDefault).
p_updateFunctionUpdate function (default is UpdateDefault).

Member Function Documentation

◆ nonLinearOperator()

template<typename NonLinearOperatorImpl , typename LinearSolver = utils::SolverDefault, typename UpdateFunctionTypeImpl = utils::UpdateDefault>
auto & Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >::nonLinearOperator ( )
inline
Returns
Reference to the nonlinear operator.

◆ notify() [1/7]

Parameters
messageThe message type to notify about.

◆ notify() [2/7]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
const std::string &  val 
)
inherited
Parameters
messageThe message type to notify about.
valThe string value to be sent with the notification.

◆ notify() [3/7]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
Eigen::VectorX< ScalarType >  vec 
)
inherited
Template Parameters
ScalarTypeThe type of the elements in the Eigen::VectorX.
Parameters
messageThe message type to notify about.
vecThe Eigen::VectorX to be sent with the notification.

◆ notify() [4/7]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
int  val 
)
inherited
Parameters
messageThe message type to notify about.
valThe integer value to be sent with the notification.

◆ notify() [5/7]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
int  val1,
const std::string &  val2 
)
inherited
Parameters
messageThe message type to notify about.
val1The integer value to be sent with the notification.
val2The string value to be sent with the notification.

◆ notify() [6/7]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
int  val1,
double  val2 
)
inherited
Parameters
messageThe message type to notify about.
val1The integer value to be sent with the notification.
val2The double value to be sent with the notification.

◆ notify() [7/7]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
ScalarType  val 
)
inherited
Template Parameters
ScalarTypeThe type of the floating-point value.
Parameters
messageThe message type to notify about.
valThe floating-point value to be sent with the notification.

◆ setup()

template<typename NonLinearOperatorImpl , typename LinearSolver = utils::SolverDefault, typename UpdateFunctionTypeImpl = utils::UpdateDefault>
void Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >::setup ( const NewtonRaphsonSettings p_settings)
inline
Parameters
p_settingsNewton-Raphson settings.

◆ solve()

template<typename NonLinearOperatorImpl , typename LinearSolver = utils::SolverDefault, typename UpdateFunctionTypeImpl = utils::UpdateDefault>
template<typename SolutionType = NoPredictor>
requires std::is_same_v<SolutionType, NoPredictor> || std::is_convertible_v< SolutionType, std::remove_cvref_t<typename NonLinearOperatorImpl::ValueType>>
Ikarus::NonLinearSolverInformation Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >::solve ( const SolutionType &  dx_predictor = NoPredictor{})
inline
Parameters
dx_predictorPredictor for the solution increment (default is NoPredictor).
Returns
Information about the solution process.

◆ subscribe()

void Ikarus::IObservable< NonLinearSolverMessages >::subscribe ( NonLinearSolverMessages  message,
std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer 
)
inherited
Parameters
messageThe message type to subscribe to.
observerThe observer to be subscribed.

◆ subscribeAll() [1/2]

void Ikarus::IObservable< NonLinearSolverMessages >::subscribeAll ( std::initializer_list< std::shared_ptr< IObserver< NonLinearSolverMessages > > >  observers)
inherited
Parameters
observersList of observers to be subscribed.

◆ subscribeAll() [2/2]

void Ikarus::IObservable< NonLinearSolverMessages >::subscribeAll ( std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer)
inherited
Parameters
observerThe observer to be subscribed.

◆ unSubscribe()

void Ikarus::IObservable< NonLinearSolverMessages >::unSubscribe ( NonLinearSolverMessages  message,
std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer 
)
inherited
Parameters
messageThe message type to unsubscribe from.
observerThe observer to be unsubscribed.

◆ unSubscribeAll()

void Ikarus::IObservable< NonLinearSolverMessages >::unSubscribeAll ( std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer)
inherited
Parameters
observerThe observer to be unsubscribed.

Member Data Documentation

◆ isLinearSolver

template<typename NonLinearOperatorImpl , typename LinearSolver = utils::SolverDefault, typename UpdateFunctionTypeImpl = utils::UpdateDefault>
constexpr bool Ikarus::NewtonRaphson< NonLinearOperatorImpl, LinearSolver, UpdateFunctionTypeImpl >::isLinearSolver
staticconstexpr
Initial value:
= Ikarus::Concepts::LinearSolverCheck<LinearSolver, typename NonLinearOperatorImpl::DerivativeType,
typename NonLinearOperatorImpl::ValueType>
LinearSolverTemplate< double > LinearSolver
Definition: linearsolver.hh:234
Concept to check if a linear solver implements all the needed functions for given vector and matrix t...
Definition: concepts.hh:218

Type representing the parameter vector of the nonlinear operator.


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