gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
newnot.f
Go to the documentation of this file.
1  subroutine newnot ( break, coef, l, k, brknew, lnew, coefg )
2 
3 c*********************************************************************72
4 c
5 cc NEWNOT returns LNEW+1 knots which are equidistributed on (A,B)
6 c
7 c from * a practical guide to splines * by c. de boor
8 c returns lnew+1 knots in brknew which are equidistributed on (a,b)
9 c = (break(1),break(l+1)) wrto a certain monotone fctn g related to
10 c the k-th root of the k-th derivative of the pp function f whose pp-
11 c representation is contained in break, coef, l, k .
12 c
13 c****** i n p u t ******
14 c break, coef, l, k.....contains the pp-representation of a certain
15 c function f of order k . Specifically,
16 c d**(k-1)f(x) = coef(k,i) for break(i).le. x .lt.break(i+1)
17 c lnew.....number of intervals into which the interval (a,b) is to be
18 c sectioned by the new breakpoint sequence brknew .
19 c
20 c****** o u t p u t ******
21 c brknew.....array of length lnew+1 containing the new breakpoint se-
22 c quence
23 c coefg.....the coefficient part of the pp-repr. break, coefg, l, 2
24 c for the monotone p.linear function g wrto which brknew will
25 c be equidistributed.
26 c
27 c****** optional p r i n t e d o u t p u t ******
28 c coefg.....the pp coeffs of g are printed out if iprint is set
29 c .gt. 0 in data statement below.
30 c
31 c****** m e t h o d ******
32 c The k-th derivative of the given pp function f does not exist
33 c (except perhaps as a linear combination of delta functions). Never-
34 c theless, we construct a p.constant function h with breakpoint se-
35 c quence break which is approximately proportional to abs(d**k(f)).
36 c Specifically, on (break(i), break(i+1)),
37 c
38 c abs(jump at break(i) of pc) abs(jump at break(i+1) of pc)
39 c h = -------------------------- + ----------------------------
40 c break(i+1) - break(i-1) break(i+2) - break(i)
41 c
42 c with pc the p.constant (k-1)st derivative of f .
43 c Then, the p.linear function g is constructed as
44 c
45 c g(x) = integral of h(y)**(1/k) for y from a to x
46 c
47 c and its pp coeffs. stored in coefg .
48 c then brknew is determined by
49 c
50 c brknew(i) = a + g**(-1)((i-1)*step) , i=1,...,lnew+1
51 c
52 c where step = g(b)/lnew and (a,b) = (break(1),break(l+1)) .
53 c In the event that pc = d**(k-1)(f) is constant in (a,b) and
54 c therefore h = 0 identically, brknew is chosen uniformly spaced.
55 c
56  implicit none
57 
58  integer k,l,lnew, i,iprint,j
59  double precision break(1),brknew(1),coef(k,l),coefg(2,l),
60  & dif,difprv,oneovk
61  & ,step,stepi
62 c dimension break(l+1), brknew(lnew+1)
63 current fortran standard makes it impossible to specify the dimension
64 c of break and brknew without the introduction of additional
65 c otherwise superfluous arguments.
66  data iprint /0/
67 c
68  brknew(1) = break(1)
69  brknew(lnew+1) = break(l+1)
70 c if g is constant, brknew is uniform.
71  if (l .le. 1) go to 90
72 c construct the continuous p.linear function g .
73  oneovk = 1.0d+00/dble(k)
74  coefg(1,1) = 0.0d+00
75  difprv = dabs(coef(k,2) - coef(k,1))/(break(3)-break(1))
76  do 10 i=2,l
77  dif = dabs(coef(k,i) - coef(k,i-1))/(break(i+1) - break(i-1))
78  coefg(2,i-1) = (dif + difprv)**oneovk
79  coefg(1,i) = coefg(1,i-1)+coefg(2,i-1)*(break(i)-break(i-1))
80  10 difprv = dif
81  coefg(2,l) = (2.0d+00*difprv)**oneovk
82 c step = g(b)/lnew
83  step = (coefg(1,l)+coefg(2,l)*(break(l+1)-break(l)))/dble(lnew)
84 c
85  if (iprint .gt. 0) print 600, step,(i,coefg(1,i),coefg(2,i),i=1,l)
86  600 format(7h step =,e16.7/(i5,2e16.5))
87 c if g is constant, brknew is uniform .
88  if (step .le. 0.0d+00) go to 90
89 c
90 c For i=2,...,lnew, construct brknew(i) = a + g**(-1)(stepi),
91 c with stepi = (i-1)*step . this requires inversion of the p.lin-
92 c ear function g . For this, j is found so that
93 c g(break(j)) .le. stepi .le. g(break(j+1))
94 c and then
95 c brknew(i) = break(j) + (stepi-g(break(j)))/dg(break(j)) .
96 c The midpoint is chosen if dg(break(j)) = 0 .
97  j = 1
98  do 30 i=2,lnew
99  stepi = dble(i-1)*step
100  21 if (j .eq. l) go to 27
101  if (stepi .le. coefg(1,j+1))go to 27
102  j = j + 1
103  go to 21
104  27 if (coefg(2,j) .eq. 0.0d+00) go to 29
105  brknew(i) = break(j) + (stepi - coefg(1,j))/coefg(2,j)
106  go to 30
107  29 brknew(i) = (break(j) + break(j+1))/2.
108  30 continue
109  return
110 c
111 c if g is constant, brknew is uniform .
112  90 step = (break(l+1) - break(1))/dble(lnew)
113  do 93 i=2,lnew
114  93 brknew(i) = break(1) + dble(i-1)*step
115  return
116  end
subroutine newnot(break, coef, l, k, brknew, lnew, coefg)
Definition: newnot.f:2
gtkIOStream: /tmp/gtkiostream/src/deBoor/newnot.f Source File
GTK+ IOStream  Beta