<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 1, 2017 at 4:58 PM, Bikash Kanungo <span dir="ltr"><<a href="mailto:bikash@umich.edu" target="_blank">bikash@umich.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thank you Matthew for the quick response.<div><br></div><div>I should provide some more details. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">1) This implies that A is symmetric</span></blockquote><div><br></div><div>Yes A is symmetric</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">2) I think you mean the b is orthogonal to Q</span></blockquote><div> </div><div>No. I've an extra condition on the solution x - that it has to be orthogonal to Q. Without this condition the problem will have multiple solutions. It's same as finding the minimum norm solution</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px"></span><span style="font-size:12.8px">Its not MatSetNullSpace() that fixes this issue, it is the linear solver itself. Many Krylov solvers can converge to the</span></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">minimum norm solution of this rank deficient problem.</blockquote><div><br></div><div>I was unable to get convergence without using MatSetNullSpace(). So it seems that the Krlov solvers are inadequate just by themselves. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:12.8px">Second, we remove components in the nullspace from each <span style="font-size:12.8px">iterate, which is not what you are doing above.</span></div></blockquote><div><br></div><div>This might be the reason why without MatSetNullSpace() I'm unable to attain convergence. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">It seems easier to just give your Q as the nullspace.</span></blockquote><div>Yeah using Q as nullspace is the easiest option. But my basis is non-orthogonal and has an overlap matrix S. So in order to provide orthonormal nullvectors as Q to Petsc, I need to evaluate S^{-1/2}. As of now, for small problems I can evalaute S^{-1/2}, however, it's a show stopper for large ones. I can possibly use MatNullSpaceSetFunction() to circumvent the requirement of orthonormal nullvectors in MatSetNullSpace(). I would appreciate your input on this. </div></div></blockquote><div><br></div><div>You do not need this. Just use</div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatNullSpaceSetFunction.html#MatNullSpaceSetFunction">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatNullSpaceSetFunction.html#MatNullSpaceSetFunction</a></div><div><br></div><div>to implement your (I - Q^T Q).</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Lastly, I would like to know what operations do MatSetNullSpace enforce within a KSP solve. </div><div><br></div><div>Thanks,</div><div>Bikash</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 1, 2017 at 5:25 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Thu, Jun 1, 2017 at 2:07 PM, Bikash Kanungo <span dir="ltr"><<a href="mailto:bikash@umich.edu" target="_blank">bikash@umich.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm trying to solve a linear system of equations  Ax=b, where A has a null space (say Q) and x is known to be orthogonal to Q. In order to avoid ill-conditioning, I was trying to do the following:</div></div></blockquote><div><br></div></span><div>1) This implies that A is symmetric</div><div><br></div><div>2) I think you mean the b is orthogonal to Q</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><ol><li> Create A as a shell matrix </li><li> Overload the MATOP_MULT operation for with my own function which returns <br>y = A*(I - QQ^T)x instead of y = Ax</li><li>Upon convergence, solution = (I-QQ^T)x instead of x.</li></ol>However, I realized that the linear solver can make x have any arbitrary component along Q and still y = A*(I-QQ^T)x will remain unaffected, and hence can cause convergence issues. Indeed, I saw such convergence problems. What fixed the problem was using MatSetNullSpace for A with Q as the nullspace, in addition to the above three steps. </div><div><br></div><div>So my question is what exactly is MatSetNullSpace doing? And since the full A information is not present and A is only accessed through MAT_OP_MULT, I'm confused as how MatSetNullSpace might be fixing the convergence issue. </div></div></blockquote><div><br></div></span><div>Its not MatSetNullSpace() that fixes this issue, it is the linear solver itself. Many Krylov solvers can converge to the</div><div>minimum norm solution of this rank deficient problem. Second, we remove components in the nullspace from each</div><div>iterate, which is not what you are doing above. It seems easier to just give your Q as the nullspace.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thanks,</div><div>Bikash  <span class="gmail-m_360490316621324120m_5740569650780157944HOEnZb"><font color="#888888"><br><div><br></div>-- <br><div class="gmail-m_360490316621324120m_5740569650780157944m_6351904088277843293gmail_signature"><div dir="ltr"><div><div><div><div><font color="#666666">Bikash S. Kanungo<br></font></div><font color="#666666">PhD Student<br></font></div><font color="#666666">Computational Materials Physics Group<br></font></div><font color="#666666">Mechanical Engineering <br></font></div><font color="#666666">University of Michigan<br><br></font></div></div>
</font></span></div></div>
</blockquote></span></div><span class="gmail-m_360490316621324120HOEnZb"><font color="#888888"><br><br clear="all"><span class="gmail-HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="gmail-m_360490316621324120m_5740569650780157944gmail_signature"><div dir="ltr"><div>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</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51<wbr>/</a><br></div></div></div>
</font></span></font></span></div></div><span class="gmail-HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="gmail-HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="gmail-m_360490316621324120gmail_signature"><div dir="ltr"><div><div><div><div><font color="#666666">Bikash S. Kanungo<br></font></div><font color="#666666">PhD Student<br></font></div><font color="#666666">Computational Materials Physics Group<br></font></div><font color="#666666">Mechanical Engineering <br></font></div><font color="#666666">University of Michigan<br><br></font></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>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</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51/</a><br></div></div></div>
</div></div>