Registered Member
|
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.
|
Moderator
|
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
|
Registered Member
|
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? |
Moderator
|
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. |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]