gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
slvblk.f
Go to the documentation of this file.
1  subroutine slvblk ( bloks, integs, nbloks, b, ipivot, x, iflag )
2 
3 c*********************************************************************72
4 c
5 cc SLVBLK solves the almost block diagonal linear system A * x = b.
6 c
7 c this program solves the linear system a*x = b where a is an
8 c almost block diagonal matrix. such almost block diagonal matrices
9 c arise naturally in piecewise polynomial interpolation or approx-
10 c imation and in finite element methods for two-point boundary value
11 c problems. the plu factorization method is implemented here to take
12 c advantage of the special structure of such systems for savings in
13 c computing time and storage requirements.
14 c
15 c parameters
16 c bloks a one-dimenional array, of length
17 c sum( integs(1,i)*integs(2,i) ; i = 1,nbloks )
18 c on input, contains the blocks of the almost block diagonal
19 c matrix a . the array integs (see below and the example)
20 c describes the block structure.
21 c on output, contains correspondingly the plu factorization
22 c of a (if iflag .ne. 0). certain of the entries into bloks
23 c are arbitrary (where the blocks overlap).
24 c integs integer array description of the block structure of a .
25 c integs(1,i) = no. of rows of block i = nrow
26 c integs(2,i) = no. of colums of block i = ncol
27 c integs(3,i) = no. of elim. steps in block i = last
28 c i = 1,2,...,nbloks
29 c the linear system is of order
30 c n = sum ( integs(3,i) , i=1,...,nbloks ),
31 c but the total number of rows in the blocks is
32 c nbrows = sum( integs(1,i) ; i = 1,...,nbloks)
33 c nbloks number of blocks
34 c b right side of the linear system, array of length nbrows.
35 c certain of the entries are arbitrary, corresponding to
36 c rows of the blocks which overlap (see block structure and
37 c the example below).
38 c ipivot on output, integer array containing the pivoting sequence
39 c used. length is nbrows
40 c x on output, contains the computed solution (if iflag .ne. 0)
41 c length is n.
42 c iflag on output, integer
43 c = (-1)**(no. of interchanges during factorization)
44 c if a is invertible
45 c = 0 if a is singular
46 c
47 c auxiliary programs
48 c fcblok (bloks,integs,nbloks,ipivot,scrtch,iflag) factors the matrix
49 c a , and is used for this purpose in slvblk. its arguments
50 c are as in slvblk, except for
51 c scrtch = a work array of length max(integs(1,i)).
52 c
53 c sbblok (bloks,integs,nbloks,ipivot,b,x) solves the system a*x = b
54 c once a is factored. this is done automatically by slvblk
55 c for one right side b, but subsequent solutions may be
56 c obtained for additional b-vectors. the arguments are all
57 c as in slvblk.
58 c
59 c dtblok (bloks,integs,nbloks,ipivot,iflag,detsgn,detlog) computes the
60 c determinant of a once slvblk or fcblok has done the fact-
61 c orization.the first five arguments are as in slvblk.
62 c detsgn = sign of the determinant
63 c detlog = natural log of the determinant
64 c
65 c ------ block structure of a ------
66 c the nbloks blocks are stored consecutively in the array bloks .
67 c the first block has its (1,1)-entry at bloks(1), and, if the i-th
68 c block has its (1,1)-entry at bloks(index(i)), then
69 c index(i+1) = index(i) + nrow(i)*ncol(i) .
70 c the blocks are pieced together to give the interesting part of a
71 c as follows. for i = 1,2,...,nbloks-1, the (1,1)-entry of the next
72 c block (the (i+1)st block ) corresponds to the (last+1,last+1)-entry
73 c of the current i-th block. recall last = integs(3,i) and note that
74 c this means that
75 c a. every block starts on the diagonal of a .
76 c b. the blocks overlap (usually). the rows of the (i+1)st block
77 c which are overlapped by the i-th block may be arbitrarily de-
78 c fined initially. they are overwritten during elimination.
79 c the right side for the equations in the i-th block are stored cor-
80 c respondingly as the last entries of a piece of b of length nrow
81 c (= integs(1,i)) and following immediately in b the corresponding
82 c piece for the right side of the preceding block, with the right side
83 c for the first block starting at b(1) . in this, the right side for
84 c an equation need only be specified once on input, in the first block
85 c in which the equation appears.
86 c
87 c ------ example and test driver ------
88 c the test driver for this package contains an example, a linear
89 c system of order 11, whose nonzero entries are indicated in the fol-
90 c lowing schema by their row and column index modulo 10. next to it
91 c are the contents of the integs arrray when the matrix is taken to
92 c be almost block diagonal with nbloks = 5, and below it are the five
93 c blocks.
94 c
95 c nrow1 = 3, ncol1 = 4
96 c 11 12 13 14
97 c 21 22 23 24 nrow2 = 3, ncol2 = 3
98 c 31 32 33 34
99 c last1 = 2 43 44 45
100 c 53 54 55 nrow3 = 3, ncol3 = 4
101 c last2 = 3 66 67 68 69 nrow4 = 3, ncol4 = 4
102 c 76 77 78 79 nrow5 = 4, ncol5 = 4
103 c 86 87 88 89
104 c last3 = 1 97 98 99 90
105 c last4 = 1 08 09 00 01
106 c 18 19 10 11
107 c last5 = 4
108 c
109 c actual input to bloks shown by rows of blocks of a .
110 c (the ** items are arbitrary, this storage is used by slvblk)
111 c
112 c 11 12 13 14 / ** ** ** / 66 67 68 69 / ** ** ** ** / ** ** ** **
113 c 21 22 23 24 / 43 44 45 / 76 77 78 79 / ** ** ** ** / ** ** ** **
114 c 31 32 33 34/ 53 54 55/ 86 87 88 89/ 97 98 99 90/ 08 09 00 01
115 c 18 19 10 11
116 c
117 c index = 1 index = 13 index = 22 index = 34 index = 46
118 c
119 c actual right side values with ** for arbitrary values
120 c b1 b2 b3 ** b4 b5 b6 b7 b8 ** ** b9 ** ** b10 b11
121 c
122 c (it would have been more efficient to combine block 3 with block 4)
123 c
124  implicit none
125 
126  integer nbloks
127 
128  integer integs(3,nbloks),ipivot(1),iflag
129  double precision bloks(1),b(1),x(1)
130 c in the call to fcblok, x is used for temporary storage.
131  call fcblok(bloks,integs,nbloks,ipivot,x,iflag)
132  if (iflag .eq. 0) return
133  call sbblok(bloks,integs,nbloks,ipivot,b,x)
134  return
135  end
subroutine fcblok(bloks, integs, nbloks, ipivot, scrtch, iflag)
Definition: fcblok.f:2
subroutine sbblok(bloks, integs, nbloks, ipivot, b, x)
Definition: sbblok.f:2
subroutine slvblk(bloks, integs, nbloks, b, ipivot, x, iflag)
Definition: slvblk.f:2
gtkIOStream: /tmp/gtkiostream/src/deBoor/slvblk.f Source File
GTK+ IOStream  Beta