rankMM {robustbase} | R Documentation

## Simple Matrix Rank

### Description

Compute the rank of a matrix `A` in simple way, based on the SVD, `svd()`, and “the same as Matlab”.

### Usage

    rankMM(A, tol = NULL, sv = svd(A, 0, 0)$d)

### Arguments

`A` | a numerical matrix, maybe non-square. When `sv` is specified, only `dim(A)` is made use of.
`tol` | numerical tolerance (compared to singular values). By default, when `NULL`, the tolerance is determined from the maximal value of `sv` and the computer epsilon.
`sv` | vector of non-increasing singular values of `A`, (to be passed if already known).

### Value

an integer from the set `0:min(dim(A))`.

### Author(s)

Martin Maechler, Date: 7 Apr 2007

### See Also

There are more sophisticated proposals for computing the rank of a matrix; for a couple of those, see `rankMatrix` in the Matrix package.

### Examples

    rankMM # - note the simple function definition

    hilbert <- function(n) { i <- seq_len(n); 1/outer(i - 1L, i, "+") }
    hilbert(4)
    H12 <- hilbert(12)
    rankMM(H12)        # 11 - numerically more realistic
    rankMM(H12, tol=0) # -> 12
    ## explanation :
    round(log10(svd(H12, 0,0)$d), 1)

[Package robustbase version 0.92-7 Index]