[petsc-users] Determining maximum number of columns in sparse matrix

Matthew Knepley knepley at gmail.com
Sun Nov 6 16:35:02 CST 2022


On Sun, Nov 6, 2022 at 5:31 PM Alexander Lindsay <alexlindsay239 at gmail.com>
wrote:

> We sometimes overallocate our sparsity pattern. Matrix assembly will
> squeeze out allocations that we never added into/set. Is there a convenient
> way to determine the size of the densest row post-assembly? I know that we
> could iterate over rows and call `MatGetRow` and figure it out that way.
> But I'm wondering if there is a better way?
>

You could use https://petsc.org/main/docs/manualpages/Mat/MatGetRowIJ/
which gives all the row lengths at once.

  Thanks,

     Matt


> Alex
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221106/89285935/attachment.html>


More information about the petsc-users mailing list