Lecture3 PDF
Lecture3 PDF
1 Method of LU decomposition
To solve for the matrices L and U for given matrix A, let us write the i, j th element of equation
(3.40). In general, the element aij can be represented as (from equation (3.40)),
The number of terms in the sum of equation (3.47) depends on whether i or j is the smaller
number. We have in fact three distinct cases:
i = j; i1 1j + i2 2j + + ii jj = aij (3.49)
ii = 1; i = 1, 2, N (3.51)
With the condition of equation (3.51), an elegant procedure called Crouts algorithm quite
easily solves for the N 2 unknown and by just rearranging the equations in a certain order.
The algorithm is as follows:
i1
ij = aij ik kj (3.52)
k=1
j1
1
ij = [aij ik kj ] (3.53)
jj k=1
These first and second operations both need to be carried out before going to next value of
j.
95
3.4.2 Example of LU decomposition
3 2 7
Decompose the matrix A =
2 3 1 in LU form through Crouts algorithm.
3 4 1
3 2 7 0 11 12 13
11 0
Solution: Let A =
2 3 1 = 21 22 0 0 22 23
3 4 1 31 32 33 0 0
33
Applying Crouts algorithm; 11 = 1; 22 = 1; 33 = 1;
For j = 1;
i = 1 11 = a11 = 3;
1 2
i = 2 21 = (a21 0) = ;
11 3
1 3
i = 3 31 = (a31 0) = = 1;
11 3
For j = 2;
i = 1 12 = a12 = 2;
5
i = 2 22 = a22 21 12 = ;
3
1 6
i = 3 32 = (a32 31 12 ) = ;
22 5
For j = 3;
i = 1 13 = a13 = 7;
11
i = 2 23 = a23 21 13 = ;
13
8
i = 3 33 = a33 31 13 32 23 = ;
5
3 2 7 1 0 0 3 2 7
Hence,
2 3 1 = 2/3 1 0 0 5/3 11/3
3 4 1 1 6/5 1 0 0 8/5
There are several methods available in the literature for storing a sparse matrix. Some of these
schemes are described here.
96
Random packing:
In this method, every non-zero element of the matrix is stored in a primary array while its row and
column indices are stored in two secondary arrays. As each element in individually identified, the
elements can be stored in a random manner. For example, the sparse matrixes shown in equation
(3.54) are stored in one primary array and two secondary arrays as shown below.
0 0 0 0
0
A = 0 0 2.67 0 3.12 (3.54)
1.25 0.29 0 0 2.31
Systematic packing:
In case the elements of a sparse matrix are read or constructed or sorted in a systematic order, then
there is no need to adopt both row and column indices for each element. Instead some alternative,
more efficient schemes can be adopted as described below.
In this case, the array of row address IST has been constructed such that the number of non-zero
elements in row i is IST(I+1)-IST(I). Thus, for a matrix with m rows, the array IST will have
(m+1) entries. For example, from the array IST, the number of non-zero elements in 1st row of
the matrix A is IST(2) - IST(1) = 1 - 1 = 0, which is indeed true as observed from equation (3.54).
Similarly, the array IST indicates that the number of non-zero elements in 2nd row of the matrix A
is IST(3) - IST(2) = 3 - 1 = 2 and from the first two elements of the array JA, these two elements
are located at columns 3 and 5 of the matrix whereas the elements themselves are given by the first
two elements of the real array (2.67 and 3.12) (which is again true from equation (3.54)). In a similar
way, the elements and the locations of the elements in the third row of the matrix A can easily be
identified from the above three arrays. Moreover, please note that, as the number of rows in the
matrix A is 3, the total number of entries in array IST is 4.
97
b) The use of dummy variables:
In this scheme, the integer array IST is not used. Instead, dummy variables are introduced in
the array JA itself to indicate the beginning of each row and the end of the matrix. For example,
a zero entry (except the last one) in the array JA could indicate the presence of dummy variables
and the dummy variables itself could specify the row number. Moreover, the non-zero elements
would indicate the column number of the elements. Also, as before, the zero at the end of the array
indicates the termination of the list. Hence the matrix A of equation (3.54) in this scheme looks like
c) Compound identifiers:
In the random packing scheme it in possible to reduce the storage requirement by combining the
two indices for each element so that these can be held in one integer storage. A suitable compound
identifier could be (n i + j) where n is an integer higher than the number of columns in the matrix
and (i, j) denote the position of the non-zero element in the matrix. For example, the matrix A in
equation (3.54) could look like
In the above, n has been chosen to be equal to 1000. Also, in the real array, the entry zero
indicates the end of the array and the corresponding entry in the integer array is 9999 (to signifies
the end of the integer array).
However, unless compound identifiers yield necessary or highly desirable storage saving, it should
not be used because of the following reasons:
i) Extra programming would be required to interpret the identifiers correctly.
ii) It should not be used for matrices whose order is so large that integer register overflow
results.
In the above scheme, each non-zero element is preceded by its column number and each non-zero
row is preceded by the negative of the corresponding row number.
With this discussion, we are now at the and of our study of sparse linear systems. From the next
lecture, we will start the discussion of short circuit analysis methods.
98