converged Function

private pure function converged(me, a, b)

Determines convergence in x based on if the reltol or abstol is satisfied.

Type Bound

root_solver

Arguments

Type IntentOptional Attributes Name
class(root_solver), intent(in) :: me
real(kind=wp), intent(in) :: a

old value

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

new value

Return Value logical


Called by

proc~~converged~~CalledByGraph proc~converged root_solver%converged proc~anderson_bjorck anderson_bjorck_solver%anderson_bjorck proc~anderson_bjorck->proc~converged proc~anderson_bjorck_kroger anderson_bjorck_kroger_solver%anderson_bjorck_kroger proc~anderson_bjorck_kroger->proc~converged proc~barycentric barycentric_solver%barycentric proc~barycentric->proc~converged proc~bdqrf bdqrf_solver%bdqrf proc~bdqrf->proc~converged proc~bisection bisection_solver%bisection proc~bisection->proc~converged proc~blendtf blendtf_solver%blendtf proc~blendtf->proc~converged proc~illinois illinois_solver%illinois proc~illinois->proc~converged proc~itp itp_solver%itp proc~itp->proc~converged proc~modab modab_solver%ModAB proc~modab->proc~converged proc~muller muller_solver%muller proc~muller->proc~converged proc~pegasus pegasus_solver%pegasus proc~pegasus->proc~converged proc~rbp rbp_solver%rbp proc~rbp->proc~converged proc~regula_falsi regula_falsi_solver%regula_falsi proc~regula_falsi->proc~converged proc~ridders ridders_solver%ridders proc~ridders->proc~converged proc~zhang zhang_solver%zhang proc~zhang->proc~converged

Source Code

    pure function converged(me,a,b)

    implicit none

    class(root_solver),intent(in) :: me
    real(wp),intent(in) :: a !! old value
    real(wp),intent(in) :: b !! new value
    logical :: converged

    real(wp) :: d

    ! original way:
    ! converged = (abs(b-a) <= abs(b)*me%rtol + me%atol) exit

    d = abs(b-a)

    if (d <= me%atol) then
        ! absolute
        converged = .true.
    else
        ! relative
        if (a /= 0.0_wp) then
            converged = d / abs(a) <= me%rtol
        else
            converged = .false.
        end if
    end if

    end function converged