Extend preallocation

Barry Smith bsmith at mcs.anl.gov
Wed Sep 24 09:06:28 CDT 2008


    Rather than using MatMatMult(), you may want to use  
MatPtAPSymbolic()/MatPtAPNumeric().

    Rather than hacking the MatMatMult() codes I think it would be  
better to have an efficient
MatShift() (also MatDiagonalSet()). Note that the _MatOps table has a  
place holder for shift()
but it is not used by the AIJ/BAIJ/SBAIJ implementations, instead the  
default is used that calls
MatSetValues() for each diagonal entry. An efficient MatShift() could  
be written for SeqAIJ (also SeqBAIJ/SeqSBAIJ)
that handled any data movement for ALL diagonal insertions needed at  
the same time.

    Barry



On Sep 23, 2008, at 9:38 PM, ntardieu at giref.ulaval.ca wrote:

> Dear Petsc users,
>
> I would like to compute the sparse projection matrix Q=Id - Pt*A*P.
>
> Pt*A*P is very well computed by MatMatMult ; then I would like to use
> MatShift in order to complete the computation.
> Unfortunately, Pt*A*P has lots of zeros on its diagonal, thus  
> MatShift is
> very slow due to inapropriate preallocation.
>
> Since the initial preallocation of Pt*A*P is very good, I would to  
> know if
> there is a method allowing to get the allocation data structure and to
> extend it in order to preallocate the diagonal terms.
>
> Best regards,
>
> Nicolas
>
>
>




More information about the petsc-users mailing list