[eigen] Numerical Stability Question |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Numerical Stability Question
- From: Eric Chu <eytchu@xxxxxxxxx>
- Date: Mon, 29 Jun 2009 15:09:06 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type; bh=DqWqaA9Gbli4DLQ0MlaQEXjvCUSrx8DhYYgRlwwLYtU=; b=AqXscrrOe9YjDTcthmKNLPIKudBUwwvbNZVvjBee2urShVRdupo5ekD4wF7fUI+A2v 7NeSV95w/gcHeHCTAEs2N22PvDlZKZlVyIgkFudFExheciFpp72YlTz+BEWZVp0Yw1Ch Aap7PSWT/HLonI8lWeki6wSstdKsXWxGO+wTY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=tdQ7YiVq6+Fxkagv90c6kcoNryp0E9tsWNVXOYHOaFuOvjLP6KrjGOj09YTvB2/pYr MHQGK5icx3sCKw6BvC/eKmfM91OR2cC8B65sgvHUutg9mJRrMFf2a2kXG2ga8yGRkqUI r3kpP8DV9vg2lN1a52PYT5Fb8+d8R9sFKh0FU=
Hi Eigen Folks,
First off, thanks for a (ridiculously) awesome library. I've managed to solve some robust least-squares problems in less than 2ms. Kudos to the developers.
Second, I've implemented a robust least-squares solver (solves Ax=b by minimizing a Huber loss function) by "translating" some pre-existing Matlab code, but am running into some numerical issues (it's not a big deal, since my application can tolerate small mistakes). I'd like to know if any of you have ideas about what's happening.
I'm running a 64-bit, quad core machine, and the following compiler flags (I'm using gcc 4.3.3):
-O3 -msse4 -m64 -Wall -DEIGEN_NO_DEBUG
In my test code, I've got the following loop
for (int i = 0; i < NUM_RUNS; i ++) {
lh.linhuber(A, b, x, 1);
cout << endl;
cout << "Run: " << i+1 << endl;
cout << x << endl;
}
Basically, it uses the same data to solve the least squares problem a couple of times. Running the same "type" of code in Matlab gives the same answer each time. However, when I run my program, I get the following output (assuming I run 5 times).
Run: 1
56.71
-20.04
-3606
Run: 2
56.82
-19.98
-3616
Run: 3
56.69
-20.05
-3604
Run: 4
56.67
-20.05
-3603
Run: 5
56.68
-20.05
-3604
The numbers aren't terribly "wrong," but I was wondering why each loop would give me a slightly different numerical answer. Is there any behavior in Eigen that *might* give rise to such a phenomenon?
Also, I checked the singular values of my matrix A (it's an 800x3 matrix). They came out to approx. 3000, 100, 0.5. If there's no other guess, my thought would be that the solver I've written is playing around in the "numerical" nullspace there.
Any feedback would be appreciated.
Once again, great work. Keep it up,
Eric.