[petsc-users] quick question on MatXAIJSetPreallocation

Jed Brown jed at jedbrown.org
Wed Oct 30 17:53:01 CDT 2019


Xiangdong via petsc-users <petsc-users at mcs.anl.gov> writes:

> Hello everyone,
>
> It seems that to use MatXAIJSetPreallocation, one has to pass the array of
> the number of nonzero blocks per row, even if this number is same across
> all the local rows.
>
> For the other preallocation functions (say, MatMPIBAIJSetPreallocation),
> they do support both a constant and a array for the number of nonzeros.
>
> I am curious that the reason MatAIJSetPreallocation does not support the
> constant number of nonzeros case.

It was in the interest of limiting the number of arguments and
recognizing that it's easy to call all relevant preallocation functions
if you have constant row lengths, but somewhat involved to convert if
you don't.


More information about the petsc-users mailing list