version 0.4.1
Ikarus::NewtonRaphson< NLO, 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< NLO, LS, UF >:
[legend]

Public Types

using Settings = NRSettings
 Compile-time boolean indicating if the linear solver satisfies the non-linear solver concept. More...
 
using ValueType = typename NLO::template ParameterValue< 0 >
 
using UpdateFunction = UF
 Type representing the update function. More...
 
using NonLinearOperator = NLO
 Type of the non-linear operator. More...
 

Public Member Functions

template<typename LS2 = LS, typename UF2 = UF>
 NewtonRaphson (const NonLinearOperator &nonLinearOperator, LS2 &&linearSolver={}, UF2 &&updateFunction={})
 Constructor for NewtonRaphson. More...
 
void setup (const Settings &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 NonLinearOperator::ValueType>>
Ikarus::NonLinearSolverInformation solve (const SolutionType &dxPredictor=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...
 
void notify (MT message)
 
void notify (MT message, ScalarType val)
 
void notify (MT message, int val)
 
void notify (MT message, const std::string &val)
 
void notify (MT message, int val1, double val2)
 
void notify (MT message, int val1, const std::string &val2)
 
void notify (MT message, Eigen::VectorX< ScalarType > vec)
 

Static Public Attributes

static constexpr bool isLinearSolver
 Type representing the parameter vector of the nonlinear operator. More...
 

Detailed Description

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

Member Typedef Documentation

◆ NonLinearOperator

template<typename NLO , typename LS , typename UF >
using Ikarus::NewtonRaphson< NLO, LS, UF >::NonLinearOperator = NLO

◆ Settings

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

◆ UpdateFunction

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

◆ ValueType

template<typename NLO , typename LS , typename UF >
using Ikarus::NewtonRaphson< NLO, LS, UF >::ValueType = typename NLO::template ParameterValue<0>

Constructor & Destructor Documentation

◆ NewtonRaphson()

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

Member Function Documentation

◆ nonLinearOperator()

template<typename NLO , typename LS , typename UF >
auto & Ikarus::NewtonRaphson< NLO, LS, UF >::nonLinearOperator ( )
inline
Returns
Reference to the nonlinear operator.

◆ notify() [1/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message)
inherited

◆ notify() [2/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
const std::string &  val 
)
inherited

◆ notify() [3/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
Eigen::VectorX< ScalarType >  vec 
)
inherited

◆ notify() [4/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
int  val 
)
inherited

◆ notify() [5/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
int  val1,
const std::string &  val2 
)
inherited

◆ notify() [6/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
int  val1,
double  val2 
)
inherited

◆ notify() [7/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
ScalarType  val 
)
inherited

◆ notify() [8/14]

Parameters
messageThe message type to notify about.

◆ notify() [9/14]

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() [10/14]

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() [11/14]

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() [12/14]

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() [13/14]

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() [14/14]

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 NLO , typename LS , typename UF >
void Ikarus::NewtonRaphson< NLO, LS, UF >::setup ( const Settings settings)
inline
Parameters
settingsNewton-Raphson settings.

◆ solve()

template<typename NLO , typename LS , typename UF >
template<typename SolutionType = NoPredictor>
requires std::is_same_v<SolutionType, NoPredictor> || std::is_convertible_v<SolutionType, std::remove_cvref_t<typename NonLinearOperator::ValueType>>
Ikarus::NonLinearSolverInformation Ikarus::NewtonRaphson< NLO, LS, UF >::solve ( const SolutionType &  dxPredictor = NoPredictor{})
inline
Parameters
dxPredictorPredictor for the solution increment (default is NoPredictor).
Returns
Information about the solution process.

◆ subscribe()

void Ikarus::IObservable< MT >::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< MT >::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< MT >::unSubscribeAll ( std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer)
inherited
Parameters
observerThe observer to be unsubscribed.

Member Data Documentation

◆ isLinearSolver

template<typename NLO , typename LS , typename UF >
constexpr bool Ikarus::NewtonRaphson< NLO, LS, UF >::isLinearSolver
staticconstexpr
Initial value:
=
Concept to check if a linear solver implements all the needed functions for given vector and matrix t...
Definition: concepts.hh:215

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