gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
banslv.f
Go to the documentation of this file.
1  subroutine banslv ( w, nroww, nrow, nbandl, nbandu, b )
2 
3 c*********************************************************************72
4 c
5 cc BANSLV solves a banded linear system A * X = B factored by BANFAC.
6 c
7 c from * a practical guide to splines * by c. de boor
8 c companion routine to banfac . it returns the solution x of the
9 c linear system a*x = b in place of b , given the lu-factorization
10 c for a in the workarray w .
11 c
12 c****** i n p u t ******
13 c w, nroww,nrow,nbandl,nbandu.....describe the lu-factorization of a
14 c banded matrix a of order nrow as constructed in banfac .
15 c for details, see banfac .
16 c b.....right side of the system to be solved .
17 c
18 c****** o u t p u t ******
19 c b.....contains the solution x , of order nrow .
20 c
21 c****** m e t h o d ******
22 c (with a = l*u, as stored in w,) the unit lower triangular system
23 c l(u*x) = b is solved for y = u*x, and y stored in b . then the
24 c upper triangular system u*x = y is solved for x . the calcul-
25 c ations are so arranged that the innermost loops stay within columns.
26 c
27  implicit none
28 
29  integer nbandl,nbandu,nrow,nroww, i,j,jmax,middle,nrowm1
30  double precision w(nroww,nrow),b(nrow)
31  middle = nbandu + 1
32  if (nrow .eq. 1) go to 49
33  nrowm1 = nrow - 1
34  if (nbandl .eq. 0) go to 30
35 c forward pass
36 c for i=1,2,...,nrow-1, subtract right side(i)*(i-th column
37 c of l ) from right side (below i-th row) .
38  do 21 i=1,nrowm1
39  jmax = min0(nbandl, nrow-i)
40  do 21 j=1,jmax
41  21 b(i+j) = b(i+j) - b(i)*w(middle+j,i)
42 c backward pass
43 c for i=nrow,nrow-1,...,1, divide right side(i) by i-th diag-
44 c onal entry of u, then subtract right side(i)*(i-th column
45 c of u) from right side (above i-th row).
46  30 if (nbandu .gt. 0) go to 40
47 c a is lower triangular .
48  do 31 i=1,nrow
49  31 b(i) = b(i)/w(1,i)
50  return
51  40 i = nrow
52  41 b(i) = b(i)/w(middle,i)
53  jmax = min0(nbandu,i-1)
54  do 45 j=1,jmax
55  45 b(i-j) = b(i-j) - b(i)*w(middle-j,i)
56  i = i - 1
57  if (i .gt. 1) go to 41
58  49 b(1) = b(1)/w(middle,1)
59  return
60  end
subroutine banslv(w, nroww, nrow, nbandl, nbandu, b)
Definition: banslv.f:2
gtkIOStream: /tmp/gtkiostream/src/deBoor/banslv.f Source File
GTK+ IOStream  Beta