[petsc-users] question about MatXAIJSetPreallocation

Geoffrey Irving irving at naml.us
Tue Oct 2 18:57:52 CDT 2012


On Tue, Oct 2, 2012 at 4:48 PM, Geoffrey Irving <irving at naml.us> wrote:
> The dnnz argument to MatXAIJSetPreallocation is described as
>
>     dnnz - number of nonzero blocks per block row of diagonal part of
> parallel matrix
>
> To me, this implies that if the matrix has size m and the block size
> is bs, dnnz should have size m/bs.  However, the loop inside the
> routine looks like
>
>      for (i=0; i<m*bs; i++) {
>         if (dnnz) sdnnz[i] = dnnz[i/bs] * bs;
>         if (onnz) sonnz[i] = onnz[i/bs] * bs;
>       }
>
> which implies that dnnz should have m entries.  Is this a bug, or am I
> misinterpreting the meaning of dnnz?

It looks like the loop hasn't changed since the beginning of
MatXAIJSetPreallocation, but the comment changed from

    dnnz - number of nonzeros per row of diagonal block of parallel matrix

to

    dnnz - number of nonzero blocks per block row of diagonal part of
parallel matrix

in

    commit abccccb5e4359792067c7bef9b175a0511adf626
    Author: Jed Brown <jed at 59A2.org>
    Date:   Thu Mar 1 11:51:58 2012 -0600

        Remove the maximum nonzero arguments from MatXAIJSetPreallocation()

I'll change my code to match the first comment and see if it works.

Geoffrey


More information about the petsc-users mailing list