Optimist  0.0.0
A C++ library for optimization
Loading...
Searching...
No Matches
Optimist::RootFinder::Halley< Scalar > Class Template Reference

Class container for the Halley's method. More...

#include <Halley.hh>

Inherits Optimist::RootFinder::RootFinder< Scalar, Halley< Scalar > >.

Public Member Functions

 Halley ()
constexpr std::string name_impl () const
template<typename FunctionLambda, typename FirstDerivativeLambda, typename SecondDerivativeLambda>
bool solve_impl (FunctionLambda &&function, FirstDerivativeLambda &&first_derivative, SecondDerivativeLambda &&second_derivative, Scalar x_ini, Scalar &x_sol)
Public Member Functions inherited from Optimist::RootFinder::RootFinder< Scalar, Halley< Scalar > >
 RootFinder ()
constexpr std::string name () const
Integer jacobian_evaluations () const
Integer max_jacobian_evaluations () const
Integer hessian_evaluations () const
Integer max_hessian_evaluations () const
bool solve (FunctionLambda &&function, const Input &x_ini, Output &x_sol)
Public Member Functions inherited from Optimist::SolverBase< Scalar, Scalar, Halley< Scalar > >
 SolverBase ()
void reset_bounds (const Integer n=InputTrait::IsDynamic ? 0 :InputTrait::Dimension)
const Scalarlower_bound () const
const Scalarupper_bound () const
void bounds (const Scalar &t_lower_bound, const Scalar &t_upper_bound)
constexpr Integer input_dimension () const
constexpr Integer output_dimension () const
Integer function_evaluations () const
void max_function_evaluations (const Integer t_max_function_evaluations)
Integer iterations () const
Integer max_iterations () const
Scalar alpha () const
Integer relaxations () const
Integer max_relaxations () const
Scalar tolerance () const
void verbose_mode (bool t_verbose)
void enable_verbose_mode ()
void disable_verbose_mode ()
void damped_mode (bool t_damped)
void enable_damped_mode ()
void disable_damped_mode ()
std::string task () const
bool converged () const
std::ostream & ostream () const
bool solve (FunctionLambda &&function, const Scalar &x_ini, Scalar &x_sol)
bool rootfind (const FunctionBase< FunctionInput, FunctionOutput, DerivedFunction > &function, const Scalar &x_ini, Scalar &x_sol)
bool optimize (const FunctionBase< FunctionInput, FunctionOutput, DerivedFunction > &function, const Scalar &x_ini, Scalar &x_sol)
constexpr std::string name () const

Static Public Attributes

static constexpr bool RequiresFunction {true}
static constexpr bool RequiresFirstDerivative {true}
static constexpr bool RequiresSecondDerivative {true}
Static Public Attributes inherited from Optimist::RootFinder::RootFinder< Scalar, Halley< Scalar > >
static constexpr bool IsRootFinder
static constexpr bool IsOptimizer

Additional Inherited Members

Public Types inherited from Optimist::RootFinder::RootFinder< Scalar, Halley< Scalar > >
using Scalar
using Input
using Output
Public Types inherited from Optimist::SolverBase< Scalar, Scalar, Halley< Scalar > >
using InputTrait
using OutputTrait
using Scalar
using FirstDerivative
using SecondDerivative
Protected Member Functions inherited from Optimist::RootFinder::RootFinder< Scalar, Halley< Scalar > >
bool evaluate_jacobian (JacobianLambda &&jacobian, const Input &x, FirstDerivative &out)
bool evaluate_hessian (HessianLambda &&hessian, const Input &x, SecondDerivative &out)
Protected Member Functions inherited from Optimist::SolverBase< Scalar, Scalar, Halley< Scalar > >
Integer first_derivative_evaluations () const
Integer max_first_derivative_evaluations () const
Integer second_derivative_evaluations () const
Integer max_second_derivative_evaluations () const
void reset_counters ()
bool evaluate_function (FunctionLambda &&function, const Scalar &x, Scalar &out)
bool evaluate_first_derivative (FirstDerivativeLambda &&function, const Scalar &x, FirstDerivative &out)
bool evaluate_second_derivative (SecondDerivativeLambda &&function, const Scalar &x, SecondDerivative &out)
bool damp (FunctionLambda &&function, const Scalar &x_old, const Scalar &function_old, const Scalar &step_old, Scalar &x_new, Scalar &function_new, Scalar &step_new)
void header ()
void bottom ()
void info (Scalar residuals, const std::string &notes="-")
Protected Attributes inherited from Optimist::SolverBase< Scalar, Scalar, Halley< Scalar > >
Scalar m_lower_bound
Scalar m_upper_bound
Integer m_function_evaluations
Integer m_first_derivative_evaluations
Integer m_second_derivative_evaluations
Integer m_max_function_evaluations
Integer m_max_first_derivative_evaluations
Integer m_max_second_derivative_evaluations
Integer m_iterations
Integer m_max_iterations
Scalar m_alpha
Integer m_relaxations
Integer m_max_relaxations
Scalar m_tolerance
bool m_verbose
bool m_damped
std::ostream * m_ostream
std::string m_task
bool m_converged

Detailed Description

template<typename Scalar>
class Optimist::RootFinder::Halley< Scalar >
Template Parameters
ScalarFloating-point number type.

Constructor & Destructor Documentation

◆ Halley()

template<typename Scalar>
Optimist::RootFinder::Halley< Scalar >::Halley ( )
inline

Class constructor for the Halley solver.

Member Function Documentation

◆ name_impl()

template<typename Scalar>
std::string Optimist::RootFinder::Halley< Scalar >::name_impl ( ) const
inlineconstexpr

Get the Halley solver name.

Returns
The Halley solver name.

◆ solve_impl()

template<typename Scalar>
template<typename FunctionLambda, typename FirstDerivativeLambda, typename SecondDerivativeLambda>
bool Optimist::RootFinder::Halley< Scalar >::solve_impl ( FunctionLambda && function,
FirstDerivativeLambda && first_derivative,
SecondDerivativeLambda && second_derivative,
Scalar x_ini,
Scalar & x_sol )
inline

Solve the nonlinear equation \( f(x) = 0 \), with \( f: \mathbb{R} \rightarrow \mathbb{R} \).

Template Parameters
FunctionLambdaFunction lambda type.
FirstDerivativeLambdaFirst derivative lambda type.
SecondDerivativeLambdaSecond derivative lambda type.
Parameters
[in]functionFunction lambda.
[in]first_derivativeFirst derivative lambda.
[in]second_derivativeSecond derivative lambda.
[in]x_iniInitialization point.
[out]x_solSolution point.
Returns
The convergence boolean flag.

Member Data Documentation

◆ RequiresFirstDerivative

template<typename Scalar>
bool Optimist::RootFinder::Halley< Scalar >::RequiresFirstDerivative {true}
staticconstexpr

◆ RequiresFunction

template<typename Scalar>
bool Optimist::RootFinder::Halley< Scalar >::RequiresFunction {true}
staticconstexpr

◆ RequiresSecondDerivative

template<typename Scalar>
bool Optimist::RootFinder::Halley< Scalar >::RequiresSecondDerivative {true}
staticconstexpr

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