[Rd] Inconsistent rank in qr()
keith.ohara at nyu.edu
Mon Jan 22 17:40:03 CET 2018
This behavior is noted in the qr documentation, no?
rank - the rank of x as computed by the decomposition(*): always full rank in the LAPACK case.
> On Jan 22, 2018, at 11:21 AM, Serguei Sokol <sokol at insa-toulouse.fr> wrote:
> I have noticed different rank values calculated by qr() depending on
> LAPACK parameter. When it is FALSE (default) a true rank is estimated and returned.
> Unfortunately, when LAPACK is set to TRUE, the min(nrow(A), ncol(A)) is returned
> which is only occasionally a true rank.
> Would not it be more consistent to replace the rank in the latter case by something
> based on the following pseudo code ?
> rank=sum(d >= d*tol)
> Here, we rely on the fact column pivoting is activated in the called lapack routine (dgeqp3)
> and diagonal term in qr matrix are put in decreasing order (according to their absolute values).
> How to reproduce:
> qaf=qr(a, LAPACK=FALSE)
> qaf$rank # shows 1. OK it's the true rank value
> qat=qr(a, LAPACK=TRUE)
> qat$rank #shows 2. Bad, it's not the expected value.
> R-devel at r-project.org mailing list
More information about the R-devel