numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class of Newton-Raphson method. More...
#include <num_collect/roots/newton_raphson.h>
Public Types | |
using | base_type |
Type of base class. | |
using | jacobian_solver_type |
Type of solvers of Jacobian matrices. | |
using | jacobian_type = typename function_type::jacobian_type |
Type of Jacobian matrices. | |
using | scalar_type = typename variable_type::Scalar |
Type of scalars in variables. | |
using | this_type = newton_raphson<Function> |
Type of this object. | |
Public Types inherited from num_collect::roots::function_root_finder_base< newton_raphson< Function >, Function > | |
using | function_type |
Type of function of equation. | |
using | variable_type |
Type of variables. | |
Public Member Functions | |
newton_raphson (const function_type &function=function_type()) | |
Constructor. | |
newton_raphson (const function_type &function=function_type()) | |
Constructor. | |
void | configure_iteration_logger (logging::iterations::iteration_logger< this_type > &iteration_logger) const |
Configure an iteration logger. | |
void | configure_iteration_logger (logging::iterations::iteration_logger< this_type > &iteration_logger) const |
Configure an iteration logger. | |
auto | evaluations () const noexcept -> index_type |
Get the number of function evaluations. | |
auto | evaluations () const noexcept -> index_type |
Get the number of function evaluations. | |
void | init (const variable_type &variable) |
Initialize. | |
void | init (const variable_type &variable) |
Initialize. | |
auto | is_stop_criteria_satisfied () const -> bool |
Determine if stopping criteria of the algorithm are satisfied. | |
auto | is_stop_criteria_satisfied () const -> bool |
Determine if stopping criteria of the algorithm are satisfied. | |
void | iterate () |
Iterate the algorithm once. | |
void | iterate () |
Iterate the algorithm once. | |
auto | iterations () const noexcept -> index_type |
Get the number of iterations. | |
auto | iterations () const noexcept -> index_type |
Get the number of iterations. | |
auto | jacobian () const -> std::invoke_result_t< decltype(&function_type::jacobian), const function_type > |
Get Jacobian matrix. | |
auto | jacobian () const -> std::invoke_result_t< decltype(&function_type::jacobian), const function_type > |
Get Jacobian matrix. | |
auto | last_change () const noexcept -> scalar_type |
Get the last change of the variable. | |
auto | last_change () const noexcept -> variable_type |
Get the last change of the variable. | |
auto | max_iterations (index_type val) -> this_type & |
Set maximum number of iterations. | |
auto | max_iterations (index_type val) -> this_type & |
Set maximum number of iterations. | |
auto | tol_last_change (const scalar_type &val) -> this_type & |
Set tolerance of last change of the variable. | |
auto | tol_last_change (const variable_type &val) -> this_type & |
Set tolerance of last change of the variable. | |
auto | tol_value_norm (const scalar_type &val) -> this_type & |
Set tolerance of the norm of function value. | |
auto | tol_value_norm (const variable_type &val) -> this_type & |
Set tolerance of the norm of function value. | |
auto | value () const -> std::invoke_result_t< decltype(&function_type::value), const function_type > |
Get current value. | |
auto | value () const -> std::invoke_result_t< decltype(&function_type::value), const function_type > |
Get current value. | |
auto | value_norm () const noexcept -> scalar_type |
Get the norm of function value. | |
auto | value_norm () const noexcept -> variable_type |
Get the norm of function value. | |
auto | variable () const -> const variable_type & |
Get current variable. | |
auto | variable () const -> const variable_type & |
Get current variable. | |
Public Member Functions inherited from num_collect::roots::function_root_finder_base< newton_raphson< Function >, Function > | |
function_root_finder_base (logging::log_tag_view tag, const function_type &function=function_type()) | |
Constructor. | |
auto | function () -> function_type & |
Get the function of equation. | |
auto | function () const -> const function_type & |
Get the function of equation. | |
Public Member Functions inherited from num_collect::base::iterative_solver_base< newton_raphson< Function > > | |
iterative_solver_base (logging::log_tag_view tag) | |
Constructor. | |
iterative_solver_base (logging::log_tag_view tag) | |
Constructor. | |
auto | is_stop_criteria_satisfied () const -> bool |
Determine if stopping criteria of the algorithm are satisfied. | |
auto | is_stop_criteria_satisfied () const -> bool |
Determine if stopping criteria of the algorithm are satisfied. | |
void | iterate () |
Iterate the algorithm once. | |
void | iterate () |
Iterate the algorithm once. | |
void | solve () |
Solve the problem. | |
void | solve () |
Solve the problem. | |
Public Member Functions inherited from num_collect::logging::logging_mixin | |
logging_mixin (log_tag_view tag) | |
Constructor. | |
template<typename Child > | |
void | configure_child_algorithm_logger_if_exists (Child &child) |
Configure a logger of a child algorithm if exists. | |
auto | logger () const noexcept -> const num_collect::logging::logger & |
Access to the logger. | |
auto | logger () noexcept -> num_collect::logging::logger & |
Access to the logger. | |
Public Member Functions inherited from num_collect::logging::iterations::iteration_logger_mixin< newton_raphson< Function > > | |
iteration_logger_mixin ()=default | |
Constructor. | |
void | configure_iteration_logger (num_collect::logging::iterations::iteration_logger< newton_raphson< Function > > &iteration_logger) const |
Configure an iteration logger. | |
auto | initialize_iteration_logger () -> num_collect::logging::iterations::iteration_logger< newton_raphson< Function > > & |
Get the iteration logger. | |
Private Attributes | |
variable_type | change_ {} |
Change. | |
index_type | evaluations_ {} |
Number of function evaluations. | |
index_type | iterations_ {} |
Number of iterations. | |
jacobian_solver_type | jacobian_solver_ {} |
Solver of Jacobian matrices. | |
variable_type | last_change_ {} |
Last change of the variable. | |
scalar_type | last_change_ {} |
Last change of the variable. | |
index_type | max_iterations_ {default_max_iterations} |
Maximum iterations. | |
variable_type | tol_last_change_ {default_tol_last_change} |
Threshold of last change of the variable. | |
scalar_type | tol_last_change_ {default_tol_last_change} |
Threshold of last change of the variable. | |
variable_type | tol_value_norm_ {default_tol_value_norm} |
Threshold of the norm of function value. | |
scalar_type | tol_value_norm_ {default_tol_value_norm} |
Threshold of the norm of function value. | |
variable_type | value_norm_ {} |
Norm of function value. | |
scalar_type | value_norm_ {} |
Norm of function value. | |
variable_type | variable_ {} |
Variable. | |
Static Private Attributes | |
static constexpr index_type | default_max_iterations = 1000 |
Default maximum iterations. | |
static constexpr auto | default_tol_last_change |
Default tolerance of last change of the variable. | |
static constexpr auto | default_tol_value_norm |
Default tolerance of the norm of function value. | |
Additional Inherited Members | |
Protected Member Functions inherited from num_collect::base::iterative_solver_base< newton_raphson< Function > > | |
auto | derived () const noexcept -> const newton_raphson< Function > & |
Access derived object. | |
auto | derived () const noexcept -> const newton_raphson< Function > & |
Access derived object. | |
auto | derived () noexcept -> newton_raphson< Function > & |
Access derived object. | |
auto | derived () noexcept -> newton_raphson< Function > & |
Access derived object. | |
Class of Newton-Raphson method.
This version is used when variable type is a floating-point number type.
Function | Type of the function of equation. |
This version is used when variable type is Eigen's vector.
Function | Type of the function of equation. |
Definition at line 296 of file newton_raphson.h.
typedef function_root_finder_base< newton_raphson< Function >, Function > num_collect::roots::newton_raphson< Function >::base_type |
Type of base class.
Definition at line 68 of file newton_raphson.h.
using num_collect::roots::newton_raphson< Function >::jacobian_solver_type |
Type of solvers of Jacobian matrices.
Definition at line 316 of file newton_raphson.h.
using num_collect::roots::newton_raphson< Function >::jacobian_type = typename function_type::jacobian_type |
Type of Jacobian matrices.
Definition at line 313 of file newton_raphson.h.
using num_collect::roots::newton_raphson< Function >::scalar_type = typename variable_type::Scalar |
Type of scalars in variables.
Definition at line 310 of file newton_raphson.h.
typedef newton_raphson< Function > num_collect::roots::newton_raphson< Function >::this_type = newton_raphson<Function> |
Type of this object.
Definition at line 65 of file newton_raphson.h.
|
inlineexplicit |
Constructor.
[in] | function | Function of equation. |
Definition at line 82 of file newton_raphson.h.
|
inlineexplicit |
Constructor.
[in] | function | Function of equation. |
Definition at line 324 of file newton_raphson.h.
|
inline |
Configure an iteration logger.
[in] | iteration_logger | Iteration logger. |
Definition at line 123 of file newton_raphson.h.
|
inline |
Configure an iteration logger.
[in] | iteration_logger | Iteration logger. |
Definition at line 364 of file newton_raphson.h.
|
inlinenodiscardnoexcept |
Get the number of function evaluations.
Definition at line 183 of file newton_raphson.h.
|
inlinenodiscardnoexcept |
Get the number of function evaluations.
Definition at line 424 of file newton_raphson.h.
|
inline |
Initialize.
[in] | variable | Initial variable. |
Definition at line 90 of file newton_raphson.h.
|
inline |
Initialize.
[in] | variable | Initial variable. |
Definition at line 332 of file newton_raphson.h.
|
inlinenodiscard |
Determine if stopping criteria of the algorithm are satisfied.
Definition at line 116 of file newton_raphson.h.
|
inlinenodiscard |
Determine if stopping criteria of the algorithm are satisfied.
Definition at line 357 of file newton_raphson.h.
|
inline |
Iterate the algorithm once.
init
functions) are assumed to have been done. Definition at line 103 of file newton_raphson.h.
|
inline |
Iterate the algorithm once.
init
functions) are assumed to have been done. Definition at line 344 of file newton_raphson.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 174 of file newton_raphson.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 415 of file newton_raphson.h.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscardnoexcept |
Get the last change of the variable.
Definition at line 433 of file newton_raphson.h.
|
inlinenodiscardnoexcept |
Get the last change of the variable.
Definition at line 192 of file newton_raphson.h.
|
inline |
Set maximum number of iterations.
[in] | val | Value. |
Definition at line 211 of file newton_raphson.h.
|
inline |
Set maximum number of iterations.
[in] | val | Value. |
Definition at line 452 of file newton_raphson.h.
|
inline |
Set tolerance of last change of the variable.
[in] | val | Value. |
Definition at line 465 of file newton_raphson.h.
|
inline |
Set tolerance of last change of the variable.
[in] | val | Value. |
Definition at line 224 of file newton_raphson.h.
|
inline |
Set tolerance of the norm of function value.
[in] | val | Value. |
Definition at line 480 of file newton_raphson.h.
|
inline |
Set tolerance of the norm of function value.
[in] | val | Value. |
Definition at line 239 of file newton_raphson.h.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscardnoexcept |
Get the norm of function value.
Definition at line 442 of file newton_raphson.h.
|
inlinenodiscardnoexcept |
Get the norm of function value.
Definition at line 201 of file newton_raphson.h.
|
inlinenodiscard |
|
inlinenodiscard |
|
private |
Change.
Definition at line 253 of file newton_raphson.h.
|
staticconstexprprivate |
Default maximum iterations.
Definition at line 268 of file newton_raphson.h.
|
staticconstexprprivate |
Default tolerance of last change of the variable.
Definition at line 274 of file newton_raphson.h.
|
staticconstexprprivate |
Default tolerance of the norm of function value.
Definition at line 281 of file newton_raphson.h.
|
private |
Number of function evaluations.
Definition at line 259 of file newton_raphson.h.
|
private |
Number of iterations.
Definition at line 256 of file newton_raphson.h.
|
private |
Solver of Jacobian matrices.
Definition at line 497 of file newton_raphson.h.
|
private |
Last change of the variable.
Definition at line 262 of file newton_raphson.h.
|
private |
Last change of the variable.
Definition at line 506 of file newton_raphson.h.
|
private |
Maximum iterations.
Definition at line 271 of file newton_raphson.h.
|
private |
Threshold of last change of the variable.
Definition at line 278 of file newton_raphson.h.
|
private |
Threshold of last change of the variable.
Definition at line 522 of file newton_raphson.h.
|
private |
Threshold of the norm of function value.
Definition at line 285 of file newton_raphson.h.
|
private |
Threshold of the norm of function value.
Definition at line 529 of file newton_raphson.h.
|
private |
Norm of function value.
Definition at line 265 of file newton_raphson.h.
|
private |
Norm of function value.
Definition at line 509 of file newton_raphson.h.
|
private |
Variable.
Definition at line 250 of file newton_raphson.h.