Learn R Programming

svdvisual (version 1.1)

matrixrank: Rank of a Matrix

Description

This function returns the rank of an input matrix

Usage

matrixrank(x, tolerance = 1e-08)

Arguments

x
The input matrix. Make sure this is a matrix object
tolerance
The tolerance of the numerical zeros. All singular values whose absolute value is smaller than the tolerance will be treated as zero.

Value

The rank of the input matrix.

Details

This function identifies the singular values, and count the number of such values significant away from 0. The result is the rank of the input matrix.

See Also

See Also in svd.

Examples

Run this code
#generate a random matrix
x<-matrix(rnorm(100), nrow=20);

#calculate the rank of this matrix
y<-matrixrank(x);
y

Run the code above in your browser using DataLab