polint Subroutine

public subroutine polint(xa, ya, x, y, dy)

Arguments

Type IntentOptional Attributes Name
real(kind=8), intent(in), DIMENSION(:) :: xa
real(kind=8), intent(in), DIMENSION(:) :: ya
real(kind=8), intent(in) :: x
real(kind=8), intent(out) :: y
real(kind=8), intent(out) :: dy

Called by

proc~~polint~2~~CalledByGraph proc~polint~2 polint proc~cinter~2 cinter proc~cinter~2->proc~polint~2 proc~finter~2 finter proc~finter~2->proc~polint~2 proc~polin2~2 polin2 proc~polin2~2->proc~polint~2 proc~finter2d~2 finter2d proc~finter2d~2->proc~polin2~2

Source Code

  SUBROUTINE polint(xa,ya,x,y,dy)
    REAL(8), DIMENSION(:), INTENT(IN) :: xa,ya
    REAL(8), INTENT(IN)          :: x
    REAL(8), INTENT(OUT)         :: y,dy
    INTEGER                      :: m,n,ns
    REAL(8), DIMENSION(size(xa)) :: c,d,den,ho
    n=assert_eq(size(xa),size(ya),'polint')
    c=ya
    d=ya
    ho=xa-x
    ns=iminloc(abs(x-xa))
    y=ya(ns)
    ns=ns-1
    do m=1,n-1
       den(1:n-m)=ho(1:n-m)-ho(1+m:n)
       if (any(den(1:n-m) == 0.d0))then
          print*,'polint: calculation failure'
          stop
       endif
       den(1:n-m)=(c(2:n-m+1)-d(1:n-m))/den(1:n-m)
       d(1:n-m)=ho(1+m:n)*den(1:n-m)
       c(1:n-m)=ho(1:n-m)*den(1:n-m)
       if (2*ns < n-m) then
          dy=c(ns+1)
       else
          dy=d(ns)
          ns=ns-1
       end if
       y=y+dy
    end do
  END SUBROUTINE polint