This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen library - least squares

Tags: None
(comma "," separated)
dim_tz
Registered Member
Posts
3
Karma
0

Eigen library - least squares

Mon Jan 14, 2013 11:08 am
I want to use a least squares problem with the use of Eigen library. My options are 2,

sysAAA.jacobiSvd( Eigen::ComputeThinU | Eigen::ComputeThinV ).solve( sysBBB )
sysAAA.colPivHouseholderQr().solve( sysBBB );
I was using the first in the beginning, but it proved to be very slow (1)(2).

So I went to the second solution (other methods aren't appropriate for my case, because they require special matrices (2) )

Does colPivHouseholderQr().solve give a least squares solution?

My impression is that it doesn't (3), but I want to be sure before looking for a "workaround".

1 - viewtopic.php?f=74&t=102088
2 - http://eigen.tuxfamily.org/dox/TopicLin ... tions.html
3 - http://eigen.tuxfamily.org/dox/Tutorial ... astsquares

PS - it was asked also here , but the only answer provided didn't give any source as proof
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Yes, colPivHouseholderQr().solve() does LS solving, as a proof:
Code: Select all
   |Ax-b|^2 = min
 => 2 A^T (Ax-b) = 0
    A^T A x = A^T b
If A = QR (with Q and R corresponding to the "thin" QR, so R is square), then we have:
    R^T Q^T Q R x = R^T Q^T b
    R^T R x = R^T Q^T b
Assuming R is full rank:
    R x = Q^T b
    x = R-1 Q^T b

that is what *QR::solve does.
dim_tz
Registered Member
Posts
3
Karma
0

Re: Eigen library - least squares

Tue Jan 15, 2013 5:05 pm
thanx ggael :)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]