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

Barry Smith bsmith at mcs.anl.gov
Fri Apr 22 11:29:30 CDT 2016


   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