<div dir="ltr">Note that you can do everything above with options alone. You do not need the code.<div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Jan 19, 2026 at 2:35 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<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><div><br></div>  Apparently. Just call ISSort() on the IS after forming it.<br id="m_-8271499882597738280lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On Jan 19, 2026, at 1:31 PM, neil liu <<a href="mailto:liufield@gmail.com" target="_blank">liufield@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Dear Petsc developers and users, <div><br></div><div>I am exploring Schur complement to reuse the inverse of A, for a block matrix [ A B; C D].</div><div>Here A's size is much bigger than D. Therefore it is desirable to reuse the inverse of A. The code is listed below. It works well for 10k tetrahedra elements on 4 ranks . But it shows some error for a coarse mesh (260 tetrahedra cells) on 4 ranks. </div><div>Do i have to sort <b>isNonPort and isPort? </b></div><div>Thanks a lot,</div><div>Xiaodong </div><div><p><b>MatCreateSubMatrix(A, isNonPort, isNonPort, MAT_INITIAL_MATRIX, &A11);</b></p><p><b>MatCreateSubMatrix(A, isNonPort, isPorts, MAT_INITIAL_MATRIX, &A12);</b></p><p><b>  MatCreateSubMatrix(A, isPorts, isNonPort, MAT_INITIAL_MATRIX, &A21);
</b></p><p><b>  MatCreateSubMatrix(A, isPorts, isPorts, MAT_INITIAL_MATRIX, &A22);</b></p><p><b>  Mat S;
</b></p><p><b>  MatCreateSchurComplement(A11, A11, A12, A21, A22, &S);
</b></p><p><b>  MatSchurComplementSetKSP(S, kspA11);</b></p><p><b>  Mat Sdense;
</b></p><p>  <b>MatSchurComplementComputeExplicitOperator(S, &Sdense); </b></p><p><b>  MatAssemblyBegin(Sdense, MAT_FINAL_ASSEMBLY);
</b></p><p><b>  MatAssemblyEnd(Sdense, MAT_FINAL_ASSEMBLY);</b></p><div style="margin:0px;min-width:0px;padding:0px 0px 20px;width:auto;font-family:"Google Sans",Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium"><div><div id="m_-8271499882597738280gmail-:o1" style="direction:ltr;margin:8px 0px 0px;padding:0px;font-size:0.875rem;overflow-x:hidden"><div id="m_-8271499882597738280gmail-:o0" style="direction:ltr;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size-adjust:none;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;font-size:small;line-height:1.5;font-family:Arial,Helvetica,sans-serif;overflow:auto hidden"><div id="m_-8271499882597738280gmail-avWBGd-94"><div dir="ltr">[1]PETSC ERROR: Argument out of range<br>[1]PETSC ERROR: Column entry number 2 (actual column 0) in row 74 is not sorted<br>[1]PETSC ERROR: See <a href="https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!az-Ao1BxQdotvJlqia0i_iZ5sCx1AZNlDZwT2d1YUzJ4TE_esLV_bwZ-lyIBrsVlK3JJu36cOohpqoohAStoSQ$" target="_blank">https://petsc.org/release/faq/</a> for trouble shooting.<br>[1]PETSC ERROR: PETSc Release Version 3.23.3, May 30, 2025<br>[1]PETSC ERROR: ./app with 4 MPI process(es) and PETSC_ARCH arch-linux-c-debug <br>[1]PETSC ERROR: Configure options: -with-cc=gcc --with-fc=gfortran --with-cxx=g++ --download-fblaslapack --download-mpich --with-scalar-type=complex --with-debugging=yes --download-parmetis --download-metis --download-hdf5 --download-scalapack --download-mumps -<br>[1]PETSC ERROR: #1 MatCreateSeqAIJWithArrays() at /Documents/petsc-3.23.3/src/mat/impls/aij/seq/aij.c:5275<br>[1]PETSC ERROR: #2 MatMPIAIJGetLocalMat() at /Documents/petsc-3.23.3/src/mat/impls/aij/mpi/mpiaij.c:5246<br>[1]PETSC ERROR: #3 MatConvert_MPIAIJ_MPIDense() at /Documents/petsc-3.23.3/src/mat/impls/dense/mpi/mpidense.c:1393<br>[1]PETSC ERROR: #4 MatConvert() at /Documents/petsc-3.23.3/src/mat/interface/matrix.c:4485<br>[1]PETSC ERROR: #5 MatSchurComplementComputeExplicitOperator() at /Documents/petsc-3.23.3/src/ksp/ksp/utils/schurm/schurm.c:518</div></div></div></div><div id="m_-8271499882597738280gmail-avWBGd-95" style="clear:both"></div></div></div><p><br></p></div><div><br></div></div>
</div></blockquote></div><br></div></blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><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="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YH0t05h5r0tMJy6-pB5RzN_AwWN0iQY4UAOIQVHEfpxNqymQUvBLWIJYW1am1lI2_cmGA7muK6572OztM9Wn$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div>