dbknot chooses a knot sequence for interpolation of order k at the data points x(i), i=1,..,n. the n+k knots are placed in the array t. k knots are placed at each endpoint and not-a-knot end conditions are used. the remaining knots are placed at data points if n is even and between data points if n is odd. the rightmost knot is shifted slightly to the right to insure proper interpolation at x(n) (see page 350 of the reference).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(n) | :: | x | ||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | k | |||
real(kind=wp), | intent(out), | dimension(:) | :: | t |
subroutine dbknot(x,n,k,t) implicit none integer,intent(in) :: n integer,intent(in) :: k real(wp),dimension(n),intent(in) :: x real(wp),dimension(:),intent(out) :: t integer :: i, j, ipj, npj, ip1, jstrt real(wp) :: rnot !put k knots at each endpoint !(shift right endpoints slightly -- see pg 350 of reference) rnot = x(n) + 0.1_wp*( x(n)-x(n-1) ) do j=1,k t(j) = x(1) npj = n + j t(npj) = rnot enddo !distribute remaining knots if (mod(k,2) == 1) then !case of odd k -- knots between data points i = (k-1)/2 - k ip1 = i + 1 jstrt = k + 1 do j=jstrt,n ipj = i + j t(j) = 0.5_wp*( x(ipj) + x(ipj+1) ) enddo else !case of even k -- knots at data points i = (k/2) - k jstrt = k+1 do j=jstrt,n ipj = i + j t(j) = x(ipj) enddo endif endsubroutine dbknot