<div class="gmail_quote">On Fri, Mar 9, 2012 at 09:29, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":z0">     As you know, currently when using PCFIELDSPLIT  we have the presentation:<br>
<br>
      ilink = jac->head;<br>
      ierr  = ISComplement(ilink->is,rstart,rend,&ccis);CHKERRQ(ierr);<br>
      ierr  = MatGetSubMatrix(pc->mat,ilink->is,ccis,MAT_INITIAL_MATRIX,&jac->B);CHKERRQ(ierr);<br>
      ierr  = ISDestroy(&ccis);CHKERRQ(ierr);<br>
      ilink = ilink->next;<br>
      ierr  = ISComplement(ilink->is,rstart,rend,&ccis);CHKERRQ(ierr);<br>
      ierr  = MatGetSubMatrix(pc->mat,ilink->is,ccis,MAT_INITIAL_MATRIX,&jac->C);CHKERRQ(ierr);<br>
      ierr  = ISDestroy(&ccis);CHKERRQ(ierr);<br>
      /* Use mat[0] (diagonal block of the real matrix) preconditioned by pmat[0] */<br>
      ierr  = MatCreateSchurComplement(jac->mat[0],jac->pmat[0],jac->B,jac->C,jac->mat[1],&jac->schur);CHKERRQ(ierr);<br>
<br>
      I think it makes sense for the L to be attached by the user to the user provided pc->mat and pc->pmat , (for example the ComputeFunction() the user provides could attach the L directly to the Jacobian they produce)   with our current design this means PCFIELDSPLIT here needs to pull the L out of the pc->mat and put it into the jac->schur. Kind of ugly but workable.<br>

<br>
      An alternative is to refactor MatCreateSchurComplement() to take the original matrix and the IS as arguments</div></blockquote><div><br></div><div>That routine is named MatGetSchurComplement() and the user can implement it. That is the right approach. It could have a convention for forwarding L and Lp on, but the user could just call MatGetSchurComplement() and compose "L"/"Lp" with the Schur complement. This is better because there are multiple ways to take a Schur complement, thus "L" cannot be defined without knowing the index sets.</div>
<div><br></div><div>Additionally, the original matrix does not currently retain ownership, so the user can't actually attach anything to the Schur complement without implementing MatGetSchurComplement() themselves.</div>
<div><br></div><div>Worse yet, MatGetSchurComplement() is probably going to call MatGetSubMatrix() with exactly the same arguments as the outer PCFieldSplit, because both of them will need the submatrices.</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":z0"> and basically suck in all the code above into the MatCreateSchurComplement() this routine would automatically pull the L out of the input matrix and stick it into the created Schur matrix,</div>
</blockquote></div><br><div>This does not work.</div>