[petsc-users] nonzero structure setting and remembering

Jed Brown jedbrown at mcs.anl.gov
Mon May 21 14:29:05 CDT 2012


On Mon, May 21, 2012 at 2:20 PM, Andrew Spott <andrew.spott at gmail.com>wrote:

> How do I read the nonzero structure (from an assembled matrix?)
>

MatGetRow()


>
> -Andrew
>
> On May 18, 2012, at 2:31 PM, Jed Brown wrote:
>
> On Fri, May 18, 2012 at 3:26 PM, Andrew Spott <andrew.spott at gmail.com>wrote:
>
>> I have a couple of questions about how to deal with the nonzero structure.
>>
>> 0)  Is the "nonzero structure" the same as "number of non zeros per row"?
>> Or are they different?
>>
>
> Yes, for parallel *AIJ matrices, it's the number of nonzeros in the
> diagonal part and in the off-diagonal part. Preallocation can optionally
> also set the column indices, but it's not critical.
>
>
>>
>> 1)  How much of a speedup do you get for copying/creating/loading
>> matrices when you set the number of non zeros per row beforehand? (if the
>> nonzero structure is different from the number of non zeros per row, what
>> about the nonzero structure)
>>
>
> a million
>
>
>>
>> 2)  If I have a matrix, how do I add to the nonzero structure, without
>> actually adding nonzero values, do I just add "0.0"? (the matrix will have
>> values there, but doesn't at the moment)
>>
>
> Mat*AIJSetPreallocation(), then reassemble.
>
>
>>
>> As usual, thanks for all the help
>>
>> -Andrew
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120521/9229353e/attachment.html>


More information about the petsc-users mailing list