<div dir="ltr"><div dir="ltr">On Tue, Apr 14, 2020 at 6:28 PM Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Other basic operations (i.e. MatAXPY_Basic) handles this programmatically. You should open an MR fixing it.</div></blockquote><div><br></div><div>It looks like all you have to do is bracket the MatChop code with</div><div><br></div><div>    ierr = MatGetRowUpperTriangular(X);CHKERRQ(ierr);<br></div><div>    ierr = MatRestoreRowUpperTriangular(X);CHKERRQ(ierr);<br></div><div><br></div><div>Since you already have a test, should go quickly.</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 style="overflow-wrap: break-word;"><div><div><blockquote type="cite"><div>On Apr 15, 2020, at 1:22 AM, Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> wrote:</div><br><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline">Jacob Faibussowitsch <</span><a href="mailto:jacob.fai@gmail.com" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">jacob.fai@gmail.com</a><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline">> writes:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Hello All,<br><br>When using MATSBAIJ and MatChop you get the following error:<br><br>[0]PETSC ERROR: No support for this operation for this object type<br>[0]PETSC ERROR: MatGetRow is not supported for SBAIJ matrix format. Getting the upper triangular part of row, run with -mat_getrow_uppertriangular, call MatSetOption(mat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE) or MatGetRowUpperTriangular()<br>[0]PETSC ERROR: See <a href="https://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">https://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>[0]PETSC ERROR: Petsc Development GIT revision: v3.13-108-ga86b3fd671  GIT Date: 2020-04-10 15:27:46 -0500<br>[0]PETSC ERROR: ./tightbinding on a arch-slepc-lammps named Jacobs-MacBook-Pro.local by jacobfaibussowitsch Tue Apr 14 16:57:07 2020<br>[0]PETSC ERROR: Configure options --download-slepc --with-blaslapack --with-debugging=yes --with-mpi-dir=/Users/jacobfaibussowitsch/NoSync/petscpackages PETSC_ARCH=arch-slepc-lammps<br>[0]PETSC ERROR: #1 MatGetRow_SeqSBAIJ() line 294 in /Users/jacobfaibussowitsch/NoSync/petsc/src/mat/impls/sbaij/seq/sbaij.c<br>[0]PETSC ERROR: #2 MatGetRow() line 563 in /Users/jacobfaibussowitsch/NoSync/petsc/src/mat/interface/matrix.c<br>[0]PETSC ERROR: #3 MatChop() line 488 in /Users/jacobfaibussowitsch/NoSync/petsc/src/mat/utils/axpy.c<br>[0]PETSC ERROR: #4 CreateHamiltonian() line 425 in /Users/jacobfaibussowitsch/NoSync/TB/tightbinding.c<br>[0]PETSC ERROR: #5 main() line 458 in /Users/jacobfaibussowitsch/NoSync/TB/tightbinding.c<br><br>But if you follow the instructions above, i.e. running with -mat_getrow_uppertriangular true then this works without a hitch.<span> </span><br><br>Since MATSBAIJ is always symmetric and upper triangular by design, then shouldn’t this MatOption be enabled by default? Or maybe MatChop should check MatType and use the correct MatGetRow impls.<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline">MatChop should handle it, but MatGetRow() needs to get the whole row (or fail, as in this case), otherwise many algorithms will break in confusing ways when someone lobs in -dm_mat_type sbaij.</span></div></blockquote></div><br></div></div></blockquote></div><br clear="all"><div><br></div>-- <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="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>