1
subroutine fpknot(x,m,t,n,fpint,nrdata,nrint,nest,istart)
2
c subroutine fpknot locates an additional knot for a spline of degree
3
c k and adjusts the corresponding parameters,i.e.
4
c t : the position of the knots.
5
c n : the number of knots.
6
c nrint : the number of knotintervals.
7
c fpint : the sum of squares of residual right hand sides
8
c for each knot interval.
9
c nrdata: the number of data points inside each knot interval.
10
c istart indicates that the smallest data point at which the new knot
11
c may be added is x(istart+1)
13
c ..scalar arguments..
14
integer m,n,nrint,nest,istart
16
real*8 x(m),t(nest),fpint(nest)
20
integer ihalf,j,jbegin,jj,jk,jpoint,k,maxbeg,maxpt,
24
c search for knot interval t(number+k) <= x <= t(number+k+1) where
25
c fpint(number) is maximal on the condition that nrdata(number)
31
if(fpmax.ge.fpint(j) .or. jpoint.eq.0) go to 10
36
10 jbegin = jbegin+jpoint+1
38
c let coincide the new knot t(number+k+1) with a data point x(nrx)
39
c inside the old knot interval t(number+k) <= x <= t(number+k+1).
43
if(next.gt.nrint) go to 40
44
c adjust the different parameters.
47
fpint(jj+1) = fpint(jj)
48
nrdata(jj+1) = nrdata(jj)
52
40 nrdata(number) = ihalf-1
53
nrdata(next) = maxpt-ihalf
56
fpint(number) = fpmax*an/am
58
fpint(next) = fpmax*an/am