matrixrank: Rank of a Matrix

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/matrixrank.R

Description

This function returns the rank of an input matrix

Usage

1
  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.

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.

Value

The rank of the input matrix.

Author(s)

Lingsong Zhang (lingsong@purdue.edu)

See Also

See Also in svd.

Examples

1
2
3
4
5
6
#generate a random matrix
x<-matrix(rnorm(100), nrow=20);

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

Example output

Loading required package: lattice
[1] 5

svdvisual documentation built on May 2, 2019, 4:15 a.m.