gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
bsplvd.f
Go to the documentation of this file.
1  subroutine bsplvd ( t, k, x, left, a, dbiatx, nderiv )
2 
3 c*********************************************************************72
4 c
5 cc BSPLVD calculates the nonvanishing B-splines and derivatives at X.
6 c
7 c from * a practical guide to splines * by c. de Boor (7 may 92)
8 calls bsplvb
9 calculates value and deriv.s of all b-splines which do not vanish at x
10 c
11 c****** i n p u t ******
12 c t the knot array, of length left+k (at least)
13 c k the order of the b-splines to be evaluated
14 c x the point at which these values are sought
15 c left an integer indicating the left endpoint of the interval of
16 c interest. the k b-splines whose support contains the interval
17 c (t(left), t(left+1))
18 c are to be considered.
19 c a s s u m p t i o n - - - it is assumed that
20 c t(left) .lt. t(left+1)
21 c division by zero will result otherwise (in b s p l v b ).
22 c also, the output is as advertised only if
23 c t(left) .le. x .le. t(left+1) .
24 c nderiv an integer indicating that values of b-splines and their
25 c derivatives up to but not including the nderiv-th are asked
26 c for. ( nderiv is replaced internally by the integer m h i g h
27 c in (1,k) closest to it.)
28 c
29 c****** w o r k a r e a ******
30 c a an array of order (k,k), to contain b-coeff.s of the derivat-
31 c ives of a certain order of the k b-splines of interest.
32 c
33 c****** o u t p u t ******
34 c dbiatx an array of order (k,nderiv). its entry (i,m) contains
35 c value of (m-1)st derivative of (left-k+i)-th b-spline of
36 c order k for knot sequence t , i=1,...,k, m=1,...,nderiv.
37 c
38 c****** m e t h o d ******
39 c values at x of all the relevant b-splines of order k,k-1,...,
40 c k+1-nderiv are generated via bsplvb and stored temporarily in
41 c dbiatx . then, the b-coeffs of the required derivatives of the b-
42 c splines of interest are generated by differencing, each from the pre-
43 c ceding one of lower order, and combined with the values of b-splines
44 c of corresponding order in dbiatx to produce the desired values .
45 c
46  implicit none
47 
48  integer k,left,nderiv, i,ideriv,il,j,jlow,jp1mid,kp1,kp1mm
49  * ,ldummy,m,mhigh
50  double precision a(k,k),dbiatx(k,nderiv),t(1),x,
51  & factor,fkp1mm,sum
52  mhigh = max0(min0(nderiv,k),1)
53 c mhigh is usually equal to nderiv.
54  kp1 = k+1
55  call bsplvb(t,kp1-mhigh,1,x,left,dbiatx)
56  if (mhigh .eq. 1) go to 99
57 c the first column of dbiatx always contains the b-spline values
58 c for the current order. these are stored in column k+1-current
59 c order before bsplvb is called to put values for the next
60 c higher order on top of it.
61  ideriv = mhigh
62  do 15 m=2,mhigh
63  jp1mid = 1
64  do 11 j=ideriv,k
65  dbiatx(j,ideriv) = dbiatx(jp1mid,1)
66  11 jp1mid = jp1mid + 1
67  ideriv = ideriv - 1
68  call bsplvb(t,kp1-ideriv,2,x,left,dbiatx)
69  15 continue
70 c
71 c at this point, b(left-k+i, k+1-j)(x) is in dbiatx(i,j) for
72 c i=j,...,k and j=1,...,mhigh ('=' nderiv). in particular, the
73 c first column of dbiatx is already in final form. to obtain cor-
74 c responding derivatives of b-splines in subsequent columns, gene-
75 c rate their b-repr. by differencing, then evaluate at x.
76 c
77  jlow = 1
78  do 20 i=1,k
79  do 19 j=jlow,k
80  19 a(j,i) = 0.0d+00
81  jlow = i
82  20 a(i,i) = 1.0d+00
83 c at this point, a(.,j) contains the b-coeffs for the j-th of the
84 c k b-splines of interest here.
85 c
86  do 40 m=2,mhigh
87  kp1mm = kp1 - m
88  fkp1mm = dble(kp1mm)
89  il = left
90  i = k
91 c
92 c for j=1,...,k, construct b-coeffs of (m-1)st derivative of
93 c b-splines from those for preceding derivative by differencing
94 c and store again in a(.,j) . the fact that a(i,j) = 0 for
95 c i .lt. j is used.
96  do 25 ldummy=1,kp1mm
97  factor = fkp1mm/(t(il+kp1mm) - t(il))
98 c the assumption that t(left).lt.t(left+1) makes denominator
99 c in factor nonzero.
100  do 24 j=1,i
101  24 a(i,j) = (a(i,j) - a(i-1,j))*factor
102  il = il - 1
103  25 i = i - 1
104 c
105 c for i=1,...,k, combine b-coeffs a(.,i) with b-spline values
106 c stored in dbiatx(.,m) to get value of (m-1)st derivative of
107 c i-th b-spline (of interest here) at x , and store in
108 c dbiatx(i,m). storage of this value over the value of a b-spline
109 c of order m there is safe since the remaining b-spline derivat-
110 c ives of the same order do not use this value due to the fact
111 c that a(j,i) = 0 for j .lt. i .
112  do 40 i=1,k
113  sum = 0.0d+00
114  jlow = max0(i,m)
115  do 35 j=jlow,k
116  35 sum = a(j,i)*dbiatx(j,m) + sum
117  40 dbiatx(i,m) = sum
118  99 return
119  end
subroutine bsplvb(t, jhigh, index, x, left, biatx)
Definition: bsplvb.f:2
subroutine bsplvd(t, k, x, left, a, dbiatx, nderiv)
Definition: bsplvd.f:2
gtkIOStream: /tmp/gtkiostream/src/deBoor/bsplvd.f Source File
GTK+ IOStream  Beta