Lu Decompositionpdf

download Lu Decompositionpdf

of 4

Transcript of Lu Decompositionpdf

  • 7/28/2019 Lu Decompositionpdf

    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, jth element of equation

    (3.40). In general, the element aij can be represented as (from equation (3.40)),

    i11j +i22j +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; i11j +i22j ++iiij = aij (3.48)

    i = j; i11j +i22j ++iijj = aij (3.49)

    i > j; i11j +i22j ++ijjj = aij (3.50)

    In equations (3.48)-(3.50), total N2 equations are available for a total of(N2 +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 N2 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

    ij = aij i1

    k=1

    ikkj (3.52)

    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;

    ij =1

    jjaij j1

    k=1

    ikkj (3.53)These first and second operations both need to be carried out before going to next value of

    j.

    95

  • 7/28/2019 Lu Decompositionpdf

    2/4

    3.4.2 Example of LU decomposition

    Decompose the matrix A =

    3 2 7

    2 3 1

    3 4 1

    in LU form through Crouts algorithm.

    Solution: Let A =

    3 2 7

    2 3 1

    3 4 1

    =

    11 0 0

    21 22 0

    31 32 33

    11 12 13

    0 22 23

    0 0 33

    Applying Crouts algorithm; 11 = 1; 22 = 1; 33 = 1;

    For j = 1;

    i = 1 11 = a11 = 3;

    i = 2 21 =1

    11(a21 0) = 2

    3;

    i = 3 31 =1

    11(a31 0) = 3

    3= 1;

    For j = 2;

    i = 1 12 = a12 = 2;

    i = 2 22 = a22 2112 =5

    3

    ;

    i = 3 32 =1

    22(a32 3112) = 6

    5;

    For j = 3;

    i = 1 13 = a13 = 7;

    i = 2 23 = a23 2113 = 11

    13;

    i = 3 33 = a33 3113 3223 = 8

    5;

    Hence,

    3 2 7

    2 3 1

    3 4 1

    =

    1 0 0

    23 1 01 65 1

    3 2 7

    0 53 1130 0 85

    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

  • 7/28/2019 Lu Decompositionpdf

    3/4

    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.

    A =

    0 0 0 0 0

    0 0 2.67 0 3.12

    1.25 0.29 0 0 2.31

    (3.54)

    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 thematrix A is 3, the total number of entries in array IST is 4.

    97

  • 7/28/2019 Lu Decompositionpdf

    4/4

    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 matrixand (i, j) denote the position of the non-zero element in the matrix. For example, the matrix A inequation (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 signifiesthe 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