[petsc-users] MatGetValues / MatGetRow

Smith, Barry F. bsmith at mcs.anl.gov
Mon May 28 00:20:32 CDT 2018



> On May 28, 2018, at 12:15 AM, Marius Buerkle <mbuerkle at web.de> wrote:
> 
> No M is stored as MPIAIJ, as all but the A11 and A33 blocks are very sparse. I want to add  A11 and A33 which are calculuted seperatly using MATSOLVERELEMENTAL into the bigger matrix M and then use a sparse solver on M.

   Hmm, how big are the A11 and A33? Who calculates them separately?

   I would use MatConvert() on these two "separate" matrices as I mentioned before and call MatSetValues() with the resulting dense matrices to put the 
"dense" values into the sparse M matrix.


   Barry

>  
>  
> 
> 
> > On May 27, 2018, at 11:23 PM, Marius Buerkle <mbuerkle at web.de> wrote:
> >
> > Thanks for the swift reply. I want to from, eventually invert, a sparse matrix of the form M=[A11 A12 A13 , A21 A22 A23 , A31 A32 A33], where A11 and A33 are dense square matrices which have a (much) smaller dimension than the other (sparse) sub matrices of M. A11 and A33 are obtained from a separate calculation.
> 
> I don't understand how this relates to your elemental question?
> 
> How are you storing the M matrix? As Elemental matrix?
> 
> Barry
> 
> >
> >
> >
> >
> >
> >>
> >> Hi !
> >>
> >> Are MatGetValues / MatGetRow implemented for MATELEMENTAL?
> >
> > A quick check seems to say no.
> >
> >> Or is there another way to access the elements of an ELEMENTAL matrix?
> >
> > There is no obvious way to access the elements of an Elemental matrix except to directly access the elemental data structure (which presumably is hairy) or to MatConvert(A,MATDENSE,MAT_INITIAL_MATRIX,&Adense); and then access in the dense format (note this conversion is expensive and needs to do communication).
> >
> >
> > Why do you wish to access the values directly instead of use them indirectly with the API, such as matrix-vector products, factorizations etc?
> >
> >
> >
> > Barry
> >
> >>
> >> best,
> >> marius
> >
>  



More information about the petsc-users mailing list