************80
! L2APPR constructs a weighted L2 spline approximation to given data.
Discussion:
The routine constructs the weighted discrete L2-approximation by
splines of order K with knot sequence T(1:N+K) to
given data points ( TAU(1:NTAU), GTAU(1:NTAU) ).
The B-spline coefficients BCOEF of the approximating spline are
determined from the normal equations using Cholesky's method.
Method:
The B-spline coefficients of the L2-approximation are determined as the
solution of the normal equations, for 1 <= I <= N:
sum ( 1 <= J <= N ) ( B(I), B(J) ) * BCOEF(J) = ( B(I), G ).
Here, B(I) denotes the I-th B-spline, G denotes the function to
be approximated, and the inner product of two functions F and G
is given by
( F, G ) = sum ( 1 <= I <= NTAU ) WEIGHT(I) * F(TAU(I)) * G(TAU(I)).
The arrays TAU and WEIGHT are given in common block DATA, as is the
array GTAU(1:NTAU) = G(TAU(1:NTAU)).
The values of the B-splines B(1:N) are supplied by BSPLVB.
The coefficient matrix C, with
C(I,J) = ( B(I), B(J) )
of the normal equations is symmetric and (2*K-1)-banded, therefore
can be specified by giving its K bands at or below the diagonal.
For I = 1:N and J = I:min(I+K-1,N), we store
( B(I), B(J) ) = C(I,J)
in
Q(I-J+1,J),
and the right hand side
( B(I), G )
in
BCOEF(I).
Since B-spline values are most efficiently generated by finding
simultaneously the value of every nonzero B-spline at one point,
the entries of C (that is, of Q), are generated by computing, for
each LL, all the terms involving TAU(LL) simultaneously and adding
them to all relevant entries.
Modified:
14 February 2007
Author:
Carl DeBoor
Reference:
Carl DeBoor,
A Practical Guide to Splines,
Springer, 2001,
ISBN: 0387953663,
LC: QA1.A647.v27.
Parameters:
Input, real ( kind = 8 ) T(N+K), the knot sequence.
Input, integer ( kind = 4 ) N, the dimension of the space of splines
of order K with knots T.
Input, integer ( kind = 4 ) K, the order of the splines.
Workspace, real ( kind = 8 ) Q(K,N), used to store the K lower
diagonals of the Gramian matrix C.
Workspace, real ( kind = 8 ) DIAG(N), used in BCHFAC.
Output, real ( kind = 8 ) BCOEF(N), the B-spline coefficients of
the L2 approximation to the data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=8) | :: | t(n+k) | ||||
integer(kind=4) | :: | n | ||||
integer(kind=4) | :: | k | ||||
real(kind=8) | :: | q(k,n) | ||||
real(kind=8) | :: | diag(n) | ||||
real(kind=8) | :: | bcoef(n) |
Type | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|
integer(kind=4) | :: | ntau |