There is a [Q,R] = qr(A,0)
function in Matlab, which, according to documentation, returns an "economy" version of qr-decomposition of A. norm(A-Q*R)
returns ~1e-12 for my data set. Also Q'*Q
should theoretically return I. In practice there are small nonzero elements above and below the diagonal (of the order of 1e-6 or so), as well as diagonal elements that are slightly greater than 1 (again, by 1e-6 or so). Is anyone aware of a way to control precision of qr(.,0)
, or quality(orthogonality) of resulting Q, either by specifying epsilon, or via the number of iterations ? The size of the data set makes qr(A) run out of memory so I have to use qr(A,0).
Matlab, economy QR decomposition, control precision?
816 views Asked by AlexK At
1
When I try the non- economy setting, I actually get comparable results for A-Q*R. Even for a tiny matrix containing small numbers as shown here:
As such I don't believe the 'economy' is the problem as confirmed by @horchler in the comments, but that you have just ran into the limits of how accurate calculations can be done with data of type 'double'.
Even if you change the accuracy somehow, you will always be dealing with an approximation, so perhaps the first thing to consider here is whether you really need greater accuracy than you already have. If you need more accuracy there may always be a way, but I doubt whether it will be a straightforward one.