choose_best Subroutine

private pure subroutine choose_best(x1, x2, f1, f2, xbest, fbest)

Given two points with two function evaluations, choose the best one (the one closest to the root).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x1
real(kind=wp), intent(in) :: x2
real(kind=wp), intent(in) :: f1
real(kind=wp), intent(in) :: f2
real(kind=wp), intent(out) :: xbest
real(kind=wp), intent(out) :: fbest

Called by

proc~~choose_best~~CalledByGraph proc~choose_best root_module::choose_best proc~anderson_bjorck root_module::anderson_bjorck_solver%anderson_bjorck proc~anderson_bjorck->proc~choose_best proc~anderson_bjorck_king root_module::anderson_bjorck_king_solver%anderson_bjorck_king proc~anderson_bjorck_king->proc~choose_best proc~barycentric root_module::barycentric_solver%barycentric proc~barycentric->proc~choose_best proc~bdqrf root_module::bdqrf_solver%bdqrf proc~bdqrf->proc~choose_best proc~bisection root_module::bisection_solver%bisection proc~bisection->proc~choose_best proc~blendtf root_module::blendtf_solver%blendtf proc~blendtf->proc~choose_best proc~illinois root_module::illinois_solver%illinois proc~illinois->proc~choose_best proc~itp root_module::itp_solver%itp proc~itp->proc~choose_best proc~muller root_module::muller_solver%muller proc~muller->proc~choose_best proc~pegasus root_module::pegasus_solver%pegasus proc~pegasus->proc~choose_best proc~regula_falsi root_module::regula_falsi_solver%regula_falsi proc~regula_falsi->proc~choose_best proc~zhang root_module::zhang_solver%zhang proc~zhang->proc~choose_best

Source Code

    pure subroutine choose_best(x1,x2,f1,f2,xbest,fbest)

    implicit none

    real(wp),intent(in) :: x1,x2
    real(wp),intent(in) :: f1,f2
    real(wp),intent(out) :: xbest
    real(wp),intent(out) :: fbest

    if (abs(f1)<abs(f2)) then
        xbest = x1
        fbest = f1
    else
        xbest = x2
        fbest = f2
    end if

    end subroutine choose_best