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

Iterative solver

Tags: None
(comma "," separated)
marvisiyer
Registered Member
Posts
21
Karma
0

Iterative solver

Sun Mar 24, 2013 9:14 pm
I need to solve a linear system using an iterative solver and I would like to learn on using the iterative solver module in Eigen using an example. Can someone provide me with an example of how to use the iterative solver or point me to the appropriate webpage? Thanks.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Iterative solver

Sun Mar 24, 2013 11:03 pm
There http://eigen.tuxfamily.org/dox-devel/group__TutorialSparse.html#title1 you have a complete example that use a direct solver. Simply replace SimplicialCholesky by ConjugateGradient to use an iterative solver! In the documentation of the ConjugateGradient and BiCGSTAB solver you will get some stripped examples too: http://eigen.tuxfamily.org/dox-devel/cl ... dient.html
marvisiyer
Registered Member
Posts
21
Karma
0

Re: Iterative solver

Mon Mar 25, 2013 2:49 am
ggael wrote:There http://eigen.tuxfamily.org/dox-devel/group__TutorialSparse.html#title1 you have a complete example that use a direct solver. Simply replace SimplicialCholesky by ConjugateGradient to use an iterative solver! In the documentation of the ConjugateGradient and BiCGSTAB solver you will get some stripped examples too: http://eigen.tuxfamily.org/dox-devel/cl ... dient.html


Thanks ggael. I am currently trying to use an iterative solver with matrix vector products done using FFT or Fast Multipole Method. I have the FFT module and FMM module separately to do matrix vector products. How do I tell the iterative solver to perform matrix vector products using my FFT or FMM module?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Iterative solver

Mon Mar 25, 2013 8:48 am
oh, I see. Then you have to write a wrapper class that behave like a SparseMatrix in Eigen. It needs to provide these members:

- int rows(); // nb rows
- int cols(); // nb cols
- template<typename Derived> ??? operator*(const MatrixBase<Derived>& vec) const; // matrix-vector product

And you'll probably have to to provide your own preconditioner or use the IdentityPreconditioner.

For the matrix-vector product you might start by returning a vector by value and then optimize it by returning an expression, see ReturnByValue class.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]