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

Iñaki Úcar i.ucar86 at gmail.com
Thu Jun 22 20:09:18 CEST 2017


2017-06-22 19:49 GMT+02:00 Uwe Ligges <ligges at 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

qr() has a tolerance argument which by default is tol=1e-07.

Regards,
Iñaki



More information about the R-devel mailing list