fsolve_hybrd_sub Subroutine

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

Arguments

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

Calls

proc~~fsolve_hybrd_sub~~CallsGraph proc~fsolve_hybrd_sub fsolve_hybrd_sub hybrd1 hybrd1 proc~fsolve_hybrd_sub->hybrd1

Source Code

subroutine fsolve_hybrd_sub(func,x,tol,info,check,maxfev)
  interface
     subroutine func(x,ff)
       real(8),dimension(:),intent(in) :: x
       real(8),dimension(size(x))      :: ff
     end subroutine func
  end interface
  real(8),dimension(:)       :: x      
  real(8),optional           :: tol
  integer,optional           :: info
  real(8)                    :: tol_
  integer                    :: info_
  integer,optional           :: maxfev
  integer                    :: maxfev_
  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_sub2sub,n,x,fvec,tol_,info_,maxfev_)
  if(present(info))info=info_
  if(check_)then
     include "fsolve_error.h90"
  endif
contains
  subroutine fsolve_hybrd1_sub2sub(n,x,fvec,iflag)
    integer ::  n
    real(8) ::  x(n)
    real(8) ::  fvec(n)
    integer ::  iflag
    call func(x,fvec)
    if(iflag<0)stop "FSOLVE_HYBRD1_sub2sub ERROR: iflag < 0 "
  end subroutine fsolve_hybrd1_sub2sub
end subroutine fsolve_hybrd_sub