<div>Thank you very much.</div>
<div> </div>
<div>David<br><br></div>
<div class="gmail_quote">On Sun, Mar 7, 2010 at 12:42 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div style="WORD-WRAP: break-word">
<div><br></div><a href="http://www.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-dev/docs/manualpages/Mat/MatCreateShell.html#MatCreateShell" target="_blank">http://www.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-dev/docs/manualpages/Mat/MatCreateShell.html#MatCreateShell</a> 
<div><br></div>
<div>  This allows you to create a Mat that can be passed to KSPSetOperators() that provides matrix-vector products (and possibly other operations) but does not explicitly store the nonzero entries of the matrix.  This is exactly what you need to use for the A.</div>

<div><br></div><font color="#888888">
<div>   Barry</div></font>
<div>
<div></div>
<div class="h5">
<div><br>
<div>
<div>On Mar 7, 2010, at 12:36 PM, David sheehan wrote:</div><br>
<blockquote type="cite">
<div>Can you give me any more details about it? thanks.</div>
<div> </div>
<div>David<br><br></div>
<div class="gmail_quote">On Sun, Mar 7, 2010 at 12:22 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>On Sun, Mar 7, 2010 at 12:20 PM, David sheehan <span dir="ltr"><<a href="mailto:david.sheehanjr@gmail.com" target="_blank">david.sheehanjr@gmail.com</a>></span> wrote:<br></div>
<div class="gmail_quote">
<div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>>I mean Ax =b doesn't have A in explicit form, but in expression A=B+C1+C2+...+Cn, </div>
<div>>where B is main part of A in an explicit form, C1, C2,... and Cn are small portions </div>
<div>>comparing with B and they don't have an explicit form. Thus I want  to  make a </div>
<div>>preconditioner from B, then apply the preconditioner to Ax=b. Please tell me how I </div>
<div>>can do by PETSC sentences for PETSC solver, thanks.</div>
<div><br></div>
<div>>   call KSPSetOperators(ksp,A,B,......)</div>
<div> </div>
<div>However, A doesn't have an explicit matrix form, how to call</div>
<div>call KSPSetOperators(ksp,A,B,......)</div>
<div></div></blockquote>
<div><br></div></div>
<div>Use MATSHELL for A.</div>
<div><br></div>
<div>   Matt</div>
<div>
<div></div>
<div>
<div> </div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>?  thanks.</div>
<div> </div>
<div>Based on what I thought, once I got preconditioner of B, I am wondering if I can </div>
<div>define a special matrix-vector multiplication for A=B+C1+C2+...+Cn from a PETSC</div>
<div>sentence, such that it can do following</div>
<div>1) x1=B*x</div>
<div>2) x2=x1+ C1*x, where C1*x is a sequence of matrix-vector multiplications</div>
<div>3) x3= x2+C2*x,......</div>
<div>.....</div>
<div>4) xn+1=xn+Cn*x,where Cn*x is a squence of matrix-vector multiplications</div>
<div> </div>
<div>Then select a KSP iterative method such as GMRES to use the above matrix-vector</div>
<div>multiplication and preconditioner that I made from B.</div>
<div> </div>
<div>Could you please tell me if it is possible? if so (I hope), how can I do it ? thanks.</div>
<div> </div>
<div>David<br><br></div>
<div class="gmail_quote">On Sun, Mar 7, 2010 at 11:12 AM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div style="WORD-WRAP: break-word"><br>
<div>
<div>
<div>On Mar 7, 2010, at 10:57 AM, David sheehan wrote:</div><br>
<blockquote type="cite">
<div>>First, configure with Hypre . </div>
<div>You mean, configure for the installation of PETSC with hypre? thanks.</div></blockquote></div>   yes, add --download-hypre</div>
<div>
<div><br>
<blockquote type="cite">
<div> </div>
<div>>Then -pc_type hypre -pc_hypre_type boomeramg</div>
<div>You mean, without adding any information into code include, just compile and link</div>
<div>the code, to get an excuteable file, e.g. "a.out", then</div>
<div>a.out -pc_type hypre -pc_hypre_type boomeramg</div>
<div>is it right? thanks.</div></blockquote>
<div><br></div></div>   Yes,</div>
<div>
<div><br>
<blockquote type="cite">
<div><br>
<div>>I cannot understand exactly what you mean. However, if you want to create a PC</div>
<div>> based upon a >matrix which is not the system matrix A, you can specify it in</div>
<div>> KSPSetOperators().</div>
<div> </div>
<div>I mean Ax =b doesn't have A in explicit form, but in expression A=B+C1+C2+...+Cn, </div>
<div>where B is main part of A in an explicity form, C1, C2,... and Cn are small portions </div>
<div>comparing with B and they don't have an explicit form. Thus I want  to  make a </div>
<div>preconditioner from B, then apply the preconditioner to Ax=b. Please tell me how I </div>
<div>can do by PETSC sentences for PETSC solver, thanks.</div></div></blockquote>
<div><br></div></div>   call KSPSetOperators(ksp,A,B,......)</div>
<div><br></div><font color="#888888">
<div>   Barry</div></font>
<div>
<div><br></div>
<div><br>
<blockquote type="cite">
<div>
<div> </div>
<div> </div>
<div>David</div>
<div> </div><br></div>
<div class="gmail_quote">On Sun, Mar 7, 2010 at 12:32 AM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>On Sat, Mar 6, 2010 at 11:49 PM, David sheehan <span dir="ltr"><<a href="mailto:david.sheehanjr@gmail.com" target="_blank">david.sheehanjr@gmail.com</a>></span> wrote:<br></div>
<div class="gmail_quote">
<div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>Hi, <br>I need your helps about PETSC as follows:<br>1) how can I call boomerAMG of HYPRE through PETSC as a solver and a preconditioner?<br></div></blockquote>
<div><br></div></div>
<div>First, configure with Hypre . Then -pc_type hypre -pc_hypre_type boomeramg</div>
<div>
<div> </div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>2) how can I make a precondioner  from B matrix,  but apply the preconditioner to Ax=b in PETSC? <br>Thanks in advance.</div></blockquote>
<div><br></div></div>
<div>I cannot understand exactly what you mean. However, if you want to create a PC based upon a matrix</div>
<div>which is not the system matrix A, you can specify it in KSPSetOperators().</div>
<div><br></div>
<div>  Matt</div>
<div> </div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote"><font color="#888888">
<div>David</div></font></blockquote></div>-- <br><font color="#888888">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<br></font></blockquote></div><br></blockquote></div><br></div></div></blockquote></div><br></blockquote></div></div></div>
<div>
<div></div>
<div><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<br></div>
</div></blockquote></div><br></blockquote></div><br></div></div></div></div></blockquote></div><br>