Previous Page Next Page Contents

linalg::gaussJordan -- Gauss-Jordan elimination

Introduction

linalg::gaussJordan(A) performs Gauss-Jordan elimination on the matrix A, i.e., it returns the reduced row echelon form of A.

Call(s)

linalg::gaussJordan(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 reduced 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::gaussElim

Details

Option: All

Example 1

We apply Gauss-Jordan elimination to the following matrix:

>> A := Dom::Matrix(Dom::Rational)( 
     [[1, 2, 3, 4], [-5, 0, 3, 0], [3, 5, 6, 9]] 
   )
                             +-             -+
                             |   1, 2, 3, 4  |
                             |               |
                             |  -5, 0, 3, 0  |
                             |               |
                             |   3, 5, 6, 9  |
                             +-             -+
>> linalg::gaussJordan(A, All)
               -- +-              -+                     --
               |  |  1, 0, 0, 1/2  |                      |
               |  |                |                      |
               |  |  0, 1, 0, 1/2  |, 3, FAIL, {1, 2, 3}  |
               |  |                |                      |
               |  |  0, 0, 1, 5/6  |                      |
               -- +-              -+                     --

We see that rank(B)=3. Because the determinant of a matrix is only defined for square matrices, the third element of the returned list is the value FAIL.

Example 2

If we consider the matrix from example 1 as an integer matrix and apply the Gauss-Jordan elimination we get the following matrix:

>> B := Dom::Matrix(Dom::Integer)( 
     [[1, 2, 3, 4], [-5, 0, 3, 0], [3, 5, 6, 9]] 
   ):
   linalg::gaussJordan(B)
                            +-               -+
                            |  2,  0,  0,  1  |
                            |                 |
                            |  0, -2,  0, -1  |
                            |                 |
                            |  0,  0, -6, -5  |
                            +-               -+

Background




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000