From ligges at statistik.tu-dortmund.de  Thu Jun 22 19:49:00 2017
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Thu, 22 Jun 2017 19:49:00 +0200
Subject: [Rd] Unexpected behaviour of base::qr()$rank
In-Reply-To: <e5526d3d-b517-95a5-67c5-ea588cfe6a06@helsinki.fi>
References: <e5526d3d-b517-95a5-67c5-ea588cfe6a06@helsinki.fi>
Message-ID: <a9305216-65c9-b19b-d8ce-ddebffa018fe@statistik.tu-dortmund.de>



On 22.06.2017 17:11, Bernd Funovits wrote:
> Hello,
> 
> I experienced some unexpected behaviour while determining the rank of 
> matrices (sometimes 1x1 matrices):
> base::qr(matrix(1e-20))$rank returns 1 (incorrect)
> base::qr(diag(c(1, 1e-20)))$rank returns 2 (incorrect)

Why do you believe this is incorrect?

0 != 1e-20

and 1e-20 is well representable without significant rounding errors given

 > .Machine$double.xmin
[1] 2.225074e-308


Best,
Uwe Ligges




> 
> Best regards,
> Bernd
> 
>  > R.version
>                 _
> platform       x86_64-w64-mingw32
> arch           x86_64
> os             mingw32
> system         x86_64, mingw32
> status
> major          3
> minor          4.0
> year           2017
> month          04
> day            21
> svn rev        72570
> language       R
> version.string R version 3.4.0 (2017-04-21)
> nickname       You Stupid Darkness
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Unexpected behaviour of base::qr()$rank
Uwe Ligges