0% found this document useful (0 votes)
44 views4 pages

Lecture3 PDF

The document describes the method of LU decomposition to solve for matrices L and U given a matrix A. It provides the key equations used in LU decomposition and explains Crout's algorithm, a common method for performing LU decomposition. The document then provides an example of using Crout's algorithm to decompose a sample matrix A into its L and U matrices. Finally, it discusses different storage schemes that can be used for sparse matrices, including random packing, systematic packing using row addresses or dummy variables, and using compound identifiers.

Uploaded by

kpchakrala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views4 pages

Lecture3 PDF

The document describes the method of LU decomposition to solve for matrices L and U given a matrix A. It provides the key equations used in LU decomposition and explains Crout's algorithm, a common method for performing LU decomposition. The document then provides an example of using Crout's algorithm to decompose a sample matrix A into its L and U matrices. Finally, it discusses different storage schemes that can be used for sparse matrices, including random packing, systematic packing using row addresses or dummy variables, and using compound identifiers.

Uploaded by

kpchakrala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

3.4.

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)),

i1 1j + i2 2j + up to appropriate term = aij (3.47)

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 ij = aij (3.48)

i = j; i1 1j + i2 2j + + ii jj = aij (3.49)

i > j; i1 1j + i2 2j + + ij jj = aij (3.50)

In equations (3.48)-(3.50), total N 2 equations are available for a total of (N 2 + N ) unknown


and (the diagonals terms being repeated twice). As the number of unknown quantities is greater
than the number of equations, we need to specify N of the unknown quantities arbitrarily and then
the remaining unknown quantities can be solved. In fact, it is always possible to take

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:

step 1: Set ii = 1 for i = 1, 2, 3 N .


step 2: For each j = 1, 2, 3 N , perform the following operation:
a) For i = 1, 2, 3 N solve for ij as

i1
ij = aij ik kj (3.52)
k=1

Note: when i = 1, the summation term in equation (3.52) is taken to be zero.


b) For i = j + 1, j + 2, N solve for ij as;

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

3.5 Storage schemes for sparse matrices

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

Primary array (elements) X = {0.29 3.12 -1.25 2.67 2.31 0}


Secondary array (row indices) i = {3 2 3 2 3 0}
Secondary array (column indices) j = {2 5 1 3 5 0}
In the above, the zero at the end of each array denotes the termination of the array.

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.

a) The use of row address:


In this scheme, the index of first non-zero element in each row is specified in a separate integer
array. As an example, for the matrix A in equation (3.54) the elements can be represented as,

Real array (elements) = {2.67 3.12 -1.25 0.29 2.31}


Integer array JA = {3 5 1 2 5}
Integer array IST = {1 1 3 6 }

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

Real array (elements) = {2 2.67 3.12 3 -1.25 0.29 2.31 0}


Integer array JA = {0 3 5 0 1 2 5 0}

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

Real array (elements) = {2.67 3.12 -1.25 0.29 2.31 0}


Integer array JA = {2003 2005 3001 3002 3005 9999}

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.

d) The use of mixed arrays:


It is possible to use a single array to store both the non-zero elements of the matrix and the
identifiers. For example, the matrix A in equation (3.54) could be stored as,

Real array (B) = {-2 3 2.67 5 3.12 -3 1 -1.25 2 0.29 5 2.31 0}

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

You might also like