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 choose_best proc~anderson_bjorck anderson_bjorck_solver%anderson_bjorck proc~anderson_bjorck->proc~choose_best proc~anderson_bjorck_kroger anderson_bjorck_kroger_solver%anderson_bjorck_kroger proc~anderson_bjorck_kroger->proc~choose_best proc~barycentric barycentric_solver%barycentric proc~barycentric->proc~choose_best proc~bdqrf bdqrf_solver%bdqrf proc~bdqrf->proc~choose_best proc~bisection bisection_solver%bisection proc~bisection->proc~choose_best proc~blendtf blendtf_solver%blendtf proc~blendtf->proc~choose_best proc~illinois illinois_solver%illinois proc~illinois->proc~choose_best proc~itp itp_solver%itp proc~itp->proc~choose_best proc~muller muller_solver%muller proc~muller->proc~choose_best proc~pegasus pegasus_solver%pegasus proc~pegasus->proc~choose_best proc~regula_falsi regula_falsi_solver%regula_falsi proc~regula_falsi->proc~choose_best proc~zhang 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