matrixcalc (version 1.0-6)

matrix.rank: Rank of a square matrix

Description

This function returns the rank of a square numeric matrix based on the selected method.

Usage

matrix.rank(x, method = c("qr", "chol"))

Value

An integer.

Arguments

x

a matrix

method

a character string that specifies the method to be used

Author

Frederick Novomestky fnovomes@poly.edu

Details

If the user specifies "qr" as the method, then the QR decomposition function is used to obtain the rank. If the user specifies "chol" as the method, the rank is obtained from the attributes of the value returned.

References

Bellman, R. (1987). Matrix Analysis, Second edition, Classics in Applied Mathematics, Society for Industrial and Applied Mathematics.

See Also

is.square.matrix

Examples

Run this code
A <- diag( seq( 1, 4, 1 ) )
matrix.rank( A )
B <- matrix( seq( 1, 16, 1 ), nrow=4, byrow=TRUE )
matrix.rank( B )

Run the code above in your browser using DataLab