Initialize the root_solver class.
Note that all optional inputs are not used for all methods.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(root_solver), | intent(out) | :: | me | |||
procedure(func) | :: | f |
user function |
|||
real(kind=wp), | intent(in), | optional | :: | ftol |
absolute tolerance for |
|
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 |
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