1 | subroutine bsplvb ( t, jhigh, index, x, left, biatx ) |
---|
2 | c from * a practical guide to splines * by c. de boor |
---|
3 | calculates the value of all possibly nonzero b-splines at x of order |
---|
4 | c |
---|
5 | c jout = max( jhigh , (j+1)*(index-1) ) |
---|
6 | c |
---|
7 | c with knot sequence t . |
---|
8 | c |
---|
9 | c****** i n p u t ****** |
---|
10 | c t.....knot sequence, of length left + jout , assumed to be nonde- |
---|
11 | c creasing. a s s u m p t i o n . . . . |
---|
12 | c t(left) .lt. t(left + 1) . |
---|
13 | c d i v i s i o n b y z e r o will result if t(left) = t(left+1) |
---|
14 | c jhigh, |
---|
15 | c index.....integers which determine the order jout = max(jhigh, |
---|
16 | c (j+1)*(index-1)) of the b-splines whose values at x are to |
---|
17 | c be returned. index is used to avoid recalculations when seve- |
---|
18 | c ral columns of the triangular array of b-spline values are nee- |
---|
19 | c ded (e.g., in bsplpp or in bsplvd ). precisely, |
---|
20 | c if index = 1 , |
---|
21 | c the calculation starts from scratch and the entire triangular |
---|
22 | c array of b-spline values of orders 1,2,...,jhigh is generated |
---|
23 | c order by order , i.e., column by column . |
---|
24 | c if index = 2 , |
---|
25 | c only the b-spline values of order j+1, j+2, ..., jout are ge- |
---|
26 | c nerated, the assumption being that biatx , j , deltal , deltar |
---|
27 | c are, on entry, as they were on exit at the previous call. |
---|
28 | c in particular, if jhigh = 0, then jout = j+1, i.e., just |
---|
29 | c the next column of b-spline values is generated. |
---|
30 | c |
---|
31 | c w a r n i n g . . . the restriction jout .le. jmax (= 20) is im- |
---|
32 | c posed arbitrarily by the dimension statement for deltal and |
---|
33 | c deltar below, but is n o w h e r e c h e c k e d for . |
---|
34 | c |
---|
35 | c x.....the point at which the b-splines are to be evaluated. |
---|
36 | c left.....an integer chosen (usually) so that |
---|
37 | c t(left) .le. x .le. t(left+1) . |
---|
38 | c |
---|
39 | c****** o u t p u t ****** |
---|
40 | c biatx.....array of length jout , with biatx(i) containing the val- |
---|
41 | c ue at x of the polynomial of order jout which agrees with |
---|
42 | c the b-spline b(left-jout+i,jout,t) on the interval (t(left), |
---|
43 | c t(left+1)) . |
---|
44 | c |
---|
45 | c****** m e t h o d ****** |
---|
46 | c the recurrence relation |
---|
47 | c |
---|
48 | c x - t(i) t(i+j+1) - x |
---|
49 | c b(i,j+1)(x) = -----------b(i,j)(x) + ---------------b(i+1,j)(x) |
---|
50 | c t(i+j)-t(i) t(i+j+1)-t(i+1) |
---|
51 | c |
---|
52 | c is used (repeatedly) to generate the (j+1)-vector b(left-j,j+1)(x), |
---|
53 | c ...,b(left,j+1)(x) from the j-vector b(left-j+1,j)(x),..., |
---|
54 | c b(left,j)(x), storing the new values in biatx over the old. the |
---|
55 | c facts that |
---|
56 | c b(i,1) = 1 if t(i) .le. x .lt. t(i+1) |
---|
57 | c and that |
---|
58 | c b(i,j)(x) = 0 unless t(i) .le. x .lt. t(i+j) |
---|
59 | c are used. the particular organization of the calculations follows al- |
---|
60 | c gorithm (8) in chapter x of the text. |
---|
61 | c |
---|
62 | integer index,jhigh,left, i,j,jmax,jp1 |
---|
63 | parameter (jmax = 20) |
---|
64 | real biatx(jhigh),t(1),x, deltal(jmax),deltar(jmax),saved,term |
---|
65 | C real biatx(jhigh),t(1),x, deltal(20),deltar(20),saved,term |
---|
66 | c dimension biatx(jout), t(left+jout) |
---|
67 | current fortran standard makes it impossible to specify the length of |
---|
68 | c t and of biatx precisely without the introduction of otherwise |
---|
69 | c superfluous additional arguments. |
---|
70 | data j/1/ |
---|
71 | save j,deltal,deltar |
---|
72 | c |
---|
73 | go to (10,20), index |
---|
74 | 10 j = 1 |
---|
75 | biatx(1) = 1. |
---|
76 | if (j .ge. jhigh) go to 99 |
---|
77 | c |
---|
78 | 20 jp1 = j + 1 |
---|
79 | deltar(j) = t(left+j) - x |
---|
80 | deltal(j) = x - t(left+1-j) |
---|
81 | saved = 0. |
---|
82 | do 26 i=1,j |
---|
83 | term = biatx(i)/(deltar(i) + deltal(jp1-i)) |
---|
84 | biatx(i) = saved + deltar(i)*term |
---|
85 | 26 saved = deltal(jp1-i)*term |
---|
86 | biatx(jp1) = saved |
---|
87 | j = jp1 |
---|
88 | if (j .lt. jhigh) go to 20 |
---|
89 | c |
---|
90 | 99 return |
---|
91 | end |
---|