[petsc-users] 答复: About the MatGetOrdering in Petsc

Barry Smith bsmith at mcs.anl.gov
Fri Apr 22 11:37:50 CDT 2016


https://en.wikipedia.org/wiki/Cuthill–McKee_algorithm  indicates that these algorithms are for symmetric matrices.

Perhaps MATLAB detects a non-symmetric matrix and does something different in that case.

Barry

> On Apr 22, 2016, at 11:32 AM, Wei Deng <deng106 at purdue.edu> wrote:
> 
> So that means that this RCM may be not sufficiently work for a non-symmetric matrix?
> 
> 
> -----邮件原件-----
> 发件人: Barry Smith [mailto:bsmith at mcs.anl.gov] 
> 发送时间: Friday, April 22, 2016 12:30 PM
> 收件人: Wei Deng <deng106 at purdue.edu>
> 抄送: petsc-users at mcs.anl.gov
> 主题: Re: [petsc-users] 答复: About the MatGetOrdering in Petsc
> 
> 
>   It can be applied to any graph but produces only a single permutation (that is it returns the same permutation for the rows and the columns even if the matrix is non-symmetric. From the source code
> 
> /*****************************************************************/
> /*****************************************************************/
> /*********   GENRCM ..... GENERAL REVERSE CUTHILL MCKEE   ********/
> /*****************************************************************/
> 
> /*    PURPOSE - GENRCM FINDS THE REVERSE CUTHILL-MCKEE*/
> /*       ORDERING FOR A GENERAL GRAPH. FOR EACH CONNECTED*/
> /*       COMPONENT IN THE GRAPH, GENRCM OBTAINS THE ORDERING*/
> /*       BY CALLING THE SUBROUTINE RCM.*/
> 
> /*    INPUT PARAMETERS -*/
> /*       NEQNS - NUMBER OF EQUATIONS*/
> /*       (XADJ, ADJNCY) - ARRAY PAIR CONTAINING THE ADJACENCY*/
> /*              STRUCTURE OF THE GRAPH OF THE MATRIX.*/
> 
> /*    OUTPUT PARAMETER -*/
> /*       PERM - VECTOR THAT CONTAINS THE RCM ORDERING.*/
> 
> /*    WORKING PARAMETERS -*/
> /*       MASK - IS USED TO MARK VARIABLES THAT HAVE BEEN*/
> /*              NUMBERED DURING THE ORDERING PROCESS. IT IS*/
> /*              INITIALIZED TO 1, AND SET TO ZERO AS EACH NODE*/
> /*              IS NUMBERED.*/
> /*       XLS - THE INDEX VECTOR FOR A LEVEL STRUCTURE.  THE*/
> /*              LEVEL STRUCTURE IS STORED IN THE CURRENTLY*/
> /*              UNUSED SPACES IN THE PERMUTATION VECTOR PERM.*/
> 
> /*    PROGRAM SUBROUTINES -*/
> /*       FNROOT, RCM.*/
> /*****************************************************************/
> #undef __FUNCT__
> 
>> On Apr 22, 2016, at 8:36 AM, Wei Deng <deng106 at purdue.edu> wrote:
>> 
>> In other words, does the function MatGetOrdering only support symmetric matrix? It can’t work well in other cases?
>> 
>> 发件人: Wei Deng [mailto:deng106 at purdue.edu] 
>> 发送时间: Thursday, April 21, 2016 11:59 PM
>> 收件人: 'petsc-users at mcs.anl.gov' <petsc-users at mcs.anl.gov>
>> 主题: About the MatGetOrdering in Petsc
>> 
>> Dear Sir/Madam,
>> 
>> 
>> When I was trying to change a sparse matrix into a banded one, I can use RCM in matlab to change it perfectly. But this does not work in Petsc, most points were moved to the diagonal position. However, there are still some points left, leading the width unacceptable.
>> 
>> Do you know why?
>> 
>> The attachment is the code with which I have trouble.
>> 
>> 
>> Thanks a lot.
>> 
>> 
>> Wei Deng
>> Purdue Uni.
> 
> 



More information about the petsc-users mailing list