From i.ucar86 at gmail.com  Thu Jun 22 20:41:56 2017
From: i.ucar86 at gmail.com (=?UTF-8?B?ScOxYWtpIMOaY2Fy?=)
Date: Thu, 22 Jun 2017 20:41:56 +0200
Subject: [Rd] Unexpected behaviour of base::qr()$rank
In-Reply-To: <69e19ee7-5520-f94c-8963-a0332ffc47c2@statistik.tu-dortmund.de>
References: <e5526d3d-b517-95a5-67c5-ea588cfe6a06@helsinki.fi>
 <a9305216-65c9-b19b-d8ce-ddebffa018fe@statistik.tu-dortmund.de>
 <CALEXWq0LrFN01GiQe=zh2Th0mhVBBdoNecbOWWRj=E7xjsntiQ@mail.gmail.com>
 <69e19ee7-5520-f94c-8963-a0332ffc47c2@statistik.tu-dortmund.de>
Message-ID: <CALEXWq1LwhXW0idagN5cbjd=QSky5WUuyx5VYzE6tnSga-JkHQ@mail.gmail.com>

2017-06-22 20:31 GMT+02:00 Uwe Ligges <ligges at statistik.tu-dortmund.de>:
>
>
> On 22.06.2017 20:09, I?aki ?car wrote:
>>
>> 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.
>
>
> But the tolerance is not about the size of the values! It is about the
> reduction of the norm during the householder transformation. From the
> sources <https://svn.r-project.org/R/trunk/src/appl/dqrdc2.f>
>
>
> c     cycle the columns from l to p left-to-right until one
> c     with non-negligible norm is located.  a column is considered
> c     to have become negligible if its norm has fallen below
> c     tol times its original norm....
>
> Best,
> Uwe Ligges

Oh, I apologise, I read the arguments section in the help page, but
not the asterisk down below. Then the result is ok. Sorry for the
noise.

Regards,
I?aki



[Rd] Unexpected behaviour of base::qr()$rank
=?UTF-8?B?ScOxYWtpIMOaY2Fy?=