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

Changing BiCGSTAB's preconditioner during runtime.

Tags: None
(comma "," separated)
kevinl
Registered Member
Posts
2
Karma
0
OS
Hey guys,
I have some sparse problems with various sizes in my project and plan to solve them with a single iterative solver.
In order to achieve the best runtime I'm planning on using the diagonal preconditioner with few steps and the incomplete LU for larger ones.

Code: Select all
BiCGSTAB<SparseMatrix<float>, IncompleteLUT<float> >  iterativeSolver; // <-- this works

Code: Select all
BiCGSTAB<SparseMatrix<float> > iterativeSolver;
DiagonalPreconditioner<float> diagonalPreconditioner;
iterativeSolver.preconditioner() = diagonalPreconditioner; // this works as well

Code: Select all
BiCGSTAB<SparseMatrix<float> > iterativeSolver;
IncompleteLUT<float> incompleteLutPreconditioner;
iterativeSolver.preconditioner() = incompleteLutPreconditioner; // this does not work


So my question is ultimately: How can I change the preconditioner of BiCGSTAB during runtime? My guess is that I did not understand the member method preconditioner() correctly.

Greeting and thanks in advance
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You cannot, you have to create a new BiCGSTAB<> object with appropriate preconditioner.
kevinl
Registered Member
Posts
2
Karma
0
OS
Thank you very much for the answer. :)

Is there a kind of virtual baseclass for this kind of thing? Otherwise I think I'm going to build an Object which contains both solvers.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
No virtual base class but you can easily write such a base class and two derived classes wrapping these two preconditioners.


Bookmarks



Who is online

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