chrisjs
Registered Member

I'm using the QR decomposition to solve a nonleast squares but similar looking problem. (Finding the minimum norm element of a plane.) To do this I'm computing the QR decomposition of A.transpose(), and for simplicity (since I use it several times) I had a typedef. So the following code
is failing with the error:
A similar problem happens when I attempt to assign qr_fact.matrixQR().triangularView<Eigen::Upper>() to a triangular view of type Eigen::TriangularView<const Matrix, Eigen::Upper>. (Which presumably is just a consequence of being constructed from a QR factorization of A.transpose().) It looks like the Option, MaxRows, and MaxCols template parameters got set when I took the transpose. I'm wondering (1) Is there a reason for this, (2) Is there an easier way to solve my problem, and (3) failing that, what are my best options? I could use c++11 syntax and just declare the variable types with auto, or I could replace the typedef for cph_qr with
I unsure which would be preferred. Thanks in advance for any responses. 
ggael
Moderator

This is because A is a column major matrix, while A.transpose() is rowmajor. You should rather do:

chrisjs
Registered Member

Thanks! That fixed it. But I don't understand why I'd make the two calls to compute later. (Though it's good to know that function existed. It isn't in the online docs.)

Registered users: acrimont, AgeOfAsparagus, Arran, Baidu [Spider], Bing [Bot], claydoh, davidemme, Don Jajo, Exabot [Bot], Google [Bot], google01103, mck182, metzman, peje, rumangerst, snej21, tokiedian, vpinon, wolfi323, Yahoo [Bot]