## `linalg::rank` -- rank of a matrix

#### Introduction

`linalg::rank``(A)` computes the rank of the matrix A.

`linalg::rank``(S)` computes the rank of the matrix whose columns are the vectors in S.

#### Call(s)

`linalg::rank(A)`
`linalg::rank(S)`

#### Parameters

`A` | - | a matrix of a domain of category `Cat::Matrix`
`S` | - | a list or set of column vectors of the same dimension (a column vector is an n x 1 matrix of a domain of category `Cat::Matrix`)

#### Returns

a nonnegative integer

#### Related Functions

`linalg::det`, `linalg::gaussElim`

#### Details

- The component ring of `A` or of the vectors given in `S`, respectively, must be an integral domain, i.e., a domain of category `Cat::IntegralDomain`.

#### Example 1

We define the following matrix over Z:

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

                                 +-             -+
                                 |   1, 2, 3, 4  |
                                 |               |
                                 |  -1, 0, 1, 0  |
                                 |               |
                                 |   3, 5, 6, 9  |
                                 +-             -+

and compute its rank:

    >> linalg::rank(A)

                                         3

#### Example 2

The rank of the matrix A=(s[i]), i=1..3 with s[1]=[0,1,1], s[2]=[0,1,0], s[3]=[0,0,1] is:

    >> S:= { MatZ([0,1,1]), MatZ([0,1,0]), MatZ([0,0,1]) }:
       linalg::rank(S)

                                         2

#### Background

- The row rank of a matrix A is defined as the maximal number of linearly independent row vectors of A. The column rank of A is the maximal number of linearly independent column vectors of A.
- Because for each matrix A its row rank is equal to its column rank this number is just called the rank of A.
- The rank of A is computed by Gaussian elimination (see `linalg::gaussElim`), it is equal to the number of characteristic column indices.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000