|Re: [eigen] help: eigen cann't solve this simple ax correctly, but Armadillo c++ can|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [eigen] help: eigen cann't solve this simple ax correctly, but Armadillo c++ can
- From: ztdepyahoo <ztdepyahoo@xxxxxxxxx>
- Date: Tue, 8 Sep 2020 07:31:30 +0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-transfer-encoding; bh=Ypvk3LT9liruJBdPJB+pfTc7gnDWVdnrC7UYayZH4io=; b=TBNcwlCA2n5ifQ4PCNJ0Nfpf8r1LteRElrckxkEdkF5iX1CNQ5GRp74uMHeYNyS2JP 51JrHpAmLQu2uU6Ka83Dp32mHjd8r8jAy4p5YrcUZikQO400o11dUu4dx5DKK0L19guO fy0Xmskwctla8pPt8gH1CUswY3ZFaXIqjPgDXSTZMlv824jScd+OKILXxK99cpCC6RXY 6nyaXCMwer0O4fEW97B5aQ+w48AWjOQkSJFEONrd/dAImweMg3pJk4fjTgbz6BQPPps9 Dj9Zn8diPkDs4cMNkizz6zhOC/S8cjYsBCNgTYW4PzZPZcIMzOoGmtlDGuIRNEdW+eAE HxuA==
Thanks I solve it with
Vectorxd x = A.partialPivLu().solve(rhs);
I have a exact solution of "cos(6*Pi*x)*cos(6*Pi*y)", so i can obtain the absolute error. the order of error from Armadillo is "-14", while Eigen's error has an order of "1". I also tried other methods "fullPivLu()", "householderQr()", the situation doesn't change.
But if i compute the relative error with Eigen's " double relative_error = (A*x - b).norm() / b.norm()", the relative_error is very small. I am confused by this situations.
could you be more precise: how did you try to solve your problem with Eigen? How do you know/check that the problem is not solved correctly ?
The matrix is generated from the spectral method of a simple heat diffusion problems, the dimension is 841.
Attachment please find the a and rhs output from Armadillo.
I am wandering why eigen's dense linear sover cann't solve it correctly.