gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
bspp2d.f
Go to the documentation of this file.
1  subroutine bspp2d ( t, bcoef, n, k, m, scrtch, break, coef) ********
2 
3 c*********************************************************************72
4 c
5 cc BSPP2D converts from B-spline to piecewise polynomial representation.
6 c
7 c from * a practical guide to splines * by c. de Boor
8 calls bsplvb
9 c this is an extended version of bsplpp for use with tensor products --------
10 c
11 converts the b-representation t, bcoef(.,j), n, k of some spline into --------
12 c its pp-representation break, coef(j,.,.), l, k , j=1, ..., m . --------
13 c
14 c****** i n p u t ******
15 c t.....knot sequence, of length n+k
16 c bcoef(.,j) b-spline coefficient sequence, of length n ,j=1,...,m --------
17 c n.....length of bcoef and dimension of spline space spline(k,t)
18 c k.....order of the spline
19 c
20 c w a r n i n g . . . the restriction k .le. kmax (= 20) is impo-
21 c sed by the arbitrary dimension statement for biatx below, but
22 c is n o w h e r e c h e c k e d for.
23 c
24 c m number of data sets ********
25 c
26 c****** w o r k a r e a ******
27 c scrtch of size (k,k,m), needed to contain bcoeffs of a piece of ********
28 c the spline and its k-1 derivatives for each of the m sets --------
29 c
30 c****** o u t p u t ******
31 c break.....breakpoint sequence, of length l+1, contains (in increas-
32 c ing order) the distinct points in the sequence t(k),...,t(n+1)
33 c coef(mm,.,.) array of size (k,n), with coef(mm,i,j) = (i-1)st der- ********
34 c ivative of mm-th spline at break(j) from the right, mm=1,.,m ********
35 c
36 c****** m e t h o d ******
37 c for each breakpoint interval, the k relevant b-coeffs of the
38 c spline are found and then differenced repeatedly to get the b-coeffs
39 c of all the derivatives of the spline on that interval. the spline and
40 c its first k-1 derivatives are then evaluated at the left end point
41 c of that interval, using bsplvb repeatedly to obtain the values of
42 c all b-splines of the appropriate order at that point.
43 c
44  implicit none
45 
46  integer k,m,n, i,j,jp1,kmax,kmj,left,lsofar,mm ********
47  parameter(kmax = 20)
48  double precision bcoef(n,m),break(n+2-k),coef(m,k,n+1-k),t(n+k) ********
49  & ,scrtch(k,k,m),biatx(kmax),diff,fkmj,sum
50 c
51  lsofar = 0
52  break(1) = t(k)
53  do 50 left=k,n
54 c find the next nontrivial knot interval.
55  if (t(left+1) .eq. t(left)) go to 50
56  lsofar = lsofar + 1
57  break(lsofar+1) = t(left+1)
58  if (k .gt. 1) go to 9
59  do 5 mm=1,m ********
60  5 coef(mm,1,lsofar) = bcoef(left,mm) ********
61  go to 50
62 c store the k b-spline coeff.s relevant to current knot interval
63 c in scrtch(.,1) .
64  9 do 10 i=1,k
65  do 10 mm=1,m ********
66  10 scrtch(i,1,mm) = bcoef(left-k+i,mm) ********
67 c
68 c for j=1,...,k-1, compute the k-j b-spline coeff.s relevant to
69 c current knot interval for the j-th derivative by differencing
70 c those for the (j-1)st derivative, and store in scrtch(.,j+1) .
71  do 20 jp1=2,k
72  j = jp1 - 1
73  kmj = k - j
74  fkmj = dble(kmj)
75  do 20 i=1,kmj
76  diff = (t(left+i) - t(left+i - kmj))/fkmj --------
77  if (diff .le. 0.0d+00) go to 20 --------
78  do 15 mm=1,m ********
79  15 scrtch(i,jp1,mm) = ********
80  * (scrtch(i+1,j,mm) - scrtch(i,j,mm))/diff ********
81  20 continue
82 c
83 c for j = 0, ..., k-1, find the values at t(left) of the j+1
84 c b-splines of order j+1 whose support contains the current
85 c knot interval from those of order j (in biatx ), then comb-
86 c ine with the b-spline coeff.s (in scrtch(.,k-j) ) found earlier
87 c to compute the (k-j-1)st derivative at t(left) of the given
88 c spline.
89 c note. if the repeated calls to bsplvb are thought to gene-
90 c rate too much overhead, then replace the first call by
91 c biatx(1) = 1.
92 c and the subsequent call by the statement
93 c j = jp1 - 1
94 c followed by a direct copy of the lines
95 c deltar(j) = t(left+j) - x
96 c ......
97 c biatx(j+1) = saved
98 c from bsplvb . deltal(kmax) and deltar(kmax) would have to
99 c appear in a dimension statement, of course.
100 c
101  call bsplvb ( t, 1, 1, t(left), left, biatx )
102  do 25 mm=1,m ********
103  25 coef(mm,k,lsofar) = scrtch(1,k,mm) ********
104  do 30 jp1=2,k
105  call bsplvb ( t, jp1, 2, t(left), left, biatx )
106  kmj = k+1 - jp1
107  do 30 mm=1,m ********
108  sum = 0.0d+00 --------
109  do 28 i=1,jp1 --------
110  28 sum = biatx(i)*scrtch(i,kmj,mm) + sum ********
111  30 coef(mm,kmj,lsofar) = sum ********
112  50 continue
113  return
114  end
subroutine bsplvb(t, jhigh, index, x, left, biatx)
Definition: bsplvb.f:2
subroutine bspp2d(t, bcoef, n, k, m, scrtch, break, coef)
Definition: bspp2d.f:2
gtkIOStream: /tmp/gtkiostream/src/deBoor/bspp2d.f Source File
GTK+ IOStream  Beta