fsolve_hybrd_func Subroutine

subroutine fsolve_hybrd_func(func, x, tol, info, check, maxfev)

Arguments

Type IntentOptional Attributes Name
function func(x)
Arguments
Type IntentOptional Attributes Name
real(kind=8), intent(in), dimension(:) :: x
Return Value real(kind=8), dimension(size(x))
real(kind=8), dimension(:) :: x
real(kind=8), optional :: tol
integer, optional :: info
logical, optional :: check
integer, optional :: maxfev

Calls

proc~~fsolve_hybrd_func~~CallsGraph proc~fsolve_hybrd_func fsolve_hybrd_func hybrd1 hybrd1 proc~fsolve_hybrd_func->hybrd1

Source Code

subroutine fsolve_hybrd_func(func,x,tol,info,check,maxfev)
  interface
     function func(x)
       real(8),dimension(:),intent(in) :: x
       real(8),dimension(size(x))      :: func
     end function func
  end interface
  real(8),dimension(:)       :: x      
  real(8),optional           :: tol
  integer,optional           :: info
  integer,optional           :: maxfev
  integer                    :: maxfev_
  real(8)                    :: tol_
  integer                    :: info_
  logical,optional           :: check
  logical                    :: check_
  integer                    :: n
  real(8),dimension(size(x)) :: fvec
  tol_ = 1.d-15;if(present(tol))tol_=tol
  check_=.true.;if(present(check))check_=check
  maxfev_=200;if(present(maxfev))maxfev_=maxfev
  n=size(x)
  call hybrd1(fsolve_hybrd1_func2sub,n,x,fvec,tol_,info_,maxfev_)
  if(present(info))info=info_
  if(check_)then
     include "fsolve_error.h90"
  endif
contains
  subroutine fsolve_hybrd1_func2sub(n,x,fvec,iflag)
    integer ::  n
    real(8) ::  x(n)
    real(8) ::  fvec(n)
    integer ::  iflag
    fvec(:) = func(x)
    if(iflag<0)stop "FSOLVE_HYBRD1_func2sub ERROR: iflag < 0 "
  end subroutine fsolve_hybrd1_func2sub
end subroutine fsolve_hybrd_func