File: KSPCG.html

package info (click to toggle)
petsc 3.14.5%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 266,472 kB
  • sloc: ansic: 680,898; python: 33,303; cpp: 16,324; makefile: 14,022; f90: 13,731; javascript: 10,713; fortran: 9,581; sh: 1,373; xml: 619; objc: 445; csh: 192; pascal: 148; java: 13
file content (68 lines) | stat: -rw-r--r-- 5,309 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPCG.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>KSPCG</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
   <div id="version" align=right><b>petsc-3.14.5 2021-03-03</b></div>
   <div id="bugreport" align=right><a href="mailto:petsc-maint@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: petsc-3.14.5 v3.14.5 docs/manualpages/KSP/KSPCG.html "><small>Report Typos and Errors</small></a></div>
<A NAME="KSPCG"><H1>KSPCG</H1></A>
The Preconditioned Conjugate Gradient (PCG) iterative method 
<H3><FONT COLOR="#CC3333">Options Database Keys</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-ksp_cg_type Hermitian </B></TD><TD>- (for complex matrices only) indicates the matrix is Hermitian, see <A HREF="../KSP/KSPCGSetType.html#KSPCGSetType">KSPCGSetType</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-ksp_cg_type symmetric </B></TD><TD>- (for complex matrices only) indicates the matrix is symmetric
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-ksp_cg_single_reduction </B></TD><TD>- performs both inner products needed in the algorithm with a single <A HREF="../Sys/MPIU_Allreduce.html#MPIU_Allreduce">MPIU_Allreduce</A>() call, see <A HREF="../KSP/KSPCGUseSingleReduction.html#KSPCGUseSingleReduction">KSPCGUseSingleReduction</A>()
</TD></TR></TABLE>
<P>

<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
The PCG method requires both the matrix and preconditioner to be symmetric positive (or negative) (semi) definite.
<P>
Only left preconditioning is supported; there are several ways to motivate preconditioned CG, but they all produce the same algorithm.
One can interpret preconditioning A with B to mean any of the following:
<BR>(1) Solve a left-preconditioned system BAx = Bb, using inv(B) to define an inner product in the algorithm.
<BR>(2) Solve a right-preconditioned system ABy = b, x = By, using B to define an inner product in the algorithm.
<BR>(3) Solve a symmetrically-preconditioned system, E^TAEy = E^Tb, x = Ey, where B = EE^T.
<BR>(4) Solve Ax=b with CG, but use the inner product defined by B to define the method [2].
<BR>In all cases, the resulting algorithm only requires application of B to vectors.
<P>
For complex numbers there are two different CG methods, one for Hermitian symmetric matrices and one for non-Hermitian symmetric matrices. Use
<A HREF="../KSP/KSPCGSetType.html#KSPCGSetType">KSPCGSetType</A>() to indicate which type you are using.
<P>
<H3><FONT COLOR="#CC3333">Developer Notes</FONT></H3>
KSPSolve_CG() should actually query the matrix to determine if it is Hermitian symmetric or not and NOT require the user to
indicate it to the <A HREF="../KSP/KSP.html#KSP">KSP</A> object.
<P>
<H3><FONT COLOR="#CC3333">References</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>1. </B></TD><TD>- Magnus R. Hestenes and Eduard Stiefel, Methods of Conjugate Gradients for Solving Linear Systems,
Journal of Research of the National Bureau of Standards Vol. 49, No. 6, December 1952 Research Paper 2379
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>2. </B></TD><TD>- Josef Malek and Zdenek Strakos, Preconditioning and the Conjugate Gradient Method in the Context of Solving PDEs,
SIAM, 2014.
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
  <A HREF="../KSP/KSPCreate.html#KSPCreate">KSPCreate</A>(), <A HREF="../KSP/KSPSetType.html#KSPSetType">KSPSetType</A>(), <A HREF="../KSP/KSPType.html#KSPType">KSPType</A> (for list of available types), <A HREF="../KSP/KSP.html#KSP">KSP</A>,
<BR><A HREF="../KSP/KSPCGSetType.html#KSPCGSetType">KSPCGSetType</A>(), <A HREF="../KSP/KSPCGUseSingleReduction.html#KSPCGUseSingleReduction">KSPCGUseSingleReduction</A>(), <A HREF="../KSP/KSPPIPECG.html#KSPPIPECG">KSPPIPECG</A>, <A HREF="../KSP/KSPGROPPCG.html#KSPGROPPCG">KSPGROPPCG</A>
<P>
<P><B></B><H3><FONT COLOR="#CC3333">Level</FONT></H3>beginner<BR>
<H3><FONT COLOR="#CC3333">Location</FONT></H3>
</B><A HREF="../../../src/ksp/ksp/impls/cg/cg.c.html#KSPCG">src/ksp/ksp/impls/cg/cg.c</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/ksp/pc/tutorials/ex1.c.html">src/ksp/pc/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/ksp/pc/tutorials/ex2.c.html">src/ksp/pc/tutorials/ex2.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/tutorials/ex59.c.html">src/ksp/ksp/tutorials/ex59.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/tutorials/ex71.c.html">src/ksp/ksp/tutorials/ex71.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/tutorials/ex78.c.html">src/ksp/ksp/tutorials/ex78.c.html</A><BR>
<A HREF="../../../src/tao/bound/tutorials/jbearing2.c.html">src/tao/bound/tutorials/jbearing2.c.html</A><BR>
<A HREF="../../../src/tao/pde_constrained/tutorials/parabolic.c.html">src/tao/pde_constrained/tutorials/parabolic.c.html</A><BR>
<BR><A HREF="./index.html">Index of all KSP routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
</BODY></HTML>