gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
chol1d.f
Go to the documentation of this file.
1  subroutine chol1d ( p, v, qty, npoint, ncol, u, qu )
2 
3 c*********************************************************************72
4 c
5 cc CHOL1D sets up and solves linear systems needed by SMOOTH.
6 c
7 c from * a practical guide to splines * by c. de boor
8 c from * a practical guide to splines * by c. de boor
9 c to be called in s m o o t h
10 constructs the upper three diags. in v(i,j), i=2,,npoint-1, j=1,3, of
11 c the matrix 6*(1-p)*q-transp.*(d**2)*q + p*r, then computes its
12 c l*l-transp. decomposition and stores it also in v, then applies
13 c forward and backsubstitution to the right side q-transp.*y in qty
14 c to obtain the solution in u .
15 c
16  implicit none
17 
18  integer ncol,npoint, i,npm1,npm2
19  double precision p,qty(npoint),qu(npoint),u(npoint),v(npoint,7),
20  & prev,ratio
21  & ,six1mp,twop
22  npm1 = npoint - 1
23 c construct 6*(1-p)*q-transp.*(d**2)*q + p*r
24  six1mp = 6.0d+00*(1.0d+00-p)
25  twop = 2.0d+00*p
26  do 2 i=2,npm1
27  v(i,1) = six1mp*v(i,5) + twop*(v(i-1,4)+v(i,4))
28  v(i,2) = six1mp*v(i,6) + p*v(i,4)
29  2 v(i,3) = six1mp*v(i,7)
30  npm2 = npoint - 2
31  if (npm2 .ge. 2) go to 10
32  u(1) = 0.0d+00
33  u(2) = qty(2)/v(2,1)
34  u(3) = 0.0d+00
35  go to 41
36 c factorization
37  10 do 20 i=2,npm2
38  ratio = v(i,2)/v(i,1)
39  v(i+1,1) = v(i+1,1) - ratio*v(i,2)
40  v(i+1,2) = v(i+1,2) - ratio*v(i,3)
41  v(i,2) = ratio
42  ratio = v(i,3)/v(i,1)
43  v(i+2,1) = v(i+2,1) - ratio*v(i,3)
44  20 v(i,3) = ratio
45 c
46 c forward substitution
47  u(1) = 0.0d+00
48  v(1,3) = 0.0d+00
49  u(2) = qty(2)
50  do 30 i=2,npm2
51  30 u(i+1) = qty(i+1) - v(i,2)*u(i) - v(i-1,3)*u(i-1)
52 c back substitution
53  u(npoint) = 0.0d+00
54  u(npm1) = u(npm1)/v(npm1,1)
55  i = npm2
56  40 u(i) = u(i)/v(i,1)-u(i+1)*v(i,2)-u(i+2)*v(i,3)
57  i = i - 1
58  if (i .gt. 1) go to 40
59 c construct q*u
60  41 prev = 0.0d+00
61  do 50 i=2,npoint
62  qu(i) = (u(i) - u(i-1))/v(i-1,4)
63  qu(i-1) = qu(i) - prev
64  50 prev = qu(i)
65  qu(npoint) = -qu(npoint)
66  return
67  end
subroutine chol1d(p, v, qty, npoint, ncol, u, qu)
Definition: chol1d.f:2
gtkIOStream: /tmp/gtkiostream/src/deBoor/chol1d.f Source File
GTK+ IOStream  Beta