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