On Fri, Oct 14, 2011 at 2:42 AM, Thomas Leissing <span dir="ltr"><<a href="mailto:thomas.leissing@cstb.fr">thomas.leissing@cstb.fr</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>
<div>
Dear all,<br>
<br>
I need to solve a system of equation Ax = b in which A is a MatShell object for which I defined a matrix-vector multiplication routine with MatShellSetOperation. Let's call this routine MyMatMult. The MyMatMult routine gives me an approximate matrix vector product, and I'm able to tune the parameters of MyMatMult so that I can choose a trade-off between calculation time and accuracy of the product. I successfully solved this problem with a KSPGMRES solver.<br>
So far so good...<br>
<br>
Now I'd like to precondition the system to accelerate the solving stage. To do this I'd like to use a lower-order (less accurate but faster) solution of Ax=b.<br>
<br>
I tried to do this with a PCKSP type preconditioner, but it doesn't seem to accept MatShell objects as preconditioning matrix.<br></div></blockquote><div><br></div><div>Could you send the error message?</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>
I also tried to use a PCSHELL preconditioner for which the PCApply routine consists in solving the lower order Ax=b system.<br>
<br>
I didn't manage to get this working properly: the outer solver doesn't converge to the expected rate. Indeed if I use for the inner loop the same accuracy than for the outer loop, the outer loop should converge in one iteration, which is not the case...<br>
<br>
Is there another way of doing this ?<br></div></blockquote><div><br></div><div>What we normally do is explicitly construct the low-order matrix. Then you can just pass it as the second Mat argument to</div><div>KSPSetOperators(). The PC is built using that Mat, instead of the system Mat which is a MATSHELL.</div>
<div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>
Any hint ?<br>
<br>
Thanks for your help,<br><font color="#888888">
Thomas Leissing
</font></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>