<span class="Apple-style-span" style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px"><div class="im" style="color:rgb(80,0,80)"><pre style="white-space:pre-wrap;font-size:10pt;font-family:Tahoma;word-wrap:break-word">
Hi,
I am trying to use LOBPCG via Slepc and I am a little confused on how to set the preconditioner and operator matrices. I have a shell matrix A and a matrix P that should be used for the preconditioning. Here is the relevant part of my code:
</pre></div><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word"><font size="1">EPSCreate(PETSC_COMM_WORLD,&eps);</font></pre><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word">
<font size="1">EPSSetOperators(eps, A, PETSC_NULL);</font></pre><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word"><font size="1">EPSSetProblemType(eps, EPS_HEP);</font></pre><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word">
<font size="1">EPSSetType(eps, EPSBLOPEX);</font></pre><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word"><font size="1">EPSGetST(eps, &st);</font></pre><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word">
<font size="1">STPrecondSetMatForPC(st, P);</font></pre><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word"><font size="1">STGetKSP(st,&ksp);</font></pre><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word">
<font size="1">KSPGetPC(ksp, &pc);</font></pre><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word"><font size="1">KSPSetOperators(ksp,A, P, DIFFERENT_NONZERO_PATTERN); //do I have to set this?? If I don't the program complains that a matrix is not set</font></pre>
<pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word"><font size="1">PCSetType(pc, PCJACOBI);</font></pre><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word"><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal"><pre style="white-space:pre-wrap;font-size:x-small;font-family:monospace">
EPSSetUp(eps);</pre></span></pre></span><span class="Apple-style-span" style="border-collapse:collapse;color:rgb(34,34,34);font-family:monospace;font-size:13px;white-space:pre-wrap"><div><span class="Apple-style-span" style="border-collapse:collapse;color:rgb(34,34,34);font-family:monospace;font-size:13px;white-space:pre-wrap"><br>
</span></div>Is that correct or do I need to do something else? </span><span class="Apple-style-span" style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px"><pre style="white-space:pre-wrap;font-family:Tahoma;word-wrap:break-word">
<span style="font-family:Arial,Helvetica,sans-serif;white-space:normal"><pre style="white-space:pre-wrap;font-family:monospace"><br></pre><pre style="white-space:pre-wrap;font-family:monospace">Thanks,</pre><pre style="white-space:pre-wrap;font-family:monospace">
Verena</pre></span></pre></span>