<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 22, 2016 at 8:03 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"><div lang="EN-US" link="blue" vlink="purple"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">There is no </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">bug</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">, as the figure shows, rcm in matlab works well for symmetric matrix, however, petsc rcm has some bad points, like (117,9)</span></p></div></blockquote><div><br></div><div>Wei,</div><div><br></div><div>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,</div><div>I believe that RCM depends on the starting row, and perhaps Matlab is doing some preprocessing here. Since we cannot see exactly</div><div>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</div><div>can verify explicitly what ordering Matlab is using. That way we could see which row becomes 0.</div><div><br></div><div> Thanks,</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"><div lang="EN-US" link="blue" vlink="purple"><p class="MsoNormal"><a name="m_-3318635099428951566__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span></a></p><span></span><p class="MsoNormal"><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:DengXian">发件人</span></b><b><span style="font-size:11.0pt;font-family:DengXian">:</span></b><span style="font-size:11.0pt;font-family:DengXian"> Matthew Knepley [mailto:<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>] <br><b><span lang="ZH-CN">发送时间</span>:</b> Friday, April 22, 2016 2:32 PM<br><b><span lang="ZH-CN">收件人</span>:</b> Wei Deng <<a href="mailto:deng106@purdue.edu" target="_blank">deng106@purdue.edu</a>><br><b><span lang="ZH-CN">抄送</span>:</b> Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>>; PETSc users list <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br><b><span lang="ZH-CN">主题</span>:</b> Re: [petsc-users] <span lang="ZH-CN">答复</span>: <span lang="ZH-CN">答复</span>: About the MatGetOrdering in Petsc<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><div><div><div><p class="MsoNormal">On Fri, Apr 22, 2016 at 12:18 PM, Wei Deng <<a href="mailto:deng106@purdue.edu" target="_blank">deng106@purdue.edu</a>> wrote:<u></u><u></u></p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt"><p class="MsoNormal">This is a symmetric matrix and use sysrcm in matlab transform this into banded, however, call rcm in petsc still fails.<u></u><u></u></p></blockquote><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Fails is not descriptive enough. Please send the screenshot.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"> Matt<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt"><p class="MsoNormal" style="margin-bottom:12.0pt">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>-----<span style="font-family:"Microsoft JhengHei",sans-serif">邮件原件</span>-----<br><span style="font-family:"Microsoft JhengHei",sans-serif">发件人</span>: Barry Smith [mailto:<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>]<br><span style="font-family:"Microsoft JhengHei",sans-serif">发送时间</span>: Friday, April 22, 2016 12:38 PM<br><span style="font-family:"MS Gothic"">收件人</span>: Wei Deng <<a href="mailto:deng106@purdue.edu" target="_blank">deng106@purdue.edu</a>>; PETSc users list <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br><span style="font-family:"MS Gothic"">主</span><span style="font-family:"Microsoft JhengHei",sans-serif">题</span>: Re: [petsc-users] <span style="font-family:"MS Gothic"">答复</span>: About the MatGetOrdering in Petsc<br><br><br><a href="https://en.wikipedia.org/wiki/Cuthill%E2%80%93McKee_algorithm" 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" target="_blank">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>> -----<span style="font-family:"Microsoft JhengHei",sans-serif">邮件原件</span>-----<br>> <span style="font-family:"Microsoft JhengHei",sans-serif">发件人</span>: Barry Smith [mailto:<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>]<br>> <span style="font-family:"Microsoft JhengHei",sans-serif">发送时间</span>: Friday, April 22, 2016 12:30 PM<br>> <span style="font-family:"MS Gothic"">收件人</span>: Wei Deng <<a href="mailto:deng106@purdue.edu" target="_blank">deng106@purdue.edu</a>><br>> <span style="font-family:"MS Gothic"">抄送</span>: <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br>> <span style="font-family:"MS Gothic"">主</span><span style="font-family:"Microsoft JhengHei",sans-serif">题</span>: Re: [petsc-users] <span style="font-family:"MS Gothic"">答复</span>: 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" target="_blank">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>>> <span style="font-family:"Microsoft JhengHei",sans-serif">发件人</span>: Wei Deng [mailto:<a href="mailto:deng106@purdue.edu" target="_blank">deng106@purdue.edu</a>]<br>>> <span style="font-family:"Microsoft JhengHei",sans-serif">发送时间</span>: Thursday, April 21, 2016 11:59 PM<br>>> <span style="font-family:"MS Gothic"">收件人</span>: '<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>' <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>>> <span style="font-family:"MS Gothic"">主</span><span style="font-family:"Microsoft JhengHei",sans-serif">题</span>: 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>><u></u><u></u></p></blockquote></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><p class="MsoNormal">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<u></u><u></u></p></div></div></div></div></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>