rankMM | R Documentation |
Compute the rank of a matrix A
in simple way, based on the SVD,
svd()
, and “the same as Matlab”.
rankMM(A, tol = NULL, sv = svd(A, 0, 0)$d)
A |
a numerical matrix, maybe non-square. When |
tol |
numerical tolerance (compared to singular values). By
default, when |
sv |
vector of non-increasing singular values of |
an integer from the set 0:min(dim(A))
.
Martin Maechler, Date: 7 Apr 2007
There are more sophisticated proposals for computing the rank of a
matrix; for a couple of those, see rankMatrix
in the
Matrix package.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.