subroutine insert(iopt,t,n,c,k,x,tt,nn,cc,nest,ier) c subroutine insert inserts a new knot x into a spline function s(x) c of degree k and calculates the b-spline representation of s(x) with c respect to the new set of knots. in addition, if iopt.ne.0, s(x) c will be considered as a periodic spline with period per=t(n-k)-t(k+1) c satisfying the boundary constraints c t(i+n-2*k-1) = t(i)+per ,i=1,2,...,2*k+1 c c(i+n-2*k-1) = c(i) ,i=1,2,...,k c in that case, the knots and b-spline coefficients returned will also c satisfy these boundary constraints, i.e. c tt(i+nn-2*k-1) = tt(i)+per ,i=1,2,...,2*k+1 c cc(i+nn-2*k-1) = cc(i) ,i=1,2,...,k c c calling sequence: c call insert(iopt,t,n,c,k,x,tt,nn,cc,nest,ier) c c input parameters: c iopt : integer flag, specifying whether (iopt.ne.0) or not (iopt=0) c the given spline must be considered as being periodic. c t : array,length nest, which contains the position of the knots. c n : integer, giving the total number of knots of s(x). c c : array,length nest, which contains the b-spline coefficients. c k : integer, giving the degree of s(x). c x : real, which gives the location of the knot to be inserted. c nest : integer specifying the dimension of the arrays t,c,tt and cc c nest > n. c c output parameters: c tt : array,length nest, which contains the position of the knots c after insertion. c nn : integer, giving the total number of knots after insertion c cc : array,length nest, which contains the b-spline coefficients c of s(x) with respect to the new set of knots. c ier : error flag c ier = 0 : normal return c ier =10 : invalid input data (see restrictions) c c restrictions: c nest > n c t(k+1) <= x <= t(n-k) c in case of a periodic spline (iopt.ne.0) there must be c either at least k interior knots t(j) satisfying t(k+1)