How to get the matrix after ordering

Barry Smith bsmith at mcs.anl.gov
Thu Feb 26 08:25:04 CST 2009



On Feb 26, 2009, at 2:20 AM, Shengli Xu wrote:
>
>
> Another question: Matrix A is known, there are some zero entries in  
> A. For example A(2,3)=0.0 and A(4,5)=0.0. I want to get a new matrix  
> B, which has the same nonzero structure as A but does not have the   
> entries  where are zero in A. For example no entries of B(2,3) and  
> B(4,5). How to get Matrix B?

    There isn't anything like this. It is also not a desirable  
operation since the matrix has to be copied into new memory so you  
really are not getting a memory savings. Just try to do the best you  
can with not having zero values and don't sweat having a few.

     MatOption(A, MAT_IGNORE_ZERO_ENTRIES) will cause any call of  
MatSetValues() with a zero value to be ignored and not introduce a  
"zero" "nonzero location" into the matrix.

    Barry

>
>
> I want to use MatGetSeqNonzeroStructure(), But I don't think clearly.
>
> thanks in advance.
>
>
> -- 
> Shengli Xu
> -- 
> What most experimenters take for granted before they begin their  
> experiments is infinitely more interesting than any results to which  
> their experiments lead.
> -- Norbert Wiener
>
>
>
> -- 
> Shengli Xu



More information about the petsc-users mailing list