<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 22, 2016 at 12:18 PM, Wei Deng <span dir="ltr"><<a href="mailto:deng106@purdue.edu" target="_blank">deng106@purdue.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is a symmetric matrix and use sysrcm in matlab transform this into banded, however, call rcm in petsc still fails.<br></blockquote><div><br></div><div>Fails is not descriptive enough. Please send the screenshot.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
filename = 'C:\Users\Wei\Desktop\bcspwr03.mat';<br>
load(filename)<br>
A=Problem.A;<br>
p = symrcm(A);<br>
R = A(p,p);<br>
% change to dense<br>
%B = full(R);<br>
bandwidth(R)<br>
subplot(1,2,2),spy(A),title(name)<br>
subplot(1,2,2),spy(R),title(name)<br>
<br>
name = 'Zd_Jac6.mat'<br>
path = 'C:\Users\Wei\Documents\Courses\Parallelism Numerical Linear Algebra\CS515\matlab\'<br>
filename = strcat(path,name);<br>
load(filename)<br>
A=Problem.A;<br>
p = symrcm(A);<br>
R = A(p,p);<br>
% change to dense<br>
%B = full(R);<br>
bandwidth(R)<br>
subplot(1,2,2),spy(A),title(name)<br>
subplot(1,2,2),spy(R),title(name)<br>
<br>
-----邮件原件-----<br>
发件人: Barry Smith [mailto:<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>]<br>
发送时间: Friday, April 22, 2016 12:38 PM<br>
收件人: Wei Deng <<a href="mailto:deng106@purdue.edu">deng106@purdue.edu</a>>; PETSc users list <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
主题: Re: [petsc-users] 答复: About the MatGetOrdering in Petsc<br>
<br>
<br>
<a href="https://en.wikipedia.org/wiki/Cuthill%E2%80%93McKee_algorithm" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/Cuthill–McKee_algorithm</a> indicates that these algorithms are for symmetric matrices.<br>
<br>
Perhaps MATLAB detects a non-symmetric matrix and does something different in that case.<br>
<br>
Barry<br>
<br>
> On Apr 22, 2016, at 11:32 AM, Wei Deng <<a href="mailto:deng106@purdue.edu">deng106@purdue.edu</a>> wrote:<br>
><br>
> So that means that this RCM may be not sufficiently work for a non-symmetric matrix?<br>
><br>
><br>
> -----邮件原件-----<br>
> 发件人: Barry Smith [mailto:<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>]<br>
> 发送时间: Friday, April 22, 2016 12:30 PM<br>
> 收件人: Wei Deng <<a href="mailto:deng106@purdue.edu">deng106@purdue.edu</a>><br>
> 抄送: <a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a><br>
> 主题: Re: [petsc-users] 答复: About the MatGetOrdering in Petsc<br>
><br>
><br>
> 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<br>
><br>
> /*****************************************************************/<br>
> /*****************************************************************/<br>
> /********* GENRCM ..... GENERAL REVERSE CUTHILL MCKEE ********/<br>
> /*****************************************************************/<br>
><br>
> /* PURPOSE - GENRCM FINDS THE REVERSE CUTHILL-MCKEE*/<br>
> /* ORDERING FOR A GENERAL GRAPH. FOR EACH CONNECTED*/<br>
> /* COMPONENT IN THE GRAPH, GENRCM OBTAINS THE ORDERING*/<br>
> /* BY CALLING THE SUBROUTINE RCM.*/<br>
><br>
> /* INPUT PARAMETERS -*/<br>
> /* NEQNS - NUMBER OF EQUATIONS*/<br>
> /* (XADJ, ADJNCY) - ARRAY PAIR CONTAINING THE ADJACENCY*/<br>
> /* STRUCTURE OF THE GRAPH OF THE MATRIX.*/<br>
><br>
> /* OUTPUT PARAMETER -*/<br>
> /* PERM - VECTOR THAT CONTAINS THE RCM ORDERING.*/<br>
><br>
> /* WORKING PARAMETERS -*/<br>
> /* MASK - IS USED TO MARK VARIABLES THAT HAVE BEEN*/<br>
> /* NUMBERED DURING THE ORDERING PROCESS. IT IS*/<br>
> /* INITIALIZED TO 1, AND SET TO ZERO AS EACH NODE*/<br>
> /* IS NUMBERED.*/<br>
> /* XLS - THE INDEX VECTOR FOR A LEVEL STRUCTURE. THE*/<br>
> /* LEVEL STRUCTURE IS STORED IN THE CURRENTLY*/<br>
> /* UNUSED SPACES IN THE PERMUTATION VECTOR PERM.*/<br>
><br>
> /* PROGRAM SUBROUTINES -*/<br>
> /* FNROOT, RCM.*/<br>
> /*****************************************************************/<br>
> #undef __FUNCT__<br>
><br>
>> On Apr 22, 2016, at 8:36 AM, Wei Deng <<a href="mailto:deng106@purdue.edu">deng106@purdue.edu</a>> wrote:<br>
>><br>
>> In other words, does the function MatGetOrdering only support symmetric matrix? It can’t work well in other cases?<br>
>><br>
>> 发件人: Wei Deng [mailto:<a href="mailto:deng106@purdue.edu">deng106@purdue.edu</a>]<br>
>> 发送时间: Thursday, April 21, 2016 11:59 PM<br>
>> 收件人: '<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>' <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
>> 主题: About the MatGetOrdering in Petsc<br>
>><br>
>> Dear Sir/Madam,<br>
>><br>
>><br>
>> 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.<br>
>><br>
>> Do you know why?<br>
>><br>
>> The attachment is the code with which I have trouble.<br>
>><br>
>><br>
>> Thanks a lot.<br>
>><br>
>><br>
>> Wei Deng<br>
>> Purdue Uni.<br>
><br>
><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>