FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension (:) | :: | x | ||
real, | intent(in) | :: | avh | |||
real, | intent(in), | dimension (:) | :: | y | ||
real, | intent(in), | dimension (:) | :: | dy | ||
integer, | intent(in) | :: | n | |||
real, | intent(in) | :: | p | |||
real, | intent(in) | :: | q | |||
real, | intent(out), | dimension (:) | :: | a | ||
real, | intent(out), | dimension (ic, 3) | :: | c | ||
integer, | intent(in) | :: | ic | |||
real, | intent(inout), | dimension (0:n+1) | :: | u | ||
real, | intent(in), | dimension (0:n+1) | :: | v |
subroutine spcof1(x,avh,y,dy,n,p,q,a,c,ic,u,v)
!
! calculates coefficients of a cubic smoothing spline from
! parameters calculated by subroutine spfit1.
!
!---specifications for arguments---
integer, intent(in) :: ic,n
real, dimension (:), intent(in) :: x, y, dy
real, dimension (:), intent(out) :: a
real, dimension (ic, 3), intent(out) :: c
real, dimension (0:n+1), intent(in out) :: u
real, dimension (0:n+1), intent(in) :: v
real, intent(in) :: p, q, avh
!
!---specifications for local variables---
integer :: i
real :: h,qh
!
!---calculate a---
qh = q/ (avh*avh)
do i = 1,n
a(i) = y(i) - p*dy(i)*v(i)
u(i) = qh*u(i)
end do
!
!---calculate c---
do i = 1,n - 1
h = x(i+1) - x(i)
c(i,3) = (u(i+1)-u(i))/ (3.0d0*h)
c(i,1) = (a(i+1)-a(i))/h - (h*c(i,3)+u(i))*h
c(i,2) = u(i)
end do
end subroutine spcof1