Previous Page Next Page Contents

linalg::gaussElim -- Gaussian elimination

Introduction

linalg::gaussElim(A) performs Gaussian elimination on the matrix A to reduce A to an upper row echelon form.

Call(s)

linalg::gaussElim(A <, All>)

Parameters

A - a matrix of a domain of category Cat::Matrix

Options

All - additionally returns the rank and the determinant of A (if A is a square) as well as the characteristic column indices of the matrix in row echelon form.

Returns

a matrix of the same domain type as A, or the list [T, rank(A), det(A), {j1,...,jr}] when the option All is given (see below).

Related Functions

linalg::gaussJordan, lllint

Details

Option: All

Example 1

We apply Gaussian elimination to the following matrix:

>> A := Dom::Matrix(Dom::Rational)( 
     [[1, 2, 3, 4], [-1, 0, 1, 0], [3, 5, 6, 9]] 
   )
                             +-             -+
                             |   1, 2, 3, 4  |
                             |               |
                             |  -1, 0, 1, 0  |
                             |               |
                             |   3, 5, 6, 9  |
                             +-             -+

which reduces A to the following row echelon form:

>> linalg::gaussElim(A)
                            +-              -+
                            |  1, 2,  3,  4  |
                            |                |
                            |  0, 2,  4,  4  |
                            |                |
                            |  0, 0, -1, -1  |
                            +-              -+

Example 2

We apply Gaussian elimination to the matrix:

>> B := Dom::Matrix(Dom::Integer)( 
     [[1, 2, -1], [1, 0, 1], [2, -1, 4]] 
   )
                              +-           -+
                              |  1,  2, -1  |
                              |             |
                              |  1,  0,  1  |
                              |             |
                              |  2, -1,  4  |
                              +-           -+

and get the following result:

>> linalg::gaussElim(B, All)
                  -- +-           -+                   --
                  |  |  1,  2, -1  |                    |
                  |  |             |                    |
                  |  |  0, -2,  2  |, 3, -2, {1, 2, 3}  |
                  |  |             |                    |
                  |  |  0,  0, -2  |                    |
                  -- +-           -+                   --

We see that rank(B)=3 and det(B)=-2.

Background




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000