initialize_root_solver Subroutine

private subroutine initialize_root_solver(me, f, ftol, rtol, atol, maxiter)

Initialize the root_solver class.

Note that all optional inputs are not used for all methods.

Type Bound

root_solver

Arguments

Type IntentOptional Attributes Name
class(root_solver), intent(out) :: me
procedure(func) :: f

user function f(x) to find the root of

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

absolute tolerance for f=0

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

relative tol for x

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

absolute tol for x

integer, intent(in), optional :: maxiter

maximum number of iterations


Called by

proc~~initialize_root_solver~~CalledByGraph proc~initialize_root_solver root_module::root_solver%initialize_root_solver proc~root_scalar_by_type root_module::root_scalar_by_type proc~root_scalar_by_type->proc~initialize_root_solver proc~solve root_module::root_solver%solve proc~root_scalar_by_type->proc~solve interface~root_scalar root_module::root_scalar interface~root_scalar->proc~root_scalar_by_type proc~root_scalar_by_name root_module::root_scalar_by_name interface~root_scalar->proc~root_scalar_by_name proc~root_scalar_by_name->interface~root_scalar proc~solve->interface~root_scalar

Source Code

    subroutine initialize_root_solver(me,f,ftol,rtol,atol,maxiter)

    implicit none

    class(root_solver),intent(out) :: me
    procedure(func)               :: f        !! user function `f(x)` to find the root of
    real(wp),intent(in),optional  :: ftol     !! absolute tolerance for `f=0`
    real(wp),intent(in),optional  :: rtol     !! relative tol for x
    real(wp),intent(in),optional  :: atol     !! absolute tol for x
    integer,intent(in),optional   :: maxiter  !! maximum number of iterations

    me%f => f
    if (present(ftol))    me%ftol    = abs(ftol)
    if (present(rtol))    me%rtol    = abs(rtol)
    if (present(atol))    me%atol    = abs(atol)
    if (present(maxiter)) me%maxiter = abs(maxiter)

    end subroutine initialize_root_solver