Registered Member
|
Hey everyone,
i'm kinda new to eigen and i'm currently exploring some of it's features. I'd like to solve a standard task A*x = b with A being sparse and relatively high dimensional. Yet, i've implemented a gauß-Jordan algorithm and now i'm trying compare eigen's sparse lu solver to it. So here is the important part of my code:
mxBig, resp. vctBigVM represent the matrix A and the vector b. It seems to me that the code fragment is relatively close to the tutorial on the eigen website, though i'm getting the following error:
which is caused by the line
Can anyone tell me what i'm doing wrong? I'm totally clueless at the moment.. Thanks in advance, Frederic |
Moderator
|
This is a warning telling that it choses not to inline a function we asked him to inline. Just remove the flag to treat warnings as warnings, and not as error.
|
Registered Member
|
Thanks for this hint. My bad..
By now I've got some results, but they are suprising me quite a bit. My example uses a 50x50 banded matrix having a maximum bandwidth of 5. The solution i get from the self-implemented Gaus-Jordan-Algorithm looks like
,whereas the solution i get from f.e. eigen's lu solver looks like
I've tried different solvers as well as the rather naive call of the inverse() method, but i'm always getting those extremly high values. Can somebody provide a guess or maybe even give an explanation on whats going wrong? Thanks in advance, Frederic |
Registered Member
|
Hi Frederic,
I am totally new to Eigen but maybe there is an error in the code you posted:
It seems to me that in the second loop you are using "i++" instead of "j++"; maybe this is the cause of the weird results.. Pietro |
Registered Member
|
Hey Pietro,
thanks for your reply, but unfortunately that was just a typo in the board entry. Of course it needs to be j++ and my code already says so.. Further more I've checked the input of the solvers more than twice and i'm relatively sure they are correct. Regards, Frederic |
Moderator
|
Can you post your matrix in the matrix-market format (don't forget to zip it!):
|
Registered Member
|
|
Moderator
|
From the data you provided I get:
with all solvers including non-Eigen ones with a relative error in the order of 1e-16. Makes sure that your Gauss-Jordan implementation compute a correct solution by checking |A*x-b|/|b|. Then makes sure you are feeding both solver with the exact same values. |
Moderator
|
BTW, you might also be interested by our benchmark routine: http://eigen.tuxfamily.org/dox/group__T ... tml#title3
|
Registered Member
|
Thanks for your input ggael,
i finally got it. There was a single value being copied wrong, which caused all this drama. I've one last question regarding the overview of the solvers. It says that SimplicialLDLT is recommended for "not too large problems". Is there a more precise answer on what "not too large" means? dim = 10, 100, 1.000, 10.000, ...? |
Moderator
|
"not too large problems" should rather be read as not too dense Typically, it will work well for FEM on a 2D domain, but lack performance for 3D domains.
|
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]