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

Problem with householderQr()

Tags: None
(comma "," separated)
sri
Registered Member
Posts
5
Karma
0

Problem with householderQr()

Tue Dec 07, 2010 9:01 pm
Hello,

Thank you for the wonderful library.

I am having issues with the householder QR factorization and I am not sure how to resolve the issue.
The householder Qr factorization on a 1 column matrix produces an assert saying number of rows or number of columns are not equal. However it works fine if the number of columns are more than 1.

This is the exact error that I recieve
-----------------------------------------------------------------
Eigen/src/Core/CwiseBinaryOp.h:141: Eigen::CwiseBinaryOp<BinaryOp, Lhs, Rhs>::CwiseBinaryOp(const Lhs&, const Rhs&, const BinaryOp&) [with BinaryOp = Eigen::ei_scalar_product_op<double, double>, Lhs = Eigen::Transpose<Eigen::Transpose<Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Matrix<double, 5, 1, 0, 5, 1>, -0x00000000000000001, -0x00000000000000001, false, true>, -0x00000000000000001, 1, true, true>, -0x00000000000000001, 1, false, true> > >, Rhs = Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Matrix<double, 5, 1, 0, 5, 1>, -0x00000000000000001, -0x00000000000000001, false, true>, -0x00000000000000001, -0x00000000000000001, false, true>, -0x00000000000000001, -0x00000000000000001, false, true>]: Assertion `lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()' failed.
----------------------------------------------------------------------

The sample code that reproduces this issue is below


Matrix<double,5,2> test2;
test2<<1,2,3,4,5,6,7,8,9,10;
cout<<test2<<"\r\n";
cout<<test2.householderQr().matrixQR().eval()<<"\r\n"; //This works

Matrix<double,5,1> test;
test<<1,2,3,4,5;
cout<<test<<"\r\n";
cout<<test.householderQr().matrixQR().eval()<<"\r\n"; //This produces an assert saying number of rows and number of columns are not equal.

The equivalent result from Matlab is shown below

For the 5x2 matrix - This output is same as Eigen's result
qr([1,2;3,4;5,6;7,8;9,10])

-12.8452 -14.7915
0.2167 -1.1010
0.3611 -0.0438
0.5056 -0.3347
0.6500 -0.6257

and for the 5x1 matrix, - Eigen produces an assert error and fails
qr([1;2;3;4;5])
-7.4162
0.2376
0.3565
0.4753
0.5941

The configuration:
Eigen 3.0 beta 2
OS: Ubuntu 10.10 x64
CPU: Intel Core 2 Quad
Compiler: GCC 4.4.5 with Codeblocks IDE
Build: Issue present in both Debug and Release build.

Since, I don't really need the householder reflectors, I would be happy even if I can extract the elements of the R matrix under all conditions.

Thanks

Regards
Sri
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: Problem with householderQr()

Tue Dec 07, 2010 9:05 pm
Thanks, can you please file a bug report.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
sri
Registered Member
Posts
5
Karma
0

Re: Problem with householderQr()

Tue Dec 07, 2010 9:15 pm
Wow!. Thank you for the quick reply!. I have filed a bug report. Is there anything that I can do in the short term?

Regards
Sri
User avatar
bjacob
Registered Member
Posts
658
Karma
3
I'll look at your bug ASAP.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
sri
Registered Member
Posts
5
Karma
0

Re: Problem with householderQr()

Thu Dec 09, 2010 9:48 pm
Thank you!. It's fixed now.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient