cinter Function

function cinter(func, x)

Arguments

Type IntentOptional Attributes Name
type(finter_type) :: func
real(kind=8) :: x

Return Value complex(kind=8)


Calls

proc~~cinter~~CallsGraph proc~cinter cinter f f proc~cinter->f g g proc~cinter->g locate locate proc~cinter->locate polint polint proc~cinter->polint x x proc~cinter->x

Source Code

function cinter(func,x)
  real(8)           :: x
  type(finter_type) :: func
  complex(8)        :: cinter
  real(8)           :: ry,dry
  real(8)           :: iy,diy
  integer           :: j,k,k0,k1
  integer           :: n
  N=func%N    !order of polynomial interpolation
  cinter=dcmplx(0d0,0d0)
  !
  j=locate(func%X(func%Imin:func%Imax),x)
  k=max(j-(N-1)/2,1)
  k0=k
  if(k0 < func%Imin)k0=func%Imin
  k1=k+N+1
  if(k1 > func%Imax)then
     k1=func%Imax
     k0=k1-N-1
  endif
  !
  call polint(func%X(k0:k1),func%F(k0:k1),x,ry,dry)
  call polint(func%X(k0:k1),func%G(k0:k1),x,iy,diy)
  cinter=dcmplx(ry,iy)
  return
end function cinter