fsolve_hybrj_func Subroutine

subroutine fsolve_hybrj_func(func, dfunc, x, tol, info, check)

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))
function dfunc(x)
Arguments
Type IntentOptional Attributes Name
real(kind=8), intent(in), dimension(:) :: x
Return Value real(kind=8), dimension(size(x),size(x))
real(kind=8), dimension(:) :: x
real(kind=8), optional :: tol
integer, optional :: info
logical, optional :: check

Calls

proc~~fsolve_hybrj_func~~CallsGraph proc~fsolve_hybrj_func fsolve_hybrj_func hybrj1 hybrj1 proc~fsolve_hybrj_func->hybrj1

Source Code

subroutine fsolve_hybrj_func(func,dfunc,x,tol,info,check)
  interface
     function func(x)
       real(8),dimension(:),intent(in) :: x
       real(8),dimension(size(x))      :: func
     end function func
     !
     function dfunc(x)
       real(8),dimension(:),intent(in)    :: x
       real(8),dimension(size(x),size(x)) :: dfunc
     end function dfunc
  end interface
  real(8),dimension(:)               :: x      
  real(8),optional                   :: tol
  integer,optional                   :: info
  real(8)                            :: tol_
  integer                            :: info_
  logical,optional                   :: check
  logical                            :: check_
  integer                            :: n
  real(8),dimension(size(x))         :: fvec
  real(8),dimension(size(x),size(x)) :: fjac
  tol_ = 1.d-15;if(present(tol))tol_=tol
  check_=.true.;if(present(check))check_=check
  n=size(x)
  call hybrj1(fsolve_hybrj1_func2sub,n,x,fvec,fjac,n,tol_,info_)
  if(present(info))info=info_
  if(check_)then
     include "fsolve_error.h90"
  endif
contains
  subroutine fsolve_hybrj1_func2sub(n,x,fvec,fjac,ldfjac,iflag)
    integer ::  n
    real(8) ::  x(n)
    real(8) ::  fvec(n)
    integer ::  ldfjac
    real(8) ::  fjac(ldfjac,n)
    integer ::  iflag
    if(iflag==1)then
       fvec = func(x)
    elseif(iflag==2)then
       fjac = dfunc(x)
    endif
    if(iflag<0)stop "FSOLVE_HYBRJ1_func2sub ERROR: iflag < 0 "
  end subroutine fsolve_hybrj1_func2sub
end subroutine fsolve_hybrj_func