c----------------------------------------------------------------------- *=*=*=*= splint.html =*=*=*=*
subroutine splint

subroutine splint


      subroutine splint(xa,ya,y2a,n,x,y)

c
c     Routine to compute a cubic-spline interpolated value Y given the
c     value of X, the arrays XA, YA and the 2nd derivative array Y2A
c     computed by subroutine SPLINE. See "Numerical Recipes" for details
c

        implicit REAL (a-h,o-z)
        implicit INTEGER (i-n)
      dimension xa(n),ya(n),y2a(n)

      kl0=1

      khi=n
c means of bisection
 1    if(khi-kl0.gt.1) then

       k=(khi+kl0)/2

       if(xa(k).gt.x) then

        khi=k

       else

        kl0=k

       end if

       go to 1

      end if
c KL0 and KHI now bracket the X
      h=xa(khi)-xa(kl0)

      if(h.eq.0.0) stop
      a=(xa(khi)-x)/h
c evaluation of cubic spline polynomial
      b=(x-xa(kl0))/h

      y=a*ya(kl0)+b*ya(khi)+((a**3-a)*y2a(kl0)+(b**3-b)*y2a(khi))*(h**2)

     ./6.

c

      return

      end