Skip to content
Back to formatted view

Raw Message

Message-ID: <4278F8ED.2040207@pdf.com>
Date: 2005-05-04T16:31:41Z
From: Spencer Graves
Subject: rank of a matrix
In-Reply-To: <4278F018.8060101@unm.edu>

Have you considered something like the following:

matrix.rank <- function(A, eps=sqrt(.Machine$double.eps)){
	sv. <- abs(svd(A)$d)
	sum((sv./max(sv.))>eps)
}

matrix.rank(A=diag(3))
#[1] 3
A <- array(c(1,1,0,0), dim=c(2,2))
matrix.rank(A)
#[1] 1

mingan wrote:

> 
> 
> how do I check the rank of a matrix ?
> 
> say
> 
> A=  1   0   0
>     0   1   0
> 
> then rank(A)=2
> 
> what is this function?
> 
> thanks
> 
> 
>  I did try help.search("rank"), but all the returned help information 
> seem irrelevant to what I want.
> 
>  I would like to know how people search for help information like this.
> 
> 
> 
> 
> 
> 
> rank(base)              Sample Ranks
> SignRank(stats)         Distribution of the Wilcoxon Signed Rank
>                        Statistic
> Wilcoxon(stats)         Distribution of the Wilcoxon Rank Sum
>                        Statistic
> friedman.test(stats)    Friedman Rank Sum Test
> kruskal.test(stats)     Kruskal-Wallis Rank Sum Test
> pairwise.wilcox.test(stats)
>                        Pairwise Wilcoxon rank sum tests
> wilcox.test(stats)      Wilcoxon Rank Sum and Signed Rank Tests
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html