Registered Member
|
With a recent update from Ubuntu 14.04 to 15.10 one of the applications I maintain failed one of its tests. I have narrowed it down to Eigen and from my tests Eigen 3.2.1 still works as expected, whereas 3.2.2 fails.
The test that fails compares the output of my application to the output generated by R (http://www.r-project.org). What my application basically does is linear (least squares) regression. In the failing test I use a data set in which all points except one being at the same x position, so not a very robust linear system. In this particular test, I used to get values for my output parameters of the order of 6.5, whereas with Eigen > 3.2.2 I get values of the order of 76e6. For other tests which use less singular data the outcomes are comparable to R's output. Given that I use LDLT and the fact that the 3.2.2 changelog states:
I'm wondering if this could be the source of my problems. The code I use is (roughly) the following:
Here beta is the vector with the problematic values. |
Moderator
|
Could you try the latest 3.2 branch to see if the issue have already been solved: https://bitbucket.org/eigen/eigen/get/3.2.zip.
thanks. |
Moderator
|
btw, LDLT is not rank-revealing, so it is not supposed to be stable for singular problems. Better use ColPivHouseholderQR, or SVD in this case.
|
Registered Member
|
Thanks for the quick reply! I tried the following: - 3.2.0: OK - 3.2.1: OK - 3.2.2: Broken - 3.2.3: Broken - 3.2.5: Broken - 3.3-alpha1: Broken - 3.2 "current" (e059accf541a): Broken |
Registered Member
|
Strange, I just tried ColPivHouseholderQR and fullPivHouseholderQr with the latest 3.2 branch (e059accf541a) and get the same problem. Using jacobiSvd() didn't help either. The value are slightly changed, but still incorrect. |
Moderator
|
hm, could you provide the matrix entries so that we can reproduce.
|
Moderator
|
moreover, all rank-revealing solvers provide a setThreshold method that you can slightly increase to cancel smallest singularvalues, (http://eigen.tuxfamily.org/dox/classEig ... 823edacb2c). E.g.:
ColPivHouseholderQR<MatrixXd> qr; qr.setThreshold(1e-14); qr.compute(A), x = qr.solve(b); I guessed it worked for your use case with LDLT 3.2.1 because it used by default a rather high threshold which was broken for many other problems... Search for the "L-curve method" to see how to automatically find a best threshold. (not in Eigen). |
Registered Member
|
The input data can be found on pastebin.com: (I'm trying to solve y = X beta for beta)
Last edited by lkarssen on Sat Nov 07, 2015 12:30 pm, edited 1 time in total.
|
Registered Member
|
That seems to be the case. Setting the threshold to 1e-14 gave me the same coefficient as R does. |
Moderator
|
I cannot reproduce using the following test program:
I get:
|
Registered Member
|
Sorry for not replying earlier. Work is quite busy this week. I hope to have a better look at your code and dig deeper in mine somewhere next week.
In any case: thanks a lot for investing your time into this! |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]