obj_t Derived Type

type, public, abstract :: obj_t

Type for a 1D objective function

Inherited By

type~~obj_t~~InheritedByGraph type~obj_t obj_t type~test_t test_t type~obj_t->type~test_t type~linesearch_t lineSearch_t type~obj_t->type~linesearch_t
Help

Components

TypeVisibility AttributesNameInitial
integer, public :: derivativeOrder =2

Order of finite difference approximations

real(kind=wp), public :: stepSize =1.0E-3_wp

Step size for finite differences


Type-Bound Procedures

procedure, public :: der1

  • private function der1(self, x) result(o)

    Compute the first derivative using finite differences

    Arguments

    Type IntentOptional AttributesName
    class(obj_t), intent(in) :: self

    Function to differentiate

    real(kind=wp), intent(in) :: x

    Evaluation point

    Return Value real(kind=wp)

    First derivative

procedure, public :: der2

  • private function der2(self, x) result(o)

    Compute the second derivative using finite differences

    Arguments

    Type IntentOptional AttributesName
    class(obj_t), intent(in) :: self

    Function to differentiate

    real(kind=wp), intent(in) :: x

    Evaluation point

    Return Value real(kind=wp)

    Second derivative

procedure, public :: rootNewton

  • private function rootNewton(self, x0, tol, maxIts) result(o)

    Find the root of a 1-D function using Newton's method

    Arguments

    Type IntentOptional AttributesName
    class(obj_t), intent(in) :: self

    Function for root finding

    real(kind=wp), intent(in) :: x0

    Initial guess

    real(kind=wp), intent(in), optional :: tol

    Tolerance

    integer, intent(in), optional :: maxIts

    Maximum iterations

    Return Value real(kind=wp)

    Location of root

procedure, public :: minNewton => minNewton_obj

  • private function minNewton_obj(self, x0, tol, maxIts) result(o)

    Find the minimum of a 1-D function using Newton's method

    Arguments

    Type IntentOptional AttributesName
    class(obj_t), intent(in) :: self

    Function for minimization

    real(kind=wp), intent(in) :: x0

    Intial guess

    real(kind=wp), intent(in), optional :: tol

    Tolerance

    integer, intent(in), optional :: maxIts

    Maximum iterations

    Return Value real(kind=wp)

    Location of minimum

procedure(eval_p), public, deferred :: eval

  • function eval_p(self, x) result(o) Prototype

    Evaluate an objective function at point \(x\)

    Arguments

    Type IntentOptional AttributesName
    class(obj_t), intent(in) :: self

    Objective function

    real(kind=wp), intent(in) :: x

    Evaluation point

    Return Value real(kind=wp)

    Function result