How to get the matrix after ordering

Shengli Xu shengli.xu.xu at gmail.com
Thu Feb 26 02:20:14 CST 2009


2009/2/23 Matthew Knepley <knepley at gmail.com>

> On Sun, Feb 22, 2009 at 9:30 PM, Shengli Xu <shengli.xu.xu at gmail.com>wrote:
>
>>
>> Hi everyone,
>>
>> I want get the ordering matrix of a sparse matrix. I use
>> MatGetOrdering(Mat matrix, MatOrderingType type, IS* rowperm, IS* colperm);
>> to get rowperm and colperm.
>>
>> How to get the matrix after ordering?
>
>
> I am  not sure what you mean. A MatOrdering is exactly those permutation
> vectors. We do not
> change the matrix. If you want to change the matrix, you must use something
> like MatPermute().
>
>   Matt
>
>
Thank you Matt, MatPermute() is what I want.

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?

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090226/8585eaaa/attachment.htm>


More information about the petsc-users mailing list