<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Arial","sans-serif";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Hello,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Sorry
to raise the question again. It’s a bit detailed..<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>I
was trying to make the column indices a->j sorted for each row for my SEQAIJ
Matrix (reason explained below). I looked up the source code and found MAT_COLUMNS_SORTED
option, and I can do a MatSetOption to set that. However, even now with
a->sorted=PETSC_TRUE, I still see my a->j’s unsorted for each row
after a bunch of MatSetValues. Is there a particular procedure that I should
follow to have each row of my matrix sorted? Or I have to do it outside PETSc?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>I
should not care how PETSc store matrix, however, the reason that I need it to
be sorted is that in SSOR implementation, there seems to be an assumption that
the column indices being sorted for zero initial guess ( n=diag[i]-a->i[i];
in MatRelax_SeqAIJ )… I suspect I might have misunderstandings here. But
at least I would like to try a sorted matrix on SSOR to clarify.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Any
suggestions?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thanks,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Chun<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
petsc-users-bounces@mcs.anl.gov [mailto:petsc-users-bounces@mcs.anl.gov] <b>On
Behalf Of </b>Matthew Knepley<br>
<b>Sent:</b> Monday, April 27, 2009 11:33 AM<br>
<b>To:</b> PETSc users list<br>
<b>Subject:</b> Re: SSOR problem<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'>The function
MatMarkDiagonal_SeqAIJ() takes care of this.<br>
<br>
Matt<o:p></o:p></p>
<div>
<p class=MsoNormal>On Mon, Apr 27, 2009 at 9:34 AM, SUN Chun <<a
href="mailto:Chun.SUN@3ds.com">Chun.SUN@3ds.com</a>> wrote:<o:p></o:p></p>
<p class=MsoNormal>Hello,<br>
<br>
I have an update to this problem:<br>
<br>
I found that in MatRelax_SeqAIJ function (mat/impl/aij/seq/aij.c), I have:<br>
<br>
diag = a->diag and:<br>
<br>
diag[i] is has exactly the same value of a->i[i] for each row i. This gives
me n=0 when doing forward pass of zero initial guess. That explains why setting
-pc_sor_forward will give me identical results as if I run pure DSCG.<br>
<br>
I assume that this a->diag[] stores the sparse column index of diagonal
entries of a matrix. Now it seems to be improperly set. I will pursue this
further in debugger. Do you know which function it should be set during the
assembly process? That would point a short-cut for me....<br>
<br>
Thanks again!<br>
<span style='color:#888888'>Chun</span><o:p></o:p></p>
<div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
<br>
-----Original Message-----<br>
From: <a href="mailto:petsc-users-bounces@mcs.anl.gov">petsc-users-bounces@mcs.anl.gov</a>
[mailto:<a href="mailto:petsc-users-bounces@mcs.anl.gov">petsc-users-bounces@mcs.anl.gov</a>]
On Behalf Of SUN Chun<br>
Sent: Monday, April 27, 2009 9:13 AM<br>
To: PETSc users list<br>
Subject: SSOR problem<br>
<br>
Hello,<br>
<br>
I have an *particular* Ax=b which I want to solve with CG preconditioned<br>
by SSOR using PETSc. Then some specific strange things happen. Please<br>
allow me to describe all the symptoms that I found here. Thanks for your<br>
help:<br>
<br>
0) All solves are in serial.<br>
<br>
1) A 20-line academic code and another matlab code converge the solution<br>
with identical residual history and number of iterations (76), they<br>
match well. If I run without SSOR (just diagonal scaled CG): PETSc,<br>
academic code, and matlab all match well with same number (180) of<br>
iterations.<br>
<br>
2) PETSc with SSOR seems to give me -8 indefinite pc. If I play with<br>
omega other than using 1.0 (as in Gauss-Seidel), sometimes (with<br>
omega=1.2) I see stagnation and it won't converge then exceeds the<br>
maximum iteration allowed (500). Residuals even don't go down. If I<br>
don't say -ksp_diagonal_scale, I get -8 too. So, PETSc with SSOR either<br>
gives me -8 or -3.<br>
<br>
3) The above was run with -pc_sor_symmetric. However, if I ran with<br>
-pc_sor_forward, I got a convergence curve identical to what I have<br>
without any preconditioner, with same iterations (180). If I ran with<br>
-pc_sor_backward, it gives me -8 indefinite pc.<br>
<br>
4) If I increase any of the number of -pc_sor_its (or lits) to 2, it<br>
converges (but still don't match the matlab/academic code).<br>
<br>
5) The matrix has good condition number (~8000), maximum diagonal is<br>
about 6, minimum diagonal is about 1.1. There's no zero or negative<br>
diagonal entries in this matrix. It's spd otherwise matlab won't be able<br>
to solve it.<br>
<br>
6) The behavior is independent of rhs. I've tried random rhs and get the<br>
same scenario.<br>
<br>
7) Here is the confusing part: All other matrices that we have except<br>
for this one can be solved by PETSc with same settings very well. And<br>
they match the academic code and matlab code. It's just this matrix that<br>
exhibits the strange behavior. I tend to eliminate the possibility of<br>
interface problem because all other matrices and other preconditioner<br>
settings work well.<br>
<br>
We're running out of ideas here, if you have any insight please say<br>
anything or point any directions.<br>
<br>
Thanks a lot,<br>
Chun<br>
<br>
<br>
<o:p></o:p></p>
</div>
</div>
</div>
<p class=MsoNormal><br>
<br clear=all>
<br>
-- <br>
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<o:p></o:p></p>
</div>
</body>
</html>