hompack_core Module

Core routines used by two or more of the hompack solvers.


Uses

  • module~~hompack_core~~UsesGraph module~hompack_core hompack_core iso_c_binding iso_c_binding module~hompack_core->iso_c_binding module~hompack_kinds hompack_kinds module~hompack_core->module~hompack_kinds iso_fortran_env iso_fortran_env module~hompack_kinds->iso_fortran_env

Used by

  • module~~hompack_core~~UsedByGraph module~hompack_core hompack_core module~hompack_nf hompack_nf module~hompack_nf->module~hompack_core proc~rootnf rootnf proc~rootnf->module~hompack_core proc~stepnf stepnf proc~stepnf->module~hompack_core

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: problem_fix_point = 1
integer, public, parameter :: problem_zero_find = 2
integer, public, parameter :: problem_curve_track = 3
integer, public, parameter :: hompack_success = 1

Derived Types

type, public ::  hompack_f_callbacks

Container to hold user routines for f-suffix (dense Jacobian) methods.

Components

Type Visibility Attributes Name Initial
procedure(f_t), public, nopass, pointer :: f => null()
procedure(fjac_t), public, nopass, pointer :: fjac => null()
procedure(rho_t), public, nopass, pointer :: rho => null()
procedure(rhojac_t), public, nopass, pointer :: rhojac => null()
type(c_ptr), public :: data = c_null_ptr

type, public ::  hompack_status

Components

Type Visibility Attributes Name Initial
integer, public :: code = hompack_success
character(len=256), public :: message = ""

Type-Bound Procedures

procedure, public :: ok => hompack_status_ok

type, public ::  root_state

State variables for root.

Components

Type Visibility Attributes Name Initial
real(kind=dp), public :: a

Previous iterate point used for secant step calculation.

real(kind=dp), public :: acbs

Width of the bracketing interval at the last forced bisection checkpoint.

real(kind=dp), public :: acmb

Absolute value of half the current interval length, |(c - b)/2|.

real(kind=dp), public :: ae

Internal absolute error tolerance bound, max(abserr, 0.0).

real(kind=dp), public :: cmb

Half-interval vector representation, (c - b)/2.

real(kind=dp), public :: fa

Function value evaluated at point a, f(a).

real(kind=dp), public :: fb

Function value evaluated at point b, f(b).

real(kind=dp), public :: fc

Function value evaluated at point c, f(c).

real(kind=dp), public :: fx

Maximum initial absolute function value, used to detect poles or divergence.

real(kind=dp), public :: p

Numerator of the proposed secant step update fraction (p/q).

real(kind=dp), public :: q

Denominator of the proposed secant step update fraction (p/q).

real(kind=dp), public :: re

Internal relative error tolerance bound, max(relerr, epsilon).

real(kind=dp), public :: tol

Dynamic convergence tolerance threshold for the current iteration step.

integer, public :: ic

Counter of sequential secant steps used to force bisection if convergence stalls.

integer, public :: fcount

Total number of function evaluations completed so far.


Functions

public pure elemental function qofs(f0, fp0, f1, fp1, dels, s) result(res)

This function computes the Hermite cubic interpolant at a point s.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: f0

Function value at the start of the interval.

real(kind=dp), intent(in) :: fp0

Derivative value at the start of the interval.

real(kind=dp), intent(in) :: f1

Function value at the end of the interval.

real(kind=dp), intent(in) :: fp1

Derivative value at the end of the interval.

real(kind=dp), intent(in) :: dels

Width of the interpolation interval.

real(kind=dp), intent(in) :: s

Local coordinate of the interpolation point to the start.

Return Value real(kind=dp)


Subroutines

public subroutine root(t, ft, b, c, relerr, abserr, iflag, state)

This subroutine computes a root of the nonlinear equation f(x) = 0 where f(x) is a continuous real function of a single real variable x. The method used is a combination of bisection and the secant rule.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: t

Point at which the function is to be evaluated. On output with iflag < 0, t contains the next point where the caller must evaluate the function and set ft = f(t) before calling root again. When the iteration terminates successfully, t contains the final evaluation point associated with the computed root approximation.

real(kind=dp), intent(inout) :: ft

Function value at t. When iflag < 0, the caller must compute ft = f(t) and call root again without modifying iflag.

real(kind=dp), intent(inout) :: b

Lower endpoint of the current bracketing interval. On input, together with c, defines an interval containing a root, typically satisfying f(b)*f(c) <= 0. On output, contains the best approximation to the root. The algorithm maintains abs(f(b)) <= abs(f(c)).

real(kind=dp), intent(inout) :: c

Upper endpoint of the current bracketing interval. On output, contains the second endpoint of the final bracketing interval.

real(kind=dp), intent(in) :: relerr

Relative error tolerance. Convergence is declared when abs(b-c) <= 2*(relerr*abs(b) + abserr).

real(kind=dp), intent(in) :: abserr

Absolute error tolerance. Used together with relerr in the convergence test. A nonzero value is recommended when a root near zero is possible.

integer, intent(inout) :: iflag

Reverse-communication control and status flag.

Read more…
type(root_state), intent(inout) :: state

Internal state of the root-finding iteration. The caller should not modify it. Used internally by root to maintain the state of the iteration across calls.