Previous Page Next Page Contents

linalg::matlinsolveLU -- solving the linear system given by an LU decomposition

Introduction

linalg::matlinsolveLU(L, U, b) solves the linear system L*U*x=b, where the matrices L and U form an LU-decomposition, as computed by linalg::factorLU.

Call(s)

linalg::matlinsolveLU(L, U, b)
linalg::matlinsolveLU(L, U, B)

Parameters

L - an n x n lower triangular matrix of a domain of category Cat::Matrix
U - an n x n upper triangular form matrix of the same domain as L
B - an n x k matrix of a domain of category Cat::Matrix
b - an n-dimensional column vector, i.e., an n x 1 matrix of a domain of category Cat::Matrix

Returns

an n-dimensional solution vector or n x k dimensional solution matrix, respectively, of the domain type Dom::Matrix(R), where R is the component ring of A.

Related Functions

linalg::factorLU, linalg::inverseLU, linalg::matlinsolve

Details

Example 1

We solve the system

+-           -+       +-         -+
|  2, -3, -1  |       |  1, 0, 0  |
|             |       |           |
|  1,  1, -1  | * X = |  0, 1, 0  |:
|             |       |           |
|  0,  1, -1  |       |  0, 0, 1  |
+-           -+       +-         -+      
      


>> MatR := Dom::Matrix(Dom::Real):
   A  := MatR([[2, -3, -1], [1, 1, -1], [0, 1, -1]]); 
   I3 := MatR::identity(3)
                              +-           -+
                              |  2, -3, -1  |
                              |             |
                              |  1,  1, -1  |
                              |             |
                              |  0,  1, -1  |
                              +-           -+
      
                               +-         -+
                               |  1, 0, 0  |
                               |           |
                               |  0, 1, 0  |
                               |           |
                               |  0, 0, 1  |
                               +-         -+

We start by computing an LU-decomposition of A:

>> LU := linalg::factorLU(A)
          -- +-             -+  +-              -+            --
          |  |   1,   0,  0  |  |  2,  -3,  -1   |             |
          |  |               |  |                |             |
          |  |  1/2,  1,  0  |, |  0, 5/2, -1/2  |, [1, 2, 3]  |
          |  |               |  |                |             |
          |  |   0,  2/5, 1  |  |  0,  0,  -4/5  |             |
          -- +-             -+  +-              -+            --

Now we solve the system A * X = I, which gives us the inverse of A:

>> Ai := linalg::matlinsolveLU(LU[1], LU[2], I3)
                           +-                 -+
                           |    0,   1,   -1   |
                           |                   |
                           |  -1/4, 1/2, -1/4  |
                           |                   |
                           |  -1/4, 1/2, -5/4  |
                           +-                 -+
>> A * Ai, Ai * A
                       +-         -+  +-         -+
                       |  1, 0, 0  |  |  1, 0, 0  |
                       |           |  |           |
                       |  0, 1, 0  |, |  0, 1, 0  |
                       |           |  |           |
                       |  0, 0, 1  |  |  0, 0, 1  |
                       +-         -+  +-         -+

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000