Dynamic allocation of Non zeros?

Barry Smith bsmith at mcs.anl.gov
Thu Nov 1 16:08:25 CDT 2007



    Zhifeng,

      We already do this; it helps with the time, but still results in  
very inefficient runs if your preallocation is zero entries.

     Perhaps you could describe how your matrix entries are generated  
and we can suggest a
preallocation scheme?

    Barry


On Nov 1, 2007, at 7:52 AM, Zhifeng Sheng wrote:

> Dear all
>
> It is always not easy to determine the number of nonzeros in a row  
> without any cost.
>
> I wonder if I can make dynamic allocation, for instance, if one  
> found the nonzeros of a row overflow the pre-allocated space, then  
> the space shall be doubled.
>
> This may waste some memory but it may not be that bad. Or maybe this  
> is already done in Petsc?
>
> Could please tell what happens if I assign the nozero number in rows  
> to be zeros and let the programme fills in the nonzeros ?
>
> Best regards
> Zhifeng Sheng
>




More information about the petsc-users mailing list