Previous Page Next Page Contents

numeric::factorLU -- LU factorization of a matrix

Introduction

numeric::factorLU(A, ..) returns a LU factorization PA=LU of the matrix A.

Call(s)

numeric::factorLU(A <, Symbolic>)

Parameters

A - an m x n matrix of domain type DOM_ARRAY or of category Cat::Matrix

Options

Symbolic - prevents numeric::factorLU from using floating point arithmetic

Returns

A list [L,U,p] is returned. The matrices L and U are of domain type DOM_ARRAY, p is a list of integer numbers 1,..,m representing the row exchanges in pivoting steps. The components of L and U are real or complex floats, unless the option Symbolic is used.

Side Effects

Without the optional argument Symbolic the function is sensitive to the environment variable DIGITS, which determines the numerical working precision.

Related Functions

linalg::factorLU, numeric::factorCholesky, numeric::factorQR

Details

Option: Symbolic

Example 1

We consider the matrix

>> A := array(1..3, 1..3, [[1, 2, 3], [2, 4, 6], [4, 8, 9]]):
>> [L, U, p] := numeric::factorLU(A)
          -- +-            -+  +-                -+            --
          |  |    1,  0, 0  |  |  4.0, 8.0,  9.0  |             |
          |  |              |  |                  |             |
          |  |   0.5, 1, 0  |, |   0,   0,   1.5  |, [3, 2, 1]  |
          |  |              |  |                  |             |
          |  |  0.25, 0, 1  |  |   0,   0,  0.75  |             |
          -- +-            -+  +-                -+            --

The factors (of domain type DOM_ARRAY) are converted to elements of the matrix domain Dom::Matrix() for further processing:

>> M := Dom::Matrix(): L := M(L): U := M(U):

Now the overloaded arithmetical operators +, *, ^ etc. can be used for further computations:

>> L*U
                            +-               -+
                            |  4.0, 8.0, 9.0  |
                            |                 |
                            |  2.0, 4.0, 6.0  |
                            |                 |
                            |  1.0, 2.0, 3.0  |
                            +-               -+

The product LU coincides with A after exchanging the rows according to the permutation p:

>> PA := array(1..3, 1..3, [[A[p[i], j] $ j=1..3] $ i=1..3])
                               +-         -+
                               |  4, 8, 9  |
                               |           |
                               |  2, 4, 6  |
                               |           |
                               |  1, 2, 3  |
                               +-         -+
>> delete A, L, U, p, M, PA:

Example 2

We consider a non-square matrix:

>> A := array(1..3, 1..2, [[3*I, 10], [I, 1], [I, 1]]):
>> numeric::factorLU(A)
            -- +-           -+  +-            -+            --
            |  |   1,  0, 0  |  |  1.0 I, 1.0  |             |
            |  |             |  |              |             |
            |  |  3.0, 1, 0  |, |    0,   7.0  |, [2, 1, 3]  |
            |  |             |  |              |             |
            |  |  1.0, 0, 1  |  |    0,    0   |             |
            -- +-           -+  +-            -+            --

Note that the symbolic factorization is different, because a different pivoting strategy is used:

>> numeric::factorLU(A, Symbolic)
             -- +-           -+  +-           -+            --
             |  |   1,  0, 0  |  |  3 I,  10   |             |
             |  |             |  |             |             |
             |  |  1/3, 1, 0  |, |   0,  -7/3  |, [1, 2, 3]  |
             |  |             |  |             |             |
             |  |  1/3, 1, 1  |  |   0,    0   |             |
             -- +-           -+  +-           -+            --
>> delete A:

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000