SUBROUTINE USPCN(Y,A,N,G,H) * Calculation of B-spline coefficients A(N) from equidistant function * values in array Y(N), using the not-a-knot condition. * Arrays Y(*) and A(*) may be identical. * G(N) and H(N) are auxiliary arrays used during computation. REAL Y(N),A(N),G(N),H(N) DO I=2,N G(I)=Y(I)-Y(I-1) END DO H(1)=(5.0*G(2)+G(3))/2.0 H(2)=-H(1)+3.0*(G(3)+G(2)) G(2)=2.0 DO I=3,N-1 H(I)=-H(I-1)/G(I-1)+3.0*(G(I+1)+G(I)) G(I)=4.0-1.0/G(I-1) END DO H(N)=(5.0*G(N)+Y(N-1)-Y(N-2))/2.0 G(N)=1.0-2.0/G(N-1) * backward ... H(N)=(-2.0*H(N-1)/G(N-1)+H(N))/G(N) DO I=N-1,2,-1 H(I)=(H(I)-H(I+1))/G(I) END DO H(1)=(H(1)-2.0*H(2)) * ... and forward solution ALN=Y(N)+Y(N)-Y(N-1)-(2.0*H(N)+H(N-1))/3.0 DO I=1,N-1 A(I)=Y(I)+Y(I)-Y(I+1)+(2.0*H(I)+H(I+1))/3.0 END DO A(N)=ALN END