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

Matthew Knepley knepley at gmail.com
Sat Apr 23 11:00:54 CDT 2016


On Fri, Apr 22, 2016 at 8:03 PM, Wei Deng <deng106 at purdue.edu> wrote:

> There is no bug, as the figure shows, rcm in matlab works well for
> symmetric matrix, however, petsc rcm has some bad points, like (117,9)
>

Wei,

We are not trying to do anything but call SPARSEPAK. It is possible that we
have made an error here, which I will check. However,
I believe that RCM depends on the starting row, and perhaps Matlab is doing
some preprocessing here. Since we cannot see exactly
what algorithm is being used in Matlab, there is no way for us to verify or
match it. Perhaps you could send a small example which we
can verify explicitly what ordering Matlab is using. That way we could see
which row becomes 0.

  Thanks,

      Matt


>
>
> *发件人**:* Matthew Knepley [mailto:knepley at gmail.com]
> *发送时间:* Friday, April 22, 2016 2:32 PM
> *收件人:* Wei Deng <deng106 at purdue.edu>
> *抄送:* Barry Smith <bsmith at mcs.anl.gov>; PETSc users list <
> petsc-users at mcs.anl.gov>
> *主题:* Re: [petsc-users] 答复: 答复: About the MatGetOrdering in Petsc
>
>
>
> On Fri, Apr 22, 2016 at 12:18 PM, Wei Deng <deng106 at purdue.edu> wrote:
>
> This is a symmetric matrix and use sysrcm in matlab transform this into
> banded, however, call rcm in petsc still fails.
>
>
>
> Fails is not descriptive enough. Please send the screenshot.
>
>
>
>    Matt
>
>
>
> filename = 'C:\Users\Wei\Desktop\bcspwr03.mat';
> load(filename)
> A=Problem.A;
> p = symrcm(A);
> R = A(p,p);
> % change to dense
> %B = full(R);
> bandwidth(R)
> subplot(1,2,2),spy(A),title(name)
> subplot(1,2,2),spy(R),title(name)
>
> name = 'Zd_Jac6.mat'
> path = 'C:\Users\Wei\Documents\Courses\Parallelism Numerical Linear
> Algebra\CS515\matlab\'
> filename = strcat(path,name);
> load(filename)
> A=Problem.A;
> p = symrcm(A);
> R = A(p,p);
> % change to dense
> %B = full(R);
> bandwidth(R)
> subplot(1,2,2),spy(A),title(name)
> subplot(1,2,2),spy(R),title(name)
>
> -----邮件原件-----
> 发件人: Barry Smith [mailto:bsmith at mcs.anl.gov]
> 发送时间: Friday, April 22, 2016 12:38 PM
> 收件人: Wei Deng <deng106 at purdue.edu>; PETSc users list <
> petsc-users at mcs.anl.gov>
> 主题: Re: [petsc-users] 答复: About the MatGetOrdering in Petsc
>
>
> 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.
> >
> >
>
>
>
>
>
> --
>
> 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
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160423/a85c1396/attachment-0001.html>


More information about the petsc-users mailing list